Game Boy Color >> C/C++
Input(Wait)
參考資訊:
1. bgb
2. doc
3. gbdk_playground
等待Input按下
UINT8 waitpad(UINT8 mask);
第一個參數是要等待的按鍵(支援組合鍵)
回傳值為按鍵
等待Input釋放
void waitpadup(void)
main.c
#include <stdio.h> #include <gb/gb.h> #include <gb/cgb.h> unsigned short palette[] = {RGB_WHITE, RGB_RED, RGB_GREEN, RGB_BLUE}; void main(void) { set_bkg_palette(0, 1, palette); while (1) { waitpad(J_START); printf("Start Pressed\n"); waitpad(J_A); printf("A Pressed\n"); waitpadup(); printf("A Released\n"); } }
完成