#64800 - ninogenio - Mon Dec 26, 2005 10:26 pm
heres some code ive been messing with now ive almost got it working but the tiles get ever so slightly scrambled i know its something pretty silly but i just cant see it if anyone could point out what wrong with the code then majore thanks.
the pic im using is just the 256 drunken loggo pic that comes with ndslib.
also is it possible to map 16bit tiles?
the pic im using is just the 256 drunken loggo pic that comes with ndslib.
also is it possible to map 16bit tiles?
Code: |
#include <nds.h> #include "drunkenlogo_bin.h" #include "palette_bin.h" void drawMap(u16*); int main(int argc, char** argv) { const int char_base = 0; const int screen_base = 20; POWER_CR = POWER_ALL_2D; vramSetBankA(VRAM_A_MAIN_BG); vramSetBankC(VRAM_C_SUB_BG); DISPLAY_CR = MODE_0_2D | DISPLAY_BG0_ACTIVE; BG0_CR = TEXTBG_SIZE_256x256 | BG_COLOR_256 | BG_TILE_BASE(char_base) | BG_MAP_BASE(screen_base); u16* tile = (u16*)CHAR_BASE_BLOCK(char_base); u16* map = (u16*)SCREEN_BASE_BLOCK(screen_base); for (int y=0; y<256*256 ; y++) { tile[y] = ((u16*)drunkenlogo_bin)[y]; } for(int i = 0; i < 256; ++i) { BG_PALETTE[i] = ((u16*)palette_bin)[i]; } drawMap(map); while(1) { swiWaitForVBlank(); } return 0; } void drawMap(u16* map) { for(int i = 0; i < 31*23;++i) { map[i] = (u16)i; } } |