anyway, here's my code, any possible suggestions anyone?
P.S. the "pauze" function is just something that calls sceDisplayWaitVblankStart(); for a certain amount of time so the HOME button can be pushed
Code: Select all
#include <stdlib.h>
#include <psppower.h>
#include <pspdisplay.h>
#include <pspctrl.h>
#include <pspkernel.h>
#include <pspdebug.h>
#include <pspgu.h>
#include <png.h>
#include <stdio.h>
#include "graphics.h"
#include "functies.h"
PSP_MODULE_INFO("test", 0, 1, 1);
#define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16))
#define MAX(X, Y) ((X) > (Y) ? (X) : (Y))
#define RIJEN 6
#define CIRKELS 4
/* 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;
}
void pauze(int lengte)
{
int i = 0;
for(i=0; i<lengte; i++) {
sceDisplayWaitVblankStart();
}
}
int main(void) {
SetupCallbacks();
initGraphics();
int venster = 0;
SceCtrlData pad; //input
while(1)
{
//begin main loop
if(venster == 0)
{
//kies spelmodus
char buffer[200];
Image* ourImage;
sprintf(buffer, "test.png");
ourImage = loadImage(buffer);
int xafb = 0;
int yafb = 0;
while (xafb < 480)
{
while (yafb < 272)
{
blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, xafb, yafb);
yafb += 32;
}
xafb += 32;
yafb = 0;
}
flipScreen();
venster = 1;
while(1)
{
// aantal spelers loop
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_DOWN) {
if(venster == 1) {
venster++;
}
pauze(10);
} else
if(pad.Buttons & PSP_CTRL_UP) {
if(venster == 2) {
venster--;
}
pauze(10);
} else
if(pad.Buttons & PSP_CTRL_CROSS) {
pauze(10);
break;
}
fillScreenRect(RGB(0,50,50),100,50,280,86);
printTextScreen(130,60,"1 Player",RGB(255,255,255));
printTextScreen(130,80,"2 Players",RGB(255,255,255));
if (venster == 1) {
printTextScreen(115,60,"->",RGB(255,255,255));
} else {
printTextScreen(115,80,"->",RGB(255,255,255));
}
flipScreen();
pauze(1);
//einde aantal spelers loop
}
//einde kies spelmodus
}
if(venster == 1)
{
while(1)
{
pauze(10);
}
}
if(venster == 2)
{
while(1)
{
pauze(10);
}
}
//einde main loop
}
return 0;
}