#5262 - maciel310 - Thu Apr 24, 2003 1:15 am
Hi, I have a little problem making an intro for a game I am in the process of making. I have a some pictures that I made and I have it so when they press the A button it switches between them, but when I tested it, it would keep on going back to the first screen after changing the first time, so it would loop the same image instead of going on. How can I fix this? Ill post the code so you can see what I am doing wrong
Thanx for any help
Quote: |
#include "headers.h" u16* theVideoBuffer = (u16*)VideoBuffer; u16* theScreenPalette = (u16*)BGPaletteMem; #define RGB(r,g,b) (r+(g<<5)+(b<<10)) //Macro to build a color from its parts int main() { SetMode(MODE_4|BG2_ENABLE); if(!(*KEYS & KEY_A)) //A { //Copy the palette u16 i; for ( i = 0; i < 256; i++ ) theScreenPalette[ i ] = APalette[ i ]; //Cast a 16 bit pointer to our data so we can read/write 16 bits at a time easily u16* tempData = (u16*)A; //Write the data //Note we're using 120 instead of 240 because we're writing 16 bits //(2 colors) at a time u16 x, y; for ( x = 0; x < 120; x++ ) for ( y = 0; y < 160; y++ ) theVideoBuffer[ y * 120 + x ] = tempData[ y * 120 + x ]; if(!(*KEYS & KEY_A)) //B { //Copy the palette u16 i; for ( i = 0; i < 256; i++ ) theScreenPalette[ i ] = BPalette[ i ]; //Cast a 16 bit pointer to our data so we can read/write 16 bits at a time easily u16* tempData = (u16*)B; //Write the data //Note we're using 120 instead of 240 because we're writing 16 bits //(2 colors) at a time u16 x, y; for ( x = 0; x < 120; x++ ) for ( y = 0; y < 160; y++ ) theVideoBuffer[ y * 120 + x ] = tempData[ y * 120 + x ]; if(!(*KEYS & KEY_A)) //C { //Copy the palette u16 i; for ( i = 0; i < 256; i++ ) theScreenPalette[ i ] = CPalette[ i ]; //Cast a 16 bit pointer to our data so we can read/write 16 bits at a time easily u16* tempData = (u16*)C; //Write the data //Note we're using 120 instead of 240 because we're writing 16 bits //(2 colors) at a time u16 x, y; for ( x = 0; x < 120; x++ ) for ( y = 0; y < 160; y++ ) theVideoBuffer[ y * 120 + x ] = tempData[ y * 120 + x ]; } } } return 0; } |
Thanx for any help