#100093 - cppdungeon - Sat Aug 26, 2006 2:22 am
the program is supposed to let the user choose from 3 options, but when you press "down" it skips from 1-3. is there a way to fix this? (im using HAM)
[/code]
_________________
"in Soviet Russia, car pimps you!"
Code: |
#include <mygba.h>
#include <iostream> #define A 1 #define B 2 #define SELECT 4 #define START 5 #define RIGHT 16 #define LEFT 32 #define UP 64 #define DOWN 128 #define R 256 #define L 512 volatile unsigned int *buttons = (volatile unsigned int *)0x04000130; MULTIBOOT int main(void) { ham_Init(); ham_InitText(0); bool button [10]; int sp; sp=0; //bg select block while(TRUE) { //////////////////////////////// button[0] = !((*buttons)& A); button[1] = !((*buttons)& B); button[2] = !((*buttons)& SELECT); button[3] = !((*buttons)& START); button[4] = !((*buttons)& RIGHT); button[5] = !((*buttons)& LEFT); button[6] = !((*buttons)& UP); button[7] = !((*buttons)& DOWN); button[8] = !((*buttons)& R); button[9] = !((*buttons)& L); //////////////////////////////// ham_DrawText(0,0, "Choose Mode"); if(button[7] && sp!=-2){ sp--; } if(button[6] && sp!=0){ sp++; } if(sp==0){ ham_DrawText(0, 1, "choice one "); } if(sp==-1){ ham_DrawText(0,1, "choice two "); } if(sp==-2){ ham_DrawText(0,1, "choice three"); } } return 0; } /* END OF FILE */ |
_________________
"in Soviet Russia, car pimps you!"