Advertisement
PauSix

PSP User Input main.c

Feb 17th, 2017
351
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.02 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.     while (isRunning()) {
  32.         sceDisplayWaitVblankStart();
  33.         pspDebugScreenClear();
  34.         pspDebugScreenSetXY(0, 0);
  35.         pollPad();
  36.         pollLatch();
  37.         if(isKeyDown(PSP_CTRL_CROSS))
  38.             printf("Cross is down!\n");
  39.         if(isKeyUp(PSP_CTRL_CROSS))
  40.             printf("Cross is up!\n");
  41.         if(isKeyHold(PSP_CTRL_CIRCLE))
  42.             printf("Circle is down!\n");
  43.         printf("%d,%d", getJX(), getJY());
  44.     }
  45.    
  46.     sceKernelExitGame();
  47.     return 0;
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement