Tweet blitz3d cross-platform fonts sprites blitzx rated
This is SpriteFont! — a wip font system that uses projected 3D sprites! I thought of utilizing sprites to render fonts as a great alternative since there are still a few kinks on my crossplatform truetype font implementation on BlitzX.
I got this idea way back when looking into a lot of demos and examples of projecting sprites in 2D like Sprite Control and other cool blitz3d sprite stuff. I have been planning to go with this route since I think this will make the project more efficient, less dependent, lighter and really simple.
Right now it only supports fixed size fonts, but the demo shown here uses bitmap fonts generated from a AngelFont or BMFont tool and format, so it is possible to do some kerning and other character alignment on future versions.
Font sizing will also be easier to manage since it just uses entity scaling like the screenshot only uses 1 bitmap font set for both size. There is a One Big Size Fits All like this one or you can also generate specific bitmap font set sizes of your choice.
SpriteFont will be the text rendering component of BlitzX to replicate LoadFont, Text and other font functions. Truetype fonts will still be supported, but eventually as an addon or userlib.
I will upload an online and perhaps update the android demos once I finalize and do some cleanup on the process!
Download v1.0 with Blitz3D Source + Demo and BlitzX Demo
You can use any Bitmap Font Editor that generates or exports images in png format.
SpriteFont uses LoadAnimTexture to assign each character by frame so mapping the fonts is pretty straightforward. This is defined in the
The default set is the ASCII char set which is in order. Change this depending on your exported font images.
A bit of kerning is supported for non fixed font ( not same height and width, ex. 21x31) and more of a wip. Check
kern$ variable (not necessary in order) for characters that requires for a better fit.
Graphics3D 800,600,0,2 SetBuffer BackBuffer() Include "SpriteFont.bb" cam = SFInit() ; Initialize the main camera with SpriteFont CameraClsColor cam,0,128,255 font = SFLoadFont("assets/font",25,33,95) ;font size 25, texture width 33 pixels, 95 frames, texture height same as width (fixed) SFSetFont(font) SFText(260,60,"SPRITE FONT") While Not KeyHit(1) UpdateWorld RenderWorld() Flip Wend
having read a bit about how to do 2D-in-3D in GLES I can say I do think you're going in the right direction with this. In a nutshell, changing render states in GLES has several problems due to reduced GL commands.
Thanks Mark and that's great to hear! I do see and have read about it with blitz and other game engines that rendering 2D in 3D has its performance drawbacks as well.
I also did recall and know that there are other related or similar projects before like Beaker's FonText among other quick demos.
I made a little bit of progress using non-fixed fonts with basic letter spacing feature and this will be added as an option or function.
In this updated screenshot, I have used Blitz3D's default font Blitz (.fon) converted to bitmap fonts with BMFont!
Font color also now works using EntityColor and more effective if you make those exported fonts pearly whites!
Just completed the first working version with demo for both Blitz3D and BlitzX. Blitz3D source included.
see updated download links above
Reply To Topic (minimum 10 characters)
Please log in to reply