#include #include // Allows us to read input from the PSP's keys #include #include #include #include #include // // Has some C functions (sprintf() to parse strings) #include #define RGB(r, g, b) ((r)|((g)<<8)|((b)<<16)) #define printf pspDebugScreenPrintf #define MAX(X, Y) ((X) > (Y) ? (X) : (Y)) // Returns X if greater than Y, or returns Y if less PSP_MODULE_INFO("Image Displayer", 0, 1, 1); /* 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; } struct object { int x; int y; int obj_state; // 0 = ground, 1 = jumping, 2 = falling }; int main() { SceCtrlData pad; struct object box; box.x = 50; box.y = 230; while(1) { if(pad.Buttons & PSP_CTRL_LEFT) {box.x-=4; sceCtrlPeekBufferPositive(&pad, 1);} else if(pad.Buttons & PSP_CTRL_RIGHT) {box.x+=4; sceCtrlPeekBufferPositive(&pad, 1);} //char buffer[200]; // Block of memory of 200 variables for a string (maximum length it can be) Image* ourImage; SetupCallbacks(); pspDebugScreenInit(); initGraphics(); //sprintf(buffer, "ourImage.png"); ourImage = loadImage("ourImage.png"); if(ourImage) { sceDisplayWaitVblankStart(); fillScreenRect(RGB(70, 130, 150), 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); blitAlphaImageToScreen(0 ,0 ,32 , 32, ourImage, box.x, box.y); printTextScreen(70,70,"Hello",255); flipScreen(); // Just updates the screen } } sceKernelSleepThread(); // Wait for home return 0; }