HELP! (Slick2D)

Posted by (twitter: @caranha)
December 18th, 2011 5:44 am

So I´m trying to pretty up my game, but I can´t get Slick2D to render fronts using the UnicodeFont class. (So I can´t use some of the fancier functions from that class)

using the Graphics Class, I manage to:


But when I do:

UnicodeFont font = new Unicodefont(new Font(fontname, Font.Plain,20);

Nothing happens.

I have tried to add a font effect to UnicodeFont, but it is still not displaying :-(

Halp, please?

EDIT: Thanks for all the help! It turns out that I have to font.loadGlyphs() at every render cycle to get my font to display.

Tags: , ,

5 Responses to “HELP! (Slick2D)”

  1. caranha says:

    Got some help _> lolwut?

  2. kibertoad says:

    Are you sure you want to use UnicodeFonts? AngelCode fonts are much faster, you can generate them from ttf (don’t forget to remember some symbols) with this utility

    But UnicodeFont should work as well. Could you paste more code? Are you drawing from within the Render routine? Is the colour properly set?

    I do it like this:

    Droid_Sans_16_No_Outline = new AngelCodeFont(“fonts/droid_16_sans.fnt”, “fonts/droid_16_sans_0.png”);

    textFont = Droid_Sans_16_No_Outline;

    textFont.drawString(xx, yy, line, colour);

    Does the rest of the Slick code work properly for you? Is the OpenGL properly initialized, can you draw the Slick Images? Maybe the problem is because you use Graphics (Java2D?) instead of Slick.Images and it might not play along with lwjgl nicely.

  3. Jarek Radosz says:

    after adding the font effect:


  4. kibertoad says:

    remember -> “select” some symbols, I meant – otherwise you’ll generate empty font :).

  5. caranha says:

    Yeah, I forgot to load the glyphs :-(
    So as far I as can tell, loadGlyphs() is kind of a ¨Flush¨, and the ¨Draw()¨ method doesn´t really draw? That makes sense with the behavior I´m seeing.

    I´m kinda learning about Slick2D as I go along… not good, I know, but I´m getting somewhere. I should probably look into AngelFonts, seems better… but I´m moved on to the next part of the project already :-)

    Thanks for all the help! (I tried to edit my first comment but couldn´t)

Leave a Reply

You must be logged in to post a comment.

[cache: storing page]