Game Boy >> C/C++
Input
參考資訊:
1. bgb
2. doc
3. gbdk_playground
Input取得
UINT8 joypad(void);
回傳值為按鍵
main.c
#include <stdio.h> #include <gb/gb.h> void main(void) { while (1) { delay(100); switch (joypad()) { case J_LEFT: printf("Left\n"); break; case J_RIGHT: printf("Right\n"); break; case J_UP: printf("Up\n"); break; case J_DOWN: printf("Down\n"); break; case J_START: printf("Start\n"); break; case J_SELECT: printf("Select\n"); break; case J_A: printf("A\n"); break; case J_B: printf("B\n"); break; } } }
完成