Advertisement
JiiCeii

[glib2D/PSP] Code de base

May 7th, 2011
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.82 KB | None | 0 0
  1. #include <pspkernel.h>
  2. #include "glib2d.h"
  3.  
  4. PSP_MODULE_INFO("Tuto", 0, 1, 1);
  5. PSP_MAIN_THREAD_ATTR(THREAD_ATTR_USER | THREAD_ATTR_VFPU);
  6.  
  7. /* Callbacks */
  8. int exit_callback(int arg1, int arg2, void *common) {
  9.   sceKernelExitGame();
  10.   return 0; }
  11. int CallbackThread(SceSize args, void *argp) {
  12.   int cbid;
  13.   cbid = sceKernelCreateCallback("Exit Callback", exit_callback, NULL);
  14.   sceKernelRegisterExitCallback(cbid);
  15.   sceKernelSleepThreadCB();
  16.   return 0; }
  17. int SetupCallbacks() {
  18.   int thid = 0;
  19.   thid = sceKernelCreateThread("update_thread", CallbackThread, 0x11, 0xFA0, 0, 0);
  20.   if(thid >= 0) sceKernelStartThread(thid, 0, 0);
  21.   return thid; }
  22.  
  23. int main(int argc, char *argv[]){
  24.   SetupCallbacks();
  25.  
  26.   while (1){
  27.     g2dClear(WHITE);
  28.  
  29.     g2dFlip(G2D_VSYNC);
  30.   }
  31.    
  32.   sceKernelExitGame();
  33.   return 0;
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement