There are some path problems when loading resources in javafx.
Resource loading in game development is nothing more than audio, images, and fonts.
While loading images in javafx uses relative paths and SRC folders.
For example, if you want to download player.png in the resfile folder under src, we only need new image ("Res/player.png ").
However, you cannot load the audio. If the new audioclip ("Res/battleworkflow") is used to load the audio, the URI. getscheme () = NULL is displayed. Obviously, this tells you that no protocol is specified. The protocol here is not tcp udp. But http ftp file.
Therefore, when loading audio, you can use the getclass (). getresource ("XXXXX"). tostrin. G () method to obtain the path of resources in the same directory of the class. You can also use thread. currentthread (). getcontextclassloader (). getresource ("XXXXX"). tostring () to obtain resources in the src directory.
The font is the same as the audio. Of course, loading images in this way is equally effective.
Reprinted please indicate the source: http://blog.csdn.net/ml3947
----------------------------------------------------------------------------
Javafx-based game engine under development...
The progress is not bad, but some examples of games are also being done.
A separate website will be created later.
----------------------------------------------------------------------------