I'm using SGDK 1.21
Here's the code;
Code: Select all
// ...code...
SYS_disableInts();
VDP_resetScreen();
// reset palettes
//VDP_setTextPalette(0);
//VDP_setPaletteColors(0, palette_black, 64); // <------Enable Fade in
// Load images
VDP_drawImageEx(PLAN_A, &title_image, TILE_ATTR_FULL(PAL1, FALSE, FALSE, FALSE, ind), 7, 2, FALSE, TRUE);
ind += title_image.tileset->numTile;
//VDP_setTextPalette(0);
//VDP_setTextPlan(PLAN_A);
//VDP process done - re-enable interrupts
SYS_enableInts();
// Prepare palettes
memcpy(&palette[16], title_image.palette->data, 16 * 2);
VDP_setPalette(1, title_image.palette->data);
/*
// fade in
VDP_fadeIn(0, (4 * 16) - 1, palette, 32, FALSE); // <----Fade in ends
while(counter <= 300) //Fade in
{
//Wait for screen refresh
VDP_waitVSync();
counter++;
}
*/
VDP_drawText("Start", 17, 22);
VDP_drawText("Options", 17, 24);
//Initialize joypad
JOY_init();
JOY_setEventHandler( &handleInput );
while(1)
{
//Wait for screen refresh
handleSprite();
SPR_update();
VDP_waitVSync();
}
return 0;
What happened was that when running it with the fade in ,the title image faded in correctly but the text wasn't there.
I had another function draw in text to test something out which worked before but when I added the sprite it stopped working.
The sprite worked like it should. Maybe I just wasn't using the fade in correctly? I'm just starting out so I might have made a mistake.
So I commented out the fade in and used VDP_setPalette() for the image instead to get the right palette without using the fade in.
That made the text appear again and everything except the fade in (which I commented out) is now working fine.