掌機 - Game Boy - C/C++ - Input



參考資訊:
https://bgb.bircd.org/
https://github.com/mrombout/gbdk_playground
http://gbdk.sourceforge.net/doc/html/book01.html

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;
        }
    }
}

完成