How do i add a text object to my scene
by hbomega · in Torque 2D Beginner · 08/08/2013 (6:47 am) · 6 replies
Can someone please show me how to add and manipulate text in a scene for example like having and displaying a "High Score" though i could probably figure out how to manipulate it myself i just need to see it done correctly once thanks in advance
#2
08/08/2013 (8:03 am)
If you want to use image fonts, open the script in the ImageFontToy module. There's some sample code in there. Otherwise, you will have to use the GUI system. The Sandbox module has many examples of how to add text via the GUI system.
#3
Using both 'font' and 'fancyfont' a small sentence takes up most of the screen (at small sizes less than 2). The padding is set to 0, so wondering if there is just a better font than those that is available.
08/08/2013 (7:43 pm)
Addendum to this question. Just figured out adding image fonts, is there a way to make the text with less spacing between letters?Using both 'font' and 'fancyfont' a small sentence takes up most of the screen (at small sizes less than 2). The padding is set to 0, so wondering if there is just a better font than those that is available.
#4
The space between frames is something to keep in mind when creating your own bitmap fonts with a generator program. Probably best to have as little as possible since you can always add padding if needed.
08/08/2013 (9:23 pm)
Yes, the default ImageFonts have a bit too much space between them. To fix this, you would have to edit the PNG itself and reduce the amount of space between each frame and then adjust the asset file to reduce the CellWidth value. There's probably a way to leave the image file alone and just do all adjustments through the asset TAML file, but that would probalaby mean using explicit mode to manually define frame locations and widths.The space between frames is something to keep in mind when creating your own bitmap fonts with a generator program. Probably best to have as little as possible since you can always add padding if needed.
#5
08/08/2013 (10:56 pm)
thanks guys, i finally know how to add text to my scene, i really should have thoroughly gone through the sand box tutorial, thanks again
#6
08/13/2013 (3:35 am)
Ok thanks Mike.
Associate Mike Lilligreen
Retired T2Der
There is an example toy in the Sandbox that also shows how to use it through Torquescript.