掌機 - Game Boy - C/C++ - Input(Wait)



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

等待Input按下

UINT8 waitpad(UINT8 mask);

第一個參數是要等待的按鍵(支援組合鍵)
回傳值為按鍵

等待Input釋放

void waitpadup(void)

main.c

#include <stdio.h>
#include <gb/gb.h>

void main(void)
{
    while (1) {
        waitpad(J_START);
        printf("Start Pressed\n");
        waitpad(J_A);
        printf("A Pressed\n");
        waitpadup();
        printf("A Released\n");
    }
}

完成