#100302 - smoothingeye - Sun Aug 27, 2006 8:35 am
I am trying to write an UI system for my app . How do i write text over the 2D graphcis? or3 D graphiscs any idea?
#100325 - Lick - Sun Aug 27, 2006 11:22 am
Depends on how you want to write the text.
Generally, you would put the text on a background (some way) and then set the background to be on top (BG_PRIORITY_0=top) and the other graphics lower than top (BG_PRIORITY_1,2,3).
There are 2 methods for writing texts that I know of: (1) console text. (2) pixel-plotting text.
If you choose (1) you'll have 8x8, customizable fonts (monospace, width is always 8). This is good and easy, but doesn't look as good as variable-width fonts (that is: each letter has a different width).
If you choose (2) you'll have to have a font-generator that outputs all characters of a font of a given fontsize, per-pixel and also stores the width of that character. DragonMinded has tools that are downloadable from here. Note that the output is RGB, but you need to do BGR for DS.
_________________
http://licklick.wordpress.com
#100327 - revo - Sun Aug 27, 2006 11:31 am
In my framework, all is done on 3D hardware. I'm using class TextBox, which allocates texture of size 256x8 px in 4 colors indexed format (512 bytes). All text writing is done by writing to texture, and then showing it with orthogonal projection. Additional colors can be made by using lights or manipulating materials.
_________________
[ sorry for all mistakes, but my english isn't as good as I wish it to be ]
#100353 - tepples - Sun Aug 27, 2006 2:47 pm
Or for HUD text, you can use the one-sprite-per-glyph method that a lot of GBA games used. For instance "HELLO WORLD" would be 10 sprites.
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.
#100365 - smoothingeye - Sun Aug 27, 2006 4:02 pm
can u explain how to do it in 3D hardware?
Is it better to use 3D to do Ui or it is better to use the 2D engine? I want to create a listbox and a icon list box
#100393 - Lick - Sun Aug 27, 2006 6:02 pm
revo: how did you get the coordinates to align? (0,0)3D = (0,0)2D? I can't get it to work at all.
_________________
http://licklick.wordpress.com