text

Blitz3D Forums/Blitz3D Beginners Area/text

????(Posted 2005) [#1]
How would I make a hud with text and have the text stay the same size at all screen resoulotions?


_PJ_(Posted 2005) [#2]
Well you can either have 3D sprites (scaled using GraphicsWidth() and GraphicsHeight() ) and positioned correctly, then parented to the camera (remembering to use FullBright and Disable Fog to ensure your HUD sprites are always nice and clearly visible)

OR

You can just use 2D Commands like Text and display these AFTER the RenderWorld statement, but before the Flip

However, there used to be a lot of talk of mixing 2D and 3D causing slowdown... dunno if this ever got fixed...


jhocking(Posted 2005) [#3]
Using 2D commands will not stay the same size at all resolutions. Given his question, I assume he already knows about commands like Text and is wondering about alternatives.

I would suggest a 2D-in-3D graphics system, although I wouldn't really recommend doing it with sprites. There are a number of such systems you can just plug into your code; I use FONText, linked in Toolbox->GUI Libs. For other options (including some free stuff) search for "bitmap fonts."


????(Posted 2005) [#4]
Thank you jhocking


VP(Posted 2005) [#5]
I have this particular issue on the to-think-about list for my Spheres project.

The solutions I have considered so far are:

1) Pretty much what Malice said.
2) Create a custom vector-based font and font rendering system to display all in-game text, anti-aliased if enough CPU horsepower or 3D trickery can be brought to bear.

I'm leaning toward solution 1 for the beta phase of the project and number 2 would be the final and most desirable solution (looks nicer).

Alpha stage (current stage) consists of me using the text command and a font from http://www.aenigmafonts.com/

Looks bloody awful currently, but it does the job.


octothorpe(Posted 2005) [#6]
TrueType fonts are vector fonts


big10p(Posted 2005) [#7]
TrueType fonts are vector fonts
No they're not, strictly speaking. :) The TrueType format is basically a list of instructions of how to construct a bitmap image of the font at a given size.


octothorpe(Posted 2005) [#8]
(Oops. I read the whole Wikipedia article this time!)

They're both! TrueType fonts contain both vector outlines of glyphs (straight line segments and quadratic Bézier curves) and hint programs (yes, run by a virtual machine) to tweak the outlines so that glyphs look good at a variety of sizes.

Fascinating stuff!


jfk EO-11110(Posted 2005) [#9]
you may use 2D text and determine the required font size this way:

pt#=16 ; wanted size
screen_rel#=graphicswidth()/640.0
px#=pt*screen_rel
font=loadfont("verdana",px)

But you still need to do the same with the coordinates you want to draw text to.


Sledge(Posted 2005) [#10]
My first thought would be to draw 2D text to a texture (via an image if it proves faster) and assign that texture to a screen-filling quad that is either very close to its parent camera or has a negative entityorder.


VP(Posted 2005) [#11]
Truetype/vector fonts as accessed via the text command are not what I meant by my option 2. Using such fonts is limited by the Text command. You can't rotate or resize such fonts without recourse to image grabbing trickery, which is less than optimal.

My idea of a vector font is really a very simple font described as a set of coordinates rendered as filled polys, or a bunch of flat, or even slightl chunky, 3D objects representing each character in the font. Nice animated menus are then very easy to do.