#90774 - Dark Knight ez - Sun Jul 02, 2006 9:53 am
As far as I understand things, in mode 0 you can use maps which have references to 8x8 tiles. These tiles should be stored in VRAM, right? Would it be okay to put them in a VRAM assigned for sprites?
Looking at the code of the example called "Complex_2D", I note a different use of maps than I expected to see.
In here it seems that the colour (read: palette entry) of an entire tile is assigned to a map entry. Noting that the for-loops do both go up to 32, I can tell that it is using 8x8 tiles.
So my question regarding this would be how I can give a location to a 8x8 tile stored in VRAM to a map instead of a direct palette entry (which would be used for the entire tile, it seems).
Please correct me on any wrong assumptions I made here.l
Thanks in advance.
edit:
Also, how would I go about flipping a tile horizontally or vertically using maps? (Or is that not possible?)
2nd edit:
I've found TONC's explanation on the subject. It clears up some stuff like how flipping the tiles is done.
I don't quite understand where to put the maps and the actual graphics (read: tiles) though. TONC mentions that they overlap in memory so caution is needed.
I'd like to use 3, or if possible all 4 backgrounds of mode 0 for displaying tiles. What place(s) would be best to put the graphics (the tiles) and the maps?
Looking at the code of the example called "Complex_2D", I note a different use of maps than I expected to see.
Code: |
BG_PALETTE_SUB[0] = RGB15(10,10,10);
BG_PALETTE_SUB[1] = RGB15(0,16,0); BG_PALETTE_SUB[2] = RGB15(0,0,31); //load the maps with alternating tiles (0,1 for bg0 and 0,2 for bg1) for(iy = 0; iy < 32; iy++) for(ix = 0; ix <32; ix++) { map0[iy * 32 + ix] = (ix ^ iy) & 1; map1[iy * 32 + ix] = ((ix ^ iy) & 1)<<1; } |
In here it seems that the colour (read: palette entry) of an entire tile is assigned to a map entry. Noting that the for-loops do both go up to 32, I can tell that it is using 8x8 tiles.
So my question regarding this would be how I can give a location to a 8x8 tile stored in VRAM to a map instead of a direct palette entry (which would be used for the entire tile, it seems).
Please correct me on any wrong assumptions I made here.l
Thanks in advance.
edit:
Also, how would I go about flipping a tile horizontally or vertically using maps? (Or is that not possible?)
2nd edit:
I've found TONC's explanation on the subject. It clears up some stuff like how flipping the tiles is done.
I don't quite understand where to put the maps and the actual graphics (read: tiles) though. TONC mentions that they overlap in memory so caution is needed.
I'd like to use 3, or if possible all 4 backgrounds of mode 0 for displaying tiles. What place(s) would be best to put the graphics (the tiles) and the maps?