2D/3D font system?

Blitz3D Forums/Blitz3D Programming/2D/3D font system?

Craig H. Nisbet(Posted 2004) [#1]
Anyone know of a good 2d/3d font system? I need it for my on screen animated game text. I'm willing to buy it if it's good enough.


sswift(Posted 2004) [#2]
If what you are looking for is a system to display fonts in 3D games quickly, my GUI system does exactly that. It supports centering text and word wrapping too. It's real simple to use, but it gives you enough tools to create nice game menus. It displays fonts, sprites, and has life-bar like things called databars which can be straight or curved. It also has functions which will tell you when the mouse has entered or exited a gui object's region.

But like I said, even with all that it's real simple. Couldn't get any simpler really. It's almost as easy to throw text up on the screen with my system as it is to use the text command.


jhocking(Posted 2004) [#3]
I recommend FONText. There's a free one in the Code Archives that's pretty good too.


sswift(Posted 2004) [#4]
Fontext, the app, makes pretty fonts, but I have heard people say that the font system it comes with to use those fonts is hard to use and not well documented. I haven't looked at it myself. You might want to ask around about that if you're considering it.

If you want to use fontext to make fonts and then use them with my system, you can do that too. My system requires that the letters be laid out in a grid like an animtexture, and that's what fontext does.

But if you don't want to use fontext, my system comes with a small app to generate fonts which can span multiple textures which you can then edit in photoshop to add gradients and outlines and such.


jhocking(Posted 2004) [#5]
I use FONText for displaying my bitmap fonts; it works great. It took a little figuring out (maybe an hour) because the documentation is a little bad, but once figured out the HUD code for FONText is really easy to use. I don't know much about it's other UI functionality however (buttons and stuff.) I haven't used that stuff yet, just the font stuff.

I've not used sswift's GUI system so I can't comment much on that, but his shadow system is superb so at least I can say he's a good programmer.


slenkar(Posted 2004) [#6]
SSWift does your system allow 3d mesh objects (e.g. a soldier) to be placed at 2D screen co-ordinates and allow it to be used as a button?


GfK(Posted 2004) [#7]
I use FONText too. The documentation isn't fantastic, but it doesn't need to be - the examples are pretty easy to follow.


N(Posted 2004) [#8]
Could just write your own, doesn't take that long- maybe a hundred lines if you've already got a 2d-to-3d system up and running, and if not that's extremely simple too.

Like so:
Global IX#,IY#,IZ#
Global CX#,CY#

Function InitCamera()
     C = CreateCamera()
     P = CreatePlane()
     PositionEntity P,0,0,10
     TurnEntity P,-90,0,0
     EntityPickMode P,2
     CameraPick P,0,0
     CX# = Abs PickedX()
     CY# = PickedY()
     FreeEntity P
     Return C
End Function

Function 2DTo3D(Camera,X#,Y#)
     X = (X/GraphicsWidth())*(CX*2)-CX
     Y = CY - (Y/GraphicsHeight())*(CY*2)
     TFormPoint X,Y,10,Camera,0
     IX = TFormedX()
     IY = TFormedY()
     IZ = TFormedZ()
End Function

Graphics3D 800,600,32,2

Camera = InitCamera()

Mesh = CreateMesh()
Surface = CreateSurface(Mesh)

2DTo3D(Camera,64,64)
V = AddVertex(Surface,IX,IY,IZ)

2DTo3D(Camera,256,64)
AddVertex(Surface,IX,IY,IZ)

2DTo3D(Camera,256,256)
AddVertex(Surface,IX,IY,IZ)

2DTo3D(Camera,64,256)
AddVertex(Surface,IX,IY,IZ)

AddTriangle Surface,V,V+1,V+2
AddTriangle Surface,V+2,V+3,V


Ta-da. It's simple, and there's no guarantee that's gonna work right off the bat, but that's how I do it and so far it's been close to pixel-perfect for me.

After that, you just gotta find out the UV positions of the characters on the texture so you can add the vertices accordingly. It's usually only two lines to do that, and a few more if you want 'proper' word wrapping.


Beaker(Posted 2004) [#9]
Hard to use?
Include "HUDinclude.bb"    ; include the standard Fontext playfont lib
Graphics3D 640,480
SetBuffer BackBuffer()
myfont.HUDfont = HUDLoadFont("snooker.tga")    ; load a font

camera = CreateCamera()
myHUD.HUD = CreateHUD(camera)    ; setup a single HUD (Head Up Display)
myLayer1.HUDlayer = CreateLayer(myHUD)    ;create a single layer attached to myHUD
HUDtext 320,240,"Hello World",true,true    ; centre text in middle of screen

RenderWorld:Flip
WaitKey
End


Recent features to note:
packed fonts for minimum texture use
gile[s] plugin(s)
animated text
extended 'HUDevents': return string containing character or word clicked on


Dragon57(Posted 2004) [#10]
For what it is worth, I just purchased swift's gui system. It works as advertised, it is easy to understand and it is easy to extend if you want/need to. Highly recommended.


Sledge(Posted 2004) [#11]
http://www.blitzcoder.com/cgi-bin/showcase/showcase_showentry.pl?id=cyberseth05162003013142&comments=no


Craig H. Nisbet(Posted 2004) [#12]
I'm seriously considering the swift system for it's ablity to wrap text. I need that for my information boxes in my game.


Craig H. Nisbet(Posted 2004) [#13]
That Blitz Coder link doesn't seem to work for me.


Skitchy(Posted 2004) [#14]
@Beaker - I bought FonText ages ago and was wondering where to get the updates?


Sledge(Posted 2004) [#15]

That Blitz Coder link doesn't seem to work for me.



Same here now, although I tested it after posting (I read on BCoder that the showcase is bugged after the server move so that probably explains it). Cyberseth's system is free and sounds like it might be just what you're after. I've put it here so you can at least have a look while BCoder's goofed...

http://www.gamefreax.fsnet.co.uk/Downloads/fontlib.zip


Rob(Posted 2004) [#16]
I vote fontext too


Rook Zimbabwe(Posted 2004) [#17]
I use fontlib... It is easy but not as fully featured as sswifts offering. It depends on what you are going to do. If you just want text use fontlib... if you may need clickable entities or sprites and word wrapping I do reccomend sswifts codeset.


aCiD2(Posted 2004) [#18]
I say nSprite


Boiled Sweets(Posted 2004) [#19]
Or Seth's free BMPFont.


Rook Zimbabwe(Posted 2004) [#20]
Seths is good too! I can't seem to find a link to it anymore though...


aCiD2(Posted 2004) [#21]
Its on BlitzCoder


Beaker(Posted 2004) [#22]
Skitchy - check your Inbox.


Sledge(Posted 2004) [#23]

Seths is good too! I can't seem to find a link to it anymore though...



It's easier to find on B'Coder with Google than it is the site's own search function (top link http://www.google.com/search?hl=en&ie=UTF-8&q=cyberseth+fontlib ). Or you could just download it from the link above (while it lasts).


Mustang(Posted 2004) [#24]
I use Sswifts system... so far it's been great, and Sswift even made a font generator that generates bitmap fonts from truetype fonts.


Boiled Sweets(Posted 2004) [#25]
I beleive Seth is currently working on a new super improved version of hos lib. Hopefully it will be free...