Code: Select all
int main(void)
{
SceCtrlData pad;
char charList[CHAR_LEN] = {'0','1','2','3','4','5','6','7','8','9','.','+','-','*','/','(',')'};
int curIndex = 0;
pspDebugScreenInit();
SetupCallbacks();
sceCtrlSetSamplingCycle(0);
sceCtrlSetSamplingMode(PSP_CTRL_MODE_DIGITAL);
while(1) {
pspDebugScreenSetXY(0,0);
printf("Hit UP or DOWN button to change the character:");
pspDebugScreenSetXY(10,10);
printf("Input: %c", charList[curIndex]);
sceCtrlReadBufferPositive(&pad,1);
if(pad.Buttons & PSP_CTRL_UP) {
curIndex = (curIndex + 1) % CHAR_LEN;
}
else
if(pad.Buttons & PSP_CTRL_DOWN) {
curIndex = (curIndex + CHAR_LEN -1) % CHAR_LEN;
}
}
return 0;
}