Advertisement
PauSix

PSP User Input main.c

Feb 13th, 2017
160
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.90 KB | None | 0 0
  1. // include psp stuff
  2. #include <pspkernel.h>
  3. #include <pspdebug.h>
  4. #include <pspdisplay.h>
  5. #include <pspctrl.h>
  6.  
  7. // include commons stuff
  8. #include "../common/callback.h"
  9. #include "../common/ui.h"
  10.  
  11.  
  12. // configure PSP stuff
  13. #define VERS    1
  14. #define REVS    0
  15.  
  16. PSP_MODULE_INFO("UserInput", PSP_MODULE_USER, VERS, REVS);
  17. PSP_MAIN_THREAD_ATTR(PSP_THREAD_ATTR_USER);
  18.  
  19. // make printing easier on us
  20. #define printf pspDebugScreenPrintf
  21.  
  22. int main(int argc, char** argv)
  23. {
  24.     // basic init
  25.     setupExitCallback();
  26.     pspDebugScreenInit();
  27.    
  28.     sceCtrlSetSamplingCycle(0);
  29.     sceCtrlSetSamplingMode(PSP_CTRL_MODE_ANALOG);
  30.    
  31.     int pad = 0;
  32.     while (isRunning()) {
  33.         pspDebugScreenSetXY(0, 0);
  34.         pollPad();
  35.         pad = getPad();
  36.         if(isKeyDown(pad, PSP_CTRL_CIRCLE))
  37.             printf("Circle is down!");
  38.         printf("%d,%d", getJX(), getJY());
  39.         sceDisplayWaitVblankStart();
  40.     }
  41.    
  42.     sceKernelExitGame();
  43.     return 0;
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement