#172457 - mog123 - Mon Feb 08, 2010 12:27 am
Hey, I've tried 1d mapping - worked great but was a pain in the ass to edit. So now I'm trying to do 2d mapping. I've got a BMP file I converted in grit. 8bpp, 32x32 sprites, 256x448. When I try to display it with this code:
I only display a 8x32 (HxW) sprite. What am I doing wrong, or better yet - why is the thing I'm doing wrong, wrong.
Code: |
// (1) Places the tiles
// into LOW obj memory (cbb == 4) memcpy(&tile_mem[4][0], Player256Tiles, 32*32); memcpy(pal_obj_mem, Player256Pal, Player256PalLen); // (2) Initialize all sprites oam_init(obj_buffer, 128); REG_DISPCNT= DCNT_MODE0 | DCNT_BG0 | DCNT_OBJ | DCNT_OBJ_2D; int x= 104, y= 64; u32 tid= 0, pb= 0; // (3) tile id, pal-bank OBJ_ATTR *nin11= &obj_buffer[0]; obj_set_attr(nin11, ATTR0_SQUARE | ATTR0_8BPP , // square sprite 8bpp ATTR1_SIZE_32, // 32x32p ATTR2_PALBANK(pb) | tid); // palbank 0, tile 0 // (4) position sprite (redundant here; the _real_ position // is set further down obj_set_pos(nin11, x, y); oam_copy(oam_mem, obj_buffer, 1); |
I only display a 8x32 (HxW) sprite. What am I doing wrong, or better yet - why is the thing I'm doing wrong, wrong.