PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 3ms RepoModel.GetById 1ms 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
 1#include "EXTERN.h"
 2#include "perl.h"
 3#include "XSUB.h"
 4#include "ppport.h"
 5
 6#ifndef aTHX_
 7#define aTHX_
 8#endif
 9
10#include <SDL.h>
11
12MODULE = SDL::keysym 	PACKAGE = SDL::keysym    PREFIX = keysym_
13
14=for documentation
15
16SDL_keysym -- keysym structure
17
18 typedef struct{
19  Uint8 scancode;
20  SDLKey sym;
21  SDLMod mod;
22  Uint16 unicode;
23 } SDL_keysym;
24
25
26=cut
27
28SDL_keysym *
29keysym_new ( CLASS )
30	char* CLASS
31	CODE:
32		RETVAL = safemalloc(sizeof(SDL_keysym));
33	OUTPUT:
34		RETVAL
35
36Uint8
37keysym_scancode ( keysym, ... )
38	SDL_keysym *keysym
39	CODE: 
40		if( items > 1 )
41		{
42			keysym->scancode = SvIV( ST(1) );
43		}
44
45		RETVAL = keysym->scancode;
46	OUTPUT:
47		RETVAL
48
49SDLKey *
50keysym_sym ( keysym, ... )
51	SDL_keysym *keysym
52	PREINIT:
53		char* CLASS = "SDL::Key";
54	CODE: 
55		if( items > 1 )
56		{
57			SDLKey *kp  = (SDLKey * )SvPV( ST(1), PL_na) ;
58			keysym->sym = *kp;
59		}
60
61		RETVAL = &(keysym->sym);
62	OUTPUT:
63		RETVAL
64
65SDLMod *
66keysym_mod ( keysym, ... )
67	SDL_keysym *keysym
68	PREINIT:
69		char* CLASS = "SDL::Mod";
70	CODE: 
71		if( items > 1 )
72		{
73			SDLMod *mp  = (SDLMod * )SvPV( ST(1), PL_na) ;
74			keysym->mod = *mp;
75		}
76
77		RETVAL = &(keysym->mod);
78	OUTPUT:
79		RETVAL
80
81Uint16
82keysym_unicode ( keysym, ... )
83	SDL_keysym *keysym
84	CODE: 
85		if( items > 1 )
86		{
87			keysym->unicode = SvIV( ST(1) );
88		}
89
90		RETVAL = keysym->unicode;
91	OUTPUT:
92		RETVAL
93
94void
95keysym_DESTROY(self)
96	SDL_keysym *self
97	CODE:
98		safefree( (char *)self );