1. make sure that the files are png
2. try this, in your while loop add
blitAlphaImageToScreen(0,0,480,272,player,(480/2),(272/2));
sceDisplayWaitVblankStart();
flipScreen();
and delete it in the other place it is
hey im learning c opposed to lua as a starting language in psp development, and i don't know why this doesn't work:
the screen just stays black, and yes i have the images in the images folder#include <pspkernel.h>
#include <pspctrl.h>
#include <pspdisplay.h>
#include <pspgu.h>
#include <png.h>
#include <pspdebug.h>
#include <stdio.h>
#include "graphics.h"
#define text pspDebugScreenPrintf
PSP_MODULE_INFO("test images", 0, 1, 1);
int exit_callback(int arg1, int arg2, void *common) {
sceKernelExitGame();
return 0;
}
int CallbackThread(SceSize args, void *argp) {
int cbid;
cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
sceKernelRegisterExitCallback(cbid);
sceKernelSleepThreadCB();
return 0;
}
int SetupCallbacks(void) {
int uth = 0;
uth = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
if(uth >= 0) {
sceKernelStartThread(uth, 0, 0);
}
return uth;
}
int main()
{
char buff[100];
Image* player;
Image* enemy;
Image* ball;
Image* bg1;
Image* bg2;
sprintf(buff,"images/player.png");
player = loadImage(buff);
if(!player)
{
text("Loading failed! (Check images are in the 'image' folder!)");
}
else
{
sceDisplayWaitVblankStart();
blitAlphaImageToScreen(0,0,480,272,player,(480/2),(272/2));
}
pspDebugScreenInit();
SetupCallbacks();
SceCtrlData pad;
while(1)
{
sceCtrlReadBufferPositive(&pad, 1);
}
flipScreen();
sceKernelSleepThread();
return 0;
}
Last edited by Prasoc; January 12th, 2008 at 15:59. Reason: code tag screwed up
1. make sure that the files are png
2. try this, in your while loop add
blitAlphaImageToScreen(0,0,480,272,player,(480/2),(272/2));
sceDisplayWaitVblankStart();
flipScreen();
and delete it in the other place it is
You get stuck in an infinite loop just reading the pad input. A standard game loop is:Code:while(1) { sceCtrlReadBufferPositive(&pad, 1); }
Start loop
Read pad input
Process game logic
Clear screen
Render screen
Wait for Vertical Sync
Flip buffers
End loop
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks