Advertisement
AnthonyCagliano

Untitled

Nov 5th, 2022
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. void io_keydetect(void){
  2. key = getKey();
  3. if (key){
  4. uint8_t sel = gamestate.screendata[gamestate.screen_up].selected,
  5. num_opts = gamestate.screendata[gamestate.screen_up].num_opts;
  6. switch(gamestate.screen_up){
  7. case SCRN_SPLASH:
  8. if ((key == sk_Enter) || (key == sk_2nd)) {
  9. if (sel == 0) gamestate.screen_up = SCRN_SERVERLIST;
  10. else if (sel == 1) gamestate.screen_up = SCRN_SETTINGS;
  11. else exit(EXIT_OK);
  12. }
  13. break;
  14. case SCRN_SERVERLIST:
  15. {
  16. break;
  17. }
  18. case SCRN_SETTINGS:
  19. {
  20. break;
  21. }
  22. default:
  23. if (key == sk_Down) {
  24. sel++;
  25. sel %= num_opts;
  26. } else if (key == sk_Up) {
  27. sel += (num_opts-1);
  28. sel %= num_opts;
  29. } else
  30. else if (key == sk_Clear) exit(EXIT_OK);
  31. }
  32. gamestate.screendata[gamestate.screen_up].selected = sel;
  33. gamestate.gameflags |= (1<<FRAME_DIRTY);
  34. }
  35. }
  36.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement