Slick UnicodeFont displays in different location depending on the screen size?
- by Joehot2000
I am using the Slick2D library to draw text. The text draws perfectly, however it is in the wrong location!
I could easily draw it in the correct location, however the problem is that the "correct location" is very different depending on the size of the screen - And my game needs to be able to have the screen size changed.
Here is the render method for the text:
public static void render() {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glLoadIdentity();
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_NORMAL_ARRAY);
glUseProgram(0);
glBindBuffer(GL_ARRAY_BUFFER, 0);
glMatrixMode(GL_PROJECTION);
glLoadMatrix(orthographicProjectionMatrix);
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glLoadIdentity();
glDisable(GL_LIGHTING);
font.drawString(0, 0, "OMG ITS TEXT!", Color.green);
glEnable(GL_LIGHTING);
glPopMatrix();
glMatrixMode(GL_PROJECTION);
glLoadMatrix(perspectiveProjectionMatrix);
glMatrixMode(GL_MODELVIEW);
}
So, how can I set the text to be in the middle of the screen irrespective of screen size?
Thanks!