Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/opengl/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 漂亮的GUI文本没有呈现_Java_Opengl_Lwjgl_Nifty Gui - Fatal编程技术网

Java 漂亮的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(),

我正在尝试为游戏创建一个简单的开始屏幕,我正在使用LWJGL和漂亮的gui

以下是我现有的代码:

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