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.

DS development > [Solved]Tiles, Extended Palettes and setting color per Tile

#167090 - a128 - Sat Feb 28, 2009 3:54 pm

Just setup a font using tiles and the palette using the DISPLAY_BG_EXT_PALETTE feature. it woorks fine.

But I have no idea who to use different colors for the tiles , so I have different font colors per line

I looked thru libnds console.c code but did not get it.

are Bits 12..15 (color<<12) in a tile the color number ?!


Last edited by a128 on Mon Mar 02, 2009 6:16 pm; edited 1 time in total

#167122 - sverx - Mon Mar 02, 2009 12:40 pm

In text modes you've got maps with 16 bits 'indexes'. Actually last 10 bits is the tile number (0-1023) and first 4 bits is the palette number to be used for the tile. So
Code:
finalindex=(palette<<12)|index;

(the two other bits are vertical and horizontal flip of the tile...)

#167127 - a128 - Mon Mar 02, 2009 6:18 pm

I solved it..yes bits 12..15 are the palette number.

A good tutorial about this is

http://www.liranuna.com/nds-2d-tuts/lesson-3/

I also had problems using grit....now I switched to gfx2gba