Problem Tutorial SGDK "Multi Tile"
Posted: Mon Feb 24, 2014 7:24 am
Hi everyone I started programming in the megadrive and I'm stuck at the tutorial to the "Multi Tile".
Let me explain: I get to create the file moon.res , the files moon.h and moon.obj are created by SGDK. I can include moon.h in code block it work perfectly.
I have this code :
include <genesis.h>
#include "moon.h"
int main( )
{
// get the image width (in pixel) ==> should be 8pix aligned
u16 w = moon[0];
// get the image height (in pixel) ==> should be 8px aligned
u16 h = moon[1];
// get the palette at moon[2 to 17]
VDP_setPalette(PAL1, &moon[2]);
// load bitmap data at moon[18....] in VRAM
// w/8 = width in tiles we want to load
// h/8 = height in tile we want to load
// w/8 = width in tiles of the bitamp
// the 3rd arg is needed because you could load only a part of the bitmap if you want but SGDK needs the width as reference
VDP_loadBMPTileData((u32*) &moon[18], 1, w / 8, h / 8, w/8 );
while(1)
{
VDP_waitVSync();
}
return 0;
}
The red underlined words don't work. I have 3 time the same error : "subscripted value is neither array nor pointer"
I see on internet that I can replace "u16 w = moon[0];", "u16 h = moon[1];" by "u16 w = moon.w;" and "u16 h = moon.h;"
So now I have once again the same error here VDP_loadBMPTileData((u32*) &moon[18], 1, w / 8, h / 8, w/8 ); --> "subscripted value is neither array nor pointer"
and the third error mentioned above : VDP_setPalette(PAL1, &moon[2]); --> "subscripted value is neither array nor pointer"
If anyone can help me I thank
PS: Sorry if I have a bad english I help me with google traduction.
Let me explain: I get to create the file moon.res , the files moon.h and moon.obj are created by SGDK. I can include moon.h in code block it work perfectly.
I have this code :
include <genesis.h>
#include "moon.h"
int main( )
{
// get the image width (in pixel) ==> should be 8pix aligned
u16 w = moon[0];
// get the image height (in pixel) ==> should be 8px aligned
u16 h = moon[1];
// get the palette at moon[2 to 17]
VDP_setPalette(PAL1, &moon[2]);
// load bitmap data at moon[18....] in VRAM
// w/8 = width in tiles we want to load
// h/8 = height in tile we want to load
// w/8 = width in tiles of the bitamp
// the 3rd arg is needed because you could load only a part of the bitmap if you want but SGDK needs the width as reference
VDP_loadBMPTileData((u32*) &moon[18], 1, w / 8, h / 8, w/8 );
while(1)
{
VDP_waitVSync();
}
return 0;
}
The red underlined words don't work. I have 3 time the same error : "subscripted value is neither array nor pointer"
I see on internet that I can replace "u16 w = moon[0];", "u16 h = moon[1];" by "u16 w = moon.w;" and "u16 h = moon.h;"
So now I have once again the same error here VDP_loadBMPTileData((u32*) &moon[18], 1, w / 8, h / 8, w/8 ); --> "subscripted value is neither array nor pointer"
and the third error mentioned above : VDP_setPalette(PAL1, &moon[2]); --> "subscripted value is neither array nor pointer"
If anyone can help me I thank

PS: Sorry if I have a bad english I help me with google traduction.