void CheckKeys(void) { unsigned long pad=gp2x_joystick_read(0); if(pad & GP2X_VOL_DOWN) if(pad & GP2X_START) { supervision_done(); //shutsdown the system //gp2x_deinit(); exit(0); } if(pad & GP2X_L) if(pad & GP2X_R) //Checks if L and R are pushed supervision_reset(); //Reset emulator if(pad & GP2X_L) if(pad & GP2X_LEFT) //Checks if L and LEFT pushed supervision_set_colour_scheme(COLOUR_SCHEME_DEFAULT); //Changes the color scheme if(pad & GP2X_L) if(pad & GP2X_RIGHT) //Checks if L and RIGHT are pushed supervision_set_colour_scheme(COLOUR_SCHEME_AMBER); //Changes the color scheme if(pad & GP2X_L) if(pad & GP2X_UP) //Checks if L and UP pushed supervision_set_colour_scheme(COLOUR_SCHEME_GREEN); //Changes the color scheme if(pad & GP2X_L) if(pad & GP2X_DOWN) //Checks if L and DOWN pushed supervision_set_colour_scheme(COLOUR_SCHEME_BLUE); //Changes the color scheme if(pad & GP2X_Y) { paused=TRUE; textClear(); handleMainMenu(); // File menu paused=FALSE;} if (pad & (GP2X_VOL_UP|GP2X_VOL_DOWN)) { int vol = currentConfig.volume; if (pad & GP2X_VOL_UP) { if (vol < 255) vol++; } else { if (vol > 0) vol--; } gp2x_sound_volume(vol, vol); currentConfig.volume = vol; } }
/* * Method to print main menu * * Daniel Lennart */ int printMainMenu(){ int status; int line = 0; char buffer[2]; printf("Main Menu\n"); printf("1. Buy\n"); printf("2. Process orders\n"); printf("3. Exit\n"); status = getLine("Please enter the option\n", buffer, sizeof(buffer)); if (status == EMPTY){ printf ("\nEmpty input!\n"); } if (status == LONG) { printf ("Input is too long [%s]\n", buffer); } line = atoi(buffer); handleMainMenu(line); return line; }