Rendering In-Game Text
by Eric Robinson · in Torque Game Builder · 09/18/2006 (12:55 am) · 11 replies
Is there a short and sweet way to load a font and write out to the screen using the font in TGB? What I really would like to see are text-sprites or something similar. I'd really rather avoid using bitmapped fonts.
(I work on a Mac and things like Bitmap Font Builder are frequently Windows-only.
(I work on a Mac and things like Bitmap Font Builder are frequently Windows-only.
#2
What I've been thinking about doing instead is subclassing the t2dStaticSprite object and making a t2dText object. There are text rendering functions already built into the engine... it's just a matter of giving everything the t2d-Touch. I'd subclass the t2dStaticSprite objects because then each object could support (I think) a bitmap background for the text. At least... that's the idea. I have to look into exactly how t2dStaticSprites are rendered to see if that's viable or if my head's in the clouds.
As for the last option... it would take me a heck of a lot longer than 20 minutes to produce the right bitmap font. My project requires use of Japanese fonts... all told I need access to some 2,000 characters. I'd like to support text like that found in the following:
Does my t2dText object idea make sense at all?
09/18/2006 (3:31 am)
I've looked into using the GUI controls but find it wholly inadequate for the very reason you mention.What I've been thinking about doing instead is subclassing the t2dStaticSprite object and making a t2dText object. There are text rendering functions already built into the engine... it's just a matter of giving everything the t2d-Touch. I'd subclass the t2dStaticSprite objects because then each object could support (I think) a bitmap background for the text. At least... that's the idea. I have to look into exactly how t2dStaticSprites are rendered to see if that's viable or if my head's in the clouds.
As for the last option... it would take me a heck of a lot longer than 20 minutes to produce the right bitmap font. My project requires use of Japanese fonts... all told I need access to some 2,000 characters. I'd like to support text like that found in the following:
Quote:マンスフィルドさん、答えてくれたありがとうございます。大変なんですけど、漢字の能力、機能が必要なんですから、一つ一つ入れる時間はありません。[Heh... it appears that, while Torque may be Unicode-capable, the Torque-Forums leave much to be desired!]
Does my t2dText object idea make sense at all?
#4
I'll download it and give it a shot.
09/18/2006 (5:12 am)
Wow, that's exactly what I was looking for! That saves me countless hours of programming and debugging.I'll download it and give it a shot.
#6
09/18/2006 (6:52 am)
Hmm, looks like the TDN one has the later time stamp (August vs March).
#7
It certainly would be handy for the little project I am working on at the moment. :)
09/20/2006 (5:10 am)
Does anyone know if this kind of text display functionality is going to be incorporated into T2D officially anytime soon?It certainly would be handy for the little project I am working on at the moment. :)
#8
We're looking into various t2dTextObject designs, but one of the limiting factors is performance, as well as cross platform needs. No real ETA on having a unique t2dTextObject in the binary/source (although if you are a PRO user, you can use the published resource).
09/20/2006 (11:14 am)
For now the solution is to create a GuiControl of whichever sort you need, and then attach it to a t2dSceneObject--it will solve most of your needs.We're looking into various t2dTextObject designs, but one of the limiting factors is performance, as well as cross platform needs. No real ETA on having a unique t2dTextObject in the binary/source (although if you are a PRO user, you can use the published resource).
#9
09/20/2006 (7:18 pm)
Just backing what Stephen said... though a t2dTextObject is being worked on with some very nice features that I didn't even expect :) Look for it in future versions.
#10
@Everyone: In the meantime, I've a quick question. Which of the two resources linked above (and following) are "better"? The dates only represent the original date of posting and a quick scan of the source reveals that they are very different. Can someone with more source experience than me give a quick overview at which is more efficient, offers more features, is easier to use, etc.? Opinions, even after brief looks, would be greatly appreciated!
The two links I refer to are here:
GarageGames.com Resource version.
TDN Resource version.
Thanks!
09/21/2006 (6:04 pm)
@Stephen & Matthew: I will definitely keep my eyes open for an official t2dTextObject. Cannot wait to see that show up.@Everyone: In the meantime, I've a quick question. Which of the two resources linked above (and following) are "better"? The dates only represent the original date of posting and a quick scan of the source reveals that they are very different. Can someone with more source experience than me give a quick overview at which is more efficient, offers more features, is easier to use, etc.? Opinions, even after brief looks, would be greatly appreciated!
The two links I refer to are here:
GarageGames.com Resource version.
TDN Resource version.
Thanks!
#11
09/21/2006 (6:28 pm)
I'd recommend the TDN one since for one I posted it up there, also Michael W. did it (we added a couple helper functions, thats it) and it is very stable. In fact in my "Fire and Healing" demo I use the TDN version :)
Torque Owner Philip Mansfield
Default Studio Name
You could always setup text profiles and use GUI controls, but that's a little messy as you'll need different profiles for different sizes, and they won't interact with any of your scene objects.
It might take you 20 minutes, but you could always just type out the letters in a paint program, arrange them into a grid pattern and presto, one bitmap font without requiring the use of some Windows only software.