Java 漂亮的GUI文本没有呈现
我正在尝试为游戏创建一个简单的开始屏幕,我正在使用LWJGL和漂亮的gui 以下是我现有的代码:Java 漂亮的GUI文本没有呈现,java,opengl,lwjgl,nifty-gui,Java,Opengl,Lwjgl,Nifty Gui,我正在尝试为游戏创建一个简单的开始屏幕,我正在使用LWJGL和漂亮的gui 以下是我现有的代码: public class Main { public Main(){ if (!LwjglInitHelper.initSubSystems("Risk It")) { System.exit(0); } Nifty nifty = new Nifty( new LwjglRenderDevice(),
public class Main {
public Main(){
if (!LwjglInitHelper.initSubSystems("Risk It")) {
System.exit(0);
}
Nifty nifty = new Nifty(
new LwjglRenderDevice(),
new OpenALSoundDevice(),
new LwjglInputSystem(),
new AccurateTimeProvider());
Game game = new Game(nifty);
}
public static void main(final String[] args) throws Exception {
Main main = new Main();
}
}
public class Game {
public Game(Nifty nifty){
nifty.fromXml("util/tutorial.xml", "start");
LwjglInitHelper.renderLoop(nifty, null);
LwjglInitHelper.destroy();
}
}
可以找到LWJglineThelper类
我的XML是:
<?xml version="1.0" encoding="UTF-8"?>
<nifty>
<useStyles filename="nifty-default-styles.xml" />
<useControls filename="nifty-default-controls.xml" />
<screen id="start">
<layer id="background" childLayout="center">
<image filename="util/img/menuTexture.png" />
<text text="My Cool Game" font="Venus_Rising.fnt" width="100%" height="100%" />
</layer>
</screen>
</nifty>
但是,文本不会出现在屏幕上:
.fnt文件和.png文件位于src文件夹中的我的类路径中
知道问题出在哪里吗?字体属性路径就是问题所在。它需要.fnt文件的完整路径,例如: font=Interface/font/AdobeArabic.fnt