Hey folks,
I’ve been hacking on my UI and trying to get something to display with a custom font, but I’ve run into a bit of a problem. Here’s the code:
AssetManager am = sapp.getAssetManager();
defaultUIFont = am.loadFont("Textures/ui/Liberation-Serif_0.tga");
Here, AssetManager seems to call out to com.jme3.textures.plugins.TGALoader to do the job - all well and good. However, when trying to run this, I get the following error:
java.lang.IllegalArgumentException: Texture assets must be loaded using a TextureKey
at com.jme3.texture.plugins.TGALoader.load(TGALoader.java:77)
at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:272)
at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:388)
at com.jme3.asset.DesktopAssetManager.loadFont(DesktopAssetManager.java:434)
at com.mygame.gui.FieldMenuController.initialize(FieldMenuController.java:123)
...
I can’t replace my path with a TextureKey for the same path, because LoadFont doesn’t accept one. I searched for this on the forum and came up empty, but other people seem to have been using tga fonts fine, so I must be doing something wrong - I just can’t figure out what. I also can’t find a converter for .tga to .fnt, which you’d think would be fairly simple but is, somehow, not. The javadoc for TGALoader isn’t very helpful, containing only the boilerplate descriptions that come with any resource loader interface implementation. If anyone can provide insight, I’d appreciate it.