now im trying to use the controller.c to control the location of the bmp on the screen..however..now that I added that code..when i run my program..i just get a black screen..and then my psp turns off.. it compiles perfectly tho..
Code: Select all
#include "pg.h"
#include "controller.c"
#include "bitmap.c"
int exit_callback(void)
{
sceKernelExitGame();
return 0;
}
#define POWER_CB_POWER 0x80000000
#define POWER_CB_HOLDON 0x40000000
#define POWER_CB_STANDBY 0x00080000
#define POWER_CB_RESCOMP 0x00040000
#define POWER_CB_RESUME 0x00020000
#define POWER_CB_SUSPEND 0x00010000
#define POWER_CB_EXT 0x00001000
#define POWER_CB_BATLOW 0x00000100
#define POWER_CB_BATTERY 0x00000080
#define POWER_CB_BATTPOWER 0x0000007F
void power_callback(int unknown, int pwrflags)
{
}
// Thread to create the callbacks and then begin polling
int CallbackThread(void *arg)
{
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback);
SetExitCallback(cbid);
cbid = sceKernelCreateCallback("Power Callback", power_callback);
PowerSetCallback(0, cbid);
KernelPollCallbacks();
}
/* 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);
sceKernelStartThread(thid, 0, 0);
return thid;
}
int pacDir=1;
unsigned long pacX=230;
unsigned long pacY=136;
int pacSpeed=5;
int isRunning=1;
const int maxX=452;
const int maxY=252;
const int minX=0;
const int minY=0;
void checkPress(void)
{
switch(Control()) {
case 5:
pacDir=2;
break;
case 6:
pacDir=4;
break;
case 7:
pacDir=1;
break;
case 8:
pacDir=3;
break;
}
}
void updatePac(void)
{
switch(pacDir)
{
case 1:
if(pacX-pacSpeed>minX)
{
pacX-=pacSpeed;
}
break;
case 2:
if(pacY-pacSpeed >minY)
{
pacY-=pacSpeed;
}
break;
case 3:
if(pacX+pacSpeed<maxX)
{
pacX+=pacSpeed;
}
break;
case 4:
if(pacY+pacSpeed<maxY)
{
pacY+=pacSpeed;
}
break;
}
}
int xmain(void)
{
pgInit();
SetupCallbacks();
pgScreenFrame(2,0);
sceCtrlInit(0);
sceCtrlSetAnalogMode(0);
while(isRunning == 1)
{
checkPress();
updatePac();
pgFillvram(0);
pgBitBlt(pacX,pacY,20,20,2,image_pacR);
pgScreenFlipV();
pgWaitVn(10);
}
return 0;
}
thats the code for my main program...
could someone take a look?
im not sure whats wrong..
oh and yes, i added all the stub stuff in my startup.s and im using the psp-gcc to compile....it compiles fine tho.
thanks for any help..