andymc Well-Known Member Licensed User Longtime User Mar 13, 2014 #1 I'm trying to use fonts in a game I'm making but I'm getting a null pointer exception in my main batch loop. I setup the font with: Code: Copy Dim bitmapfont As lgBitmapFont then in lg_create: Code: Copy bitmapfont.Initialize bitmapfont.SetColorRGBA(0, 0, 0, 1) 'Blue in lg_render I then call: Code: Copy bitmapfont.Draw(Batch,"Score",50%x,50%y)
I'm trying to use fonts in a game I'm making but I'm getting a null pointer exception in my main batch loop. I setup the font with: Code: Copy Dim bitmapfont As lgBitmapFont then in lg_create: Code: Copy bitmapfont.Initialize bitmapfont.SetColorRGBA(0, 0, 0, 1) 'Blue in lg_render I then call: Code: Copy bitmapfont.Draw(Batch,"Score",50%x,50%y)
andymc Well-Known Member Licensed User Longtime User Mar 13, 2014 #2 Okay, I've figured it out. I think the Lib does not include a default bitmap font file. So I generated one using this: http://www.angelcode.com/products/bmfont/ And then saved the fnt file into my files folder for my project. I then initialised the font in B4A using the line: Code: Copy bitmapfont.Initialize2(lGdx.Files.internal("bmfont.fnt")) And this has worked Upvote 0
Okay, I've figured it out. I think the Lib does not include a default bitmap font file. So I generated one using this: http://www.angelcode.com/products/bmfont/ And then saved the fnt file into my files folder for my project. I then initialised the font in B4A using the line: Code: Copy bitmapfont.Initialize2(lGdx.Files.internal("bmfont.fnt")) And this has worked