Code: Select all
#include <pspkernel.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <stdio.h>
#include "graphics.h"
#include "callback.h"
PSP_MODULE_INFO("Homework", 0, 1, 1);
#define RGB(r, g, b) ((r)|((g)<<16)|((b)<<16))
int main() {
SetupCallbacks();
initGraphics();
SceCtrlData pad;
int goodScore;
int badScore;
Color white = RGB(255,255,255);
Color green = RGB(0,255,0);
char PrintScoreG[200];
for(;;) {
goodScore = 0;
badScore = 0;
printTextScreen(20, 5, "Can you add ?", white);
printTextScreen(20, 15, "Coded By F34R", white);
printTextScreen(10, 40, "1 + 1 =", white);
printTextScreen(10, 60, "CROSS: 0", white);
printTextScreen(10, 70, "SQUARE: 3", white);
printTextScreen(10, 80, "TRIANGLE: 21", white);
printTextScreen(10, 90, "CIRCLE: 2", white);
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) {
printTextScreen(10,120, "CORRECT", green);
goodScore++;
printTextScreen(10, 150, "This program will exit now.", white);
break;
}
if(pad.Buttons & PSP_CTRL_SQUARE) {
printTextScreen(10,120, "INCORRECT", green);
goodScore--;
}
if(pad.Buttons & PSP_CTRL_TRIANGLE) {
printTextScreen(10,120, "INCORRECT", green);
goodScore--;
}
if(pad.Buttons & PSP_CTRL_CIRCLE) {
printTextScreen(10,120, "INCORRECT", green);
goodScore--;
}
sprintf(PrintScoreG, " Correct : %i", goodScore);
printTextScreen(10, 200, PrintScoreG, green);
flipScreen();
}
sceKernelExitGame();
return 0;
}