#35127 - interdpth - Sun Jan 30, 2005 11:52 pm
I made a little map in PE map editor that comes with VHAM note i'm just using the map editor. Any way I exported my map to an array then included it with my source when I attempt to draw it on screen I get only one tile. That's in the upperleft corner. Yes I did Put the BG# it's on up and the graphics and it's pal is in VRAM. The array for the map is
const u8 Map1_MapData[22 * 22]; Now here is the code I came up with
void DrawMap(void)
{
int i;
u16* BG2 = (u16*)0x6001000;
for( i = 0; i < 22; i++)
{
BG2[Map1_MapData[ i * i ]];
}
}
///
So can someone help? Thanks.
#35151 - Cearn - Mon Jan 31, 2005 9:58 am
interdpth wrote: |
... const u8 Map1_MapData[22 * 22]; Now here is the code I came up with
Code: | void DrawMap(void)
{
int i;
u16* BG2 = (u16*)0x6001000;
for( i = 0; i < 22; i++)
{
BG2[Map1_MapData[ i * i ]];
}
} |
|
? Forgive me for asking, but what is this supposed to do? Inside the loop you're just asking for a variable in VRAM, but you're never actually filling it with anything. The tile in the top-left corner are probably the sprites all huddled up. Remember, the default position of sprites is top-left, using the first tile in OBJ-VRAM for its data.
This might give better results:
Code: |
for ix, iy;
u16 *dst= (u16*)0x06001000;
for(iy=0; iy<22; iy++)
for(ix=0; ix<22; ix++)
dst[iy*32+ix]= Map1_MapData[iy*22+ix];
|
The double loop is required because 22x22 isn't a proper mapsize for the GBA. There's a possible mismatch between your map data (8bit) and the screenblock (16bit). If your map really has 1 byte / screen-entry then everthing's fine, but it could be that the data itself is 16bits, but just exported as bytes. Something worth looking in to. Do not change the destination pointer to u8 because VRAM can't be written to in bytes. If anything, cast the map data.
#35180 - interdpth - Tue Feb 01, 2005 12:21 am
The loop was inefficent so I just DMA copied the data over And found out I need a better map editor.
#35208 - Kyoufu Kawa - Tue Feb 01, 2005 2:24 pm
interdpth wrote: |
The loop was inefficent so I just DMA copied the data over And found out I need a better map editor. |
That's funny Matt. Didn't you tell me you were gonna write your own?
#35262 - interdpth - Wed Feb 02, 2005 7:43 am
Yeah well we both know I suck at graphics. So anyone know any good Map editors I can use these tiles are all over.