rendered paste body#include <pspdisplay.h>
#include <stdlib.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include <time.h>
#include <psppower.h>
#include <pspaudio.h>
#include <pspaudiolib.h>
#include "graphics.h"
// #include "mp3player.h"
// #define debug
#define true 1
#define false 0
PSP_MODULE_INFO("DotsC v0.0.3 Alpha", 0, 0, 3);
/* Exit callback */
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
/* Callback thread */
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
/* Sets up the callback thread and returns its thread id */
int SetupCallbacks(void) {
int thid = 0;
thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(thid >= 0) {
sceKernelStartThread(thid, 0, 0);
}
return thid;
}
char *path[13] = { "Player.png", //0
"Background.png", //1
"Spot.png", //2
"zero.png", //3
"one.png", //4
"two.png", //5
"three.png", //6
"four.png", //7
"five.png", //8
"six.png", //9
"seven.png", //10
"eight.png", //11
"nine.png"}; //12
int main()
{
srand(time(NULL));
pspDebugScreenInit();
initGraphics();
int spotx = rand()%(465);
int spoty = rand()%(257);
int x=0;
int y=0;
int Scoreo=0;
int Scoret=0;
int Scoreh=0;
int Scoreth=0;
SceCtrlData pad;
Image* images[14];
int i;
for(i = 0; i > 13; i++)
{
images[i] = loadImage(path[i]);
}
while (1)
{
sceCtrlReadBufferPositive(&pad, 1);
blitAlphaImageToScreen(0 ,0 ,32 , 32, images[0], x, y);
blitAlphaImageToScreen(0 ,0 ,480 , 272, images[1], 0, 0);
blitAlphaImageToScreen(0 ,0 ,16 , 16, images[2], spotx, spoty);
blitAlphaImageToScreen(0, 0, 15 ,15, images[Scoreo + 3], 50, 1);
blitAlphaImageToScreen(0, 0, 15 ,15, images[Scoret + 3], 35, 1);
blitAlphaImageToScreen(0 ,0 ,15 ,15, images[Scoreh + 3], 20, 1);
blitAlphaImageToScreen(0 ,0 ,15 ,15, images[Scoreth + 3], 5, 1);
if (x + 32 > spotx && x < spotx + 16 && y + 32 > spoty && y < spoty + 16)
{
Scoreo = Scoreo + 2;
spotx = rand()%(465);
spoty = rand()%(257);
}
if (Scoreo == 10)
{
Scoreo = 0;
Scoret++;
}
if (Scoret == 10)
{
Scoret = 0;
Scoreh++;
}
if (Scoreh == 10)
{
Scoreh = 0;
Scoreth++;
}
if (x < 0)
{
x = 0;
}
if (y < 0)
{
y = 0;
}
if (x > 448)
{
x = 448;
}
if (y > 240)
{
y = 240;
}
if(pad.Buttons & PSP_CTRL_RIGHT)
{
x += 5;
}
else if(pad.Buttons & PSP_CTRL_LEFT)
{
x -= 5;
}
else if(pad.Buttons & PSP_CTRL_UP)
{
y -= 5;
}
else if(pad.Buttons & PSP_CTRL_DOWN)
{
y += 5;
}
else if(pad.Buttons & PSP_CTRL_START)
{
sceKernelExitGame();
}
flipScreen();
}
sceKernelSleepThread();
return 0;
}