added KeyboardEvent structure
Tobias Leich [Thu, 5 Nov 2009 17:16:32 +0000 (18:16 +0100)]
src/Core/objects/ActiveEvent.xs
src/Core/objects/KeyboardEvent.xs [new file with mode: 0644]

index 085e98f..3721798 100644 (file)
@@ -14,11 +14,11 @@ MODULE = SDL::ActiveEvent   PACKAGE = SDL::ActiveEvent    PREFIX = aevent_
 
 SDL_ActiveEvent -- Application visibility event structure
 
- typedef union{
+ typedef struct{
   Uint8 type;
   Uint8 gain;
   Uint8 state;
- } SDL_Event;
+ } SDL_ActiveEvent;
 
 
 =cut
diff --git a/src/Core/objects/KeyboardEvent.xs b/src/Core/objects/KeyboardEvent.xs
new file mode 100644 (file)
index 0000000..580bdec
--- /dev/null
@@ -0,0 +1,48 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::KeyboardEvent    PACKAGE = SDL::KeyboardEvent    PREFIX = kbevent_
+
+=for documentation
+
+SDL_KeyboardEvent --Keyboard event structure
+
+ typedef struct{
+  Uint8 type;
+  Uint8 state;
+  SDL_keysym keysym;
+ } SDL_KeyboardEvent;
+
+
+=cut
+
+Uint8
+kbevent_type ( event, ... )
+       SDL_KeyboardEvent *event
+       CODE: 
+               RETVAL = event->type;
+       OUTPUT:
+               RETVAL
+
+Uint8
+kbevent_state ( event, ... )
+       SDL_KeyboardEvent *event
+       CODE: 
+               RETVAL = event->state;
+       OUTPUT:
+               RETVAL
+
+SDL_keysym
+kbevent_keysym ( event, ... )
+       SDL_KeyboardEvent *event
+       CODE: 
+               RETVAL = event->gain;
+       OUTPUT:
+               RETVAL