「API/ctrl/簡単な使い方」の編集履歴(バックアップ)一覧に戻る

API/ctrl/簡単な使い方 - (2008/12/12 (金) 00:24:51) の編集履歴(バックアップ)



#define printf pspDebugScreenPrintf
int main(void)
{
SceCtrlData pad;

pspDebugScreenInit();
SetupCallbacks();

sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);

while(!done){
pspDebugScreenSetXY(0, 2);

sceCtrlReadBufferPositive(&pad, 1);

printf("Analog X = %d ", pad.Lx);
printf("Analog Y = %d \n", pad.Ly);

if (pad.Buttons != 0){
if (pad.Buttons & PSP_CTRL_SQUARE){
printf("Square pressed \n");
}
if (pad.Buttons & PSP_CTRL_TRIANGLE){
printf("Triangle pressed \n");
}
if (pad.Buttons & PSP_CTRL_CIRCLE){
printf("Cicle pressed \n");
}
if (pad.Buttons & PSP_CTRL_CROSS){
printf("Cross pressed \n");
}

if (pad.Buttons & PSP_CTRL_UP){
printf("Up pressed \n");
}
if (pad.Buttons & PSP_CTRL_DOWN){
printf("Down pressed \n");
}
if (pad.Buttons & PSP_CTRL_LEFT){
printf("Left pressed \n");
}
if (pad.Buttons & PSP_CTRL_RIGHT){
printf("Right pressed \n");
}

if (pad.Buttons & PSP_CTRL_START){
printf("Start pressed \n");
}
if (pad.Buttons & PSP_CTRL_SELECT){
printf("Select pressed \n");
}
if (pad.Buttons & PSP_CTRL_LTRIGGER){
printf("L-trigger pressed \n");
}
if (pad.Buttons & PSP_CTRL_RTRIGGER){
printf("R-trigger pressed \n");
}
}
}

sceKernelExitGame();
return 0;