キーパッド入力サンプルの直し。


昨年にアップしたものはあまりにお粗末だったので書き直した。
まあ大したコードじゃないけど。


keypad input sample


ttp://page.freett.com/ntr/example/keypad.zip


main.c

/*---------------------------------------------------------------------------------
	
	key input sample
	
	version 0.02
	Mar 15, 2010
	
	By. REGEKATSU
	
---------------------------------------------------------------------------------*/
#include <nds.h>
#include <stdio.h>


//---------------------------------------------------------------------------------
int main(void) {
//---------------------------------------------------------------------------------
	
	consoleDemoInit();
	
	while(1) {
		
		swiWaitForVBlank();
		
		scanKeys();
		
		if(keysDown() & KEY_A){
			printf("A button Down\n");
		}else if(keysHeld() & KEY_A){
			printf("A button Held\n");
		}else if(keysUp() & KEY_A){
			printf("A button Up\n");
		}
		
	}
	
}

//---------------------------------------------------------------------------------