PageRenderTime 29ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/src/Core/objects/keysym.xs

http://github.com/PerlGameDev/SDL
Unknown | 98 lines | 80 code | 18 blank | 0 comment | 0 complexity | 68cb621fc19ce1956ab9a1e43cc718da MD5 | raw file
Possible License(s): AGPL-1.0, GPL-2.0
  1. #include "EXTERN.h"
  2. #include "perl.h"
  3. #include "XSUB.h"
  4. #include "ppport.h"
  5. #ifndef aTHX_
  6. #define aTHX_
  7. #endif
  8. #include <SDL.h>
  9. MODULE = SDL::keysym PACKAGE = SDL::keysym PREFIX = keysym_
  10. =for documentation
  11. SDL_keysym -- keysym structure
  12. typedef struct{
  13. Uint8 scancode;
  14. SDLKey sym;
  15. SDLMod mod;
  16. Uint16 unicode;
  17. } SDL_keysym;
  18. =cut
  19. SDL_keysym *
  20. keysym_new ( CLASS )
  21. char* CLASS
  22. CODE:
  23. RETVAL = safemalloc(sizeof(SDL_keysym));
  24. OUTPUT:
  25. RETVAL
  26. Uint8
  27. keysym_scancode ( keysym, ... )
  28. SDL_keysym *keysym
  29. CODE:
  30. if( items > 1 )
  31. {
  32. keysym->scancode = SvIV( ST(1) );
  33. }
  34. RETVAL = keysym->scancode;
  35. OUTPUT:
  36. RETVAL
  37. SDLKey *
  38. keysym_sym ( keysym, ... )
  39. SDL_keysym *keysym
  40. PREINIT:
  41. char* CLASS = "SDL::Key";
  42. CODE:
  43. if( items > 1 )
  44. {
  45. SDLKey *kp = (SDLKey * )SvPV( ST(1), PL_na) ;
  46. keysym->sym = *kp;
  47. }
  48. RETVAL = &(keysym->sym);
  49. OUTPUT:
  50. RETVAL
  51. SDLMod *
  52. keysym_mod ( keysym, ... )
  53. SDL_keysym *keysym
  54. PREINIT:
  55. char* CLASS = "SDL::Mod";
  56. CODE:
  57. if( items > 1 )
  58. {
  59. SDLMod *mp = (SDLMod * )SvPV( ST(1), PL_na) ;
  60. keysym->mod = *mp;
  61. }
  62. RETVAL = &(keysym->mod);
  63. OUTPUT:
  64. RETVAL
  65. Uint16
  66. keysym_unicode ( keysym, ... )
  67. SDL_keysym *keysym
  68. CODE:
  69. if( items > 1 )
  70. {
  71. keysym->unicode = SvIV( ST(1) );
  72. }
  73. RETVAL = keysym->unicode;
  74. OUTPUT:
  75. RETVAL
  76. void
  77. keysym_DESTROY(self)
  78. SDL_keysym *self
  79. CODE:
  80. safefree( (char *)self );