I started looking into slick and LWJGL this morning but I can't get spritesheetfonts to work. Here is my code:
Code:
public class MainDisplay {
public static int WIDTH = 448;
public static int HEIGHT = 224;
SpriteSheetFont font;
public void start() {
try {
Display.setDisplayMode(new DisplayMode(WIDTH, HEIGHT));
Display.create();
} catch (LWJGLException e) {
e.printStackTrace();
System.exit(0);
}
// Initialize
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0, WIDTH, HEIGHT, 0, 1, -1);
glMatrixMode(GL_MODELVIEW);
init();
while (!Display.isCloseRequested()) {
// render
paint();
Display.update();
Display.sync(30);
}
Display.destroy();
}
private void paint() {
glClear(GL_COLOR_BUFFER_BIT);
font.drawString(0, 0, "This is a test string");
glDisable(GL_TEXTURE_2D);
}
public void init() {
try {
font = new SpriteSheetFont(new SpriteSheet("Spritesheet.png", 8, 8, Color.white), (char) 0);
} catch (SlickException e) {
e.printStackTrace();
}
}
public static void main(String[] args) {
MainDisplay display = new MainDisplay();
display.start();
}
}
But all that shows up are 8x8 white squares. Here is my sprite sheet:

What am I doing wrong/missing?