Nifty default controls prevent the rest of my game from rendering
- by zergylord
I've been trying to add a basic HUD to my 2D LWJGL game using nifty gui, and while I've been successful in rendering panels and static text on top of the game, using the built-in nifty controls (e.g. an editable text field) causes the rest of my game to not render. The strange part is that I don't even have to render the gui control, merely declaring it appears to cause this problem.
I'm truly lost here, so even the vaguest glimmer of hope would be appreciated :-)
Some code showing the basic layout of the problem:
display setup:
// load default styles
nifty.loadStyleFile("nifty-default-styles.xml");
// load standard controls
nifty.loadControlFile("nifty-default-controls.xml");
screen = new ScreenBuilder("start") {{
layer(new LayerBuilder("baseLayer") {{
childLayoutHorizontal();
//next line causes the problem
control(new TextFieldBuilder("input","asdf") {{
width("200px");
}});
}});
}}.build(nifty);
nifty.gotoScreen("start");
rendering
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLU.gluOrtho2D(0f,WINDOW_DIMENSIONS[0],WINDOW_DIMENSIONS[1],0f);
//I can remove the 2 nifty lines, and the game still won't render
nifty.render(true);
nifty.update();
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
GLU.gluOrtho2D(0f,(float)VIEWPORT_DIMENSIONS[0],0f,(float)VIEWPORT_DIMENSIONS[1]);
glTranslatef(translation[0],translation[1],0);
for (Bubble bubble:bubbles){
bubble.draw();
}
for (Wall wall:walls){
wall.draw();
}
for(Missile missile:missiles){
missile.draw();
}
for(Mob mob:mobs){
mob.draw();
}
agent.draw();