About | Rules and Guide
Construction1990’s Internet Montage? No!
Please excuse the site weirdness. Mike is fixing and making things.
Ludum Dare 31 — Coming December 5th-8th 2014!

  • ??? Begins: in 7 days, 15 hours, 55 minutes, 43 seconds
  • October Ends: in 8 days, 16 hours, 7 minutes, 43 seconds
  • Ludum Dare 31 begins: in 43 days, 16 hours, 55 minutes, 43 seconds
  • (FYI: Clock might be off) | Ludum Dare 31: Real World Gatherings (Now Open!)

    [ October Challenge 2014 | Resources | Submit/Edit | View All ]

    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.

    All posts, images, and comments are owned by their creators.

    [cache: storing page]