Page 1 of 1

Problem Tutorial SGDK "Multi Tile"

Posted: Mon Feb 24, 2014 7:24 am
by Tatchou
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.

Posted: Mon Feb 24, 2014 9:00 am
by Stef
Hi Tatchou,

It looks like you are using the outdated tutorial !
Where did you find it ?

As you can see the current one :
http://code.google.com/p/sgdk/wiki/Tiles

has some differences ;)

Posted: Mon Feb 24, 2014 1:11 pm
by Tatchou
Hum I don't understand, now when I'm return to the tutorial link , I haven't the same code example...
It's strange but now it works correctly so...

Anyway thank you ^^

Posted: Mon Feb 24, 2014 1:42 pm
by Stef
I guess it has something to do with your browser cache as i updated it when releasing the last SGDK version.

Posted: Mon Feb 24, 2014 5:51 pm
by Tatchou
I found that it was weird then I checked and indeed at this link the tutorial does not seem Updated: http://code.google.com/p/sgdk/wiki/SGDKTutorial

Posted: Mon Feb 24, 2014 6:11 pm
by Tatchou
Now with you new tuto I have a problem :

#include <genesis.h>
#include "moon.h"

int main( )
{
u16 w = moon.w;
// get the image height (in pixel) ==> should be 8px aligned
u16 h = moon.h;

// get the palette data of moon
VDP_setPalette(PAL1, moon.palette->data);


// load bitmap data of moon 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(moon.image, 1, w / 8, h / 8, w/8 );
// draw the moon at (12,12)
VDP_fillTileMapRectInc(BPLAN, TILE_ATTR_FULL(PAL1, 0, 0, 0, 1), 12, 12, w / 8, h / 8);


while(1)
{
VDP_updateSprites();
VDP_waitVSync();
}
return 0;
}

At the red line I have this warning : "passing arg 1 of 'VDP_loadBMPTileData' from incompatible pointer type"
And when I launch my rom I finally have a moon on the screen, but underneath there is a parasite line displayed...

Posted: Fri Feb 28, 2014 10:55 am
by Tatchou
Nobody had the same problem as me ?

I'm following the tutorial to the letter but my image is displayed with a parasite with line below.

When in doubt I tried with several bmp pictures but I still have the same problem.

Posted: Fri Feb 28, 2014 12:37 pm
by Stef
Oh i though i had replied to this message.
The warning is "normal", you should not care about it. For the parasite i think i also have it in my sample so you should not care too much about it.
I will try to fix the tutorial later ;)

Posted: Sat Mar 01, 2014 11:29 am
by Tatchou
Ha thin.
Oh well I'll try to do it with.
Thank you anyway ^ ^