gbdk_playground/input_state/input_state.c
2020-07-11 08:41:14 -05:00

40 lines
695 B
C

#include <stdio.h>
#include <gb/gb.h>
void printAndWait(char* text) {
printf(text);
delay(100);
}
void main() {
while(1) {
switch(joypad()) {
case J_LEFT:
printAndWait("Left!\n");
break;
case J_RIGHT:
printAndWait("Right!\n");
break;
case J_UP:
printAndWait("Up!\n");
break;
case J_DOWN:
printAndWait("Down!\n");
break;
case J_START:
printAndWait("Start!\n");
break;
case J_SELECT:
printAndWait("Select!\n");
break;
case J_A:
printAndWait("A!\n");
break;
case J_B:
printAndWait("B!\n");
break;
}
}
}