gbadev.org forum archive

This is a read-only mirror of the content originally found on forum.gbadev.org (now offline), salvaged from Wayback machine copies. A new forum can be found here.

Coding > text

#946 - whodoo - Sun Jan 12, 2003 6:31 pm

is there any good way of displaying text on the GBA when using tile-mods? Ive found some source but that code only covers bitmapsmodes..and lots of assembler..can I do it in mode 0-1 and just with C?..
of course I can show every single letter as a sprite or something but I guess there are better ways..

#949 - subbie - Sun Jan 12, 2003 6:48 pm

You should be able to just map out your text like you would a tile map for mode 0-1 if you want to use a layer rather then sprites. I would go with sprites insted if you have the sprite ram for it. If you are unsure about having enough oam then just create a system that sorts out what sprites are on what scanlines and swap the data in oam. (did this once since I needed 100 block for a puzzle & 40 numbers on the side & top).

#956 - Splam - Sun Jan 12, 2003 7:41 pm

Yeah, if you want to do it as another BG then just make a tileset with the font you want in it. You'll need some kind of conversion array if you don't want the entire ascii font (which you probably don't) where your tiles maybe 0=a 1=b 2=c etc have a corresponding array entry, so you can then have a function which you pass a string to and that function converts the C made string into your tile values. Alternativly you could write a bit of code which does the same thing.

#1063 - tepples - Tue Jan 14, 2003 7:28 am

Splam wrote:
You'll need some kind of conversion array if you don't want the entire ascii font (which you probably don't)


Really? With 1024 different tiles available at 32 bytes of VRAM per 16-bit tile, I'd think dedicating 64 (0x20-0x5F) or 96 (0x20-0x7F) to text wouldn't be so hard.

EDIT: Oops. "16-bit" should have been "16-color".
_________________
-- Where is he?
-- Who?
-- You know, the human.
-- I think he moved to Tilwick.


Last edited by tepples on Wed Jan 15, 2003 7:09 pm; edited 2 times in total

#1180 - ampz - Wed Jan 15, 2003 3:48 pm

tepples: That's 32bytes of VRAM per 4bit tile, not 16bit tile.

Check out my keyboard source code... It uses a BG for text.
There's a full ASCII font (0x00-0xFF) included.

Some chars may not look that great, especially the multilingual ones (0x7F-0xFF), but anyway, it's a font.

Keyboard Advance:
http://www.hh.se/stud/d99tibr/index5.html

#1188 - Splam - Wed Jan 15, 2003 5:04 pm

tepples wrote:
Splam wrote:
You'll need some kind of conversion array if you don't want the entire ascii font (which you probably don't)


Really? With 1024 different tiles available at 32 bytes of VRAM per 16-bit tile, I'd think dedicating 64 (0x20-0x5F) or 96 (0x20-0x7F) to text wouldn't be so hard.


Trust me, when you start running out of vram the last thing you want is loads of wasted ascii tiles ;)

#1203 - DekuTree64 - Wed Jan 15, 2003 6:21 pm

I use 1024 map tiles in char blocks 0-1, and load the font into block 2 and use a seprate layer set to char block 2 for text.
Since you can only access half the VRAM's worth of tiles anyway, I see no reason to use some on a font and waste the other half completely.
And if you need all 4 layers, you could even use Y-trigger to swap from your main char block to the font block mid-frame when you get to where your textbox is (actually I use that too in my battle system).