fixed KeyboardEvent::keysym, added MousMotionEvent
Tobias Leich [Thu, 5 Nov 2009 17:59:30 +0000 (18:59 +0100)]
Build.PL
src/Core/objects/KeyboardEvent.xs
src/Core/objects/MouseMotionEvent.xs [new file with mode: 0644]

index a6dfd32..8203115 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -56,6 +56,20 @@ my %subsystems =
                },
                libraries => [qw( SDL )],
        },
+       KeyboardEvent => {
+               file      => {
+                       from  => 'src/Core/objects/KeyboardEvent.xs',
+                       to    => 'lib/SDL/KeyboardEvent.xs',
+               },
+               libraries => [qw( SDL )],
+       },
+       MouseMotionEvent => {
+               file      => {
+                       from  => 'src/Core/objects/MouseMotionEvent.xs',
+                       to    => 'lib/SDL/MouseMotionEvent.xs',
+               },
+               libraries => [qw( SDL )],
+       },
        MultiThread => {
                file      => {
                        from  => 'src/Core/MultiThread.xs',
index 580bdec..94ad8c6 100644 (file)
@@ -39,10 +39,12 @@ kbevent_state ( event, ... )
        OUTPUT:
                RETVAL
 
-SDL_keysym
+SDL_keysym *
 kbevent_keysym ( event, ... )
        SDL_KeyboardEvent *event
+       PREINIT:
+               char* CLASS = "SDL::keysym";
        CODE: 
-               RETVAL = event->gain;
+               RETVAL = &(event->keysym);
        OUTPUT:
                RETVAL
diff --git a/src/Core/objects/MouseMotionEvent.xs b/src/Core/objects/MouseMotionEvent.xs
new file mode 100644 (file)
index 0000000..3441108
--- /dev/null
@@ -0,0 +1,73 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::MouseMotionEvent         PACKAGE = SDL::MouseMotionEvent    PREFIX = mmevent_
+
+=for documentation
+
+SDL_MouseMotionEvent -- Mouse motion event structure
+
+ typedef struct{
+  Uint8 type;
+  Uint8 state;
+  Uint16 x, y;
+  Uint16 xrel, yrel;
+ } SDL_MouseMotionEvent;
+
+
+=cut
+
+Uint8
+mmevent_type ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->type;
+       OUTPUT:
+               RETVAL
+
+Uint8
+mmevent_state ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->state;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mmevent_x ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->x;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mmevent_y ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->y;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mmevent_xrel ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->xrel;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mmevent_yrel ( event, ... )
+       SDL_MouseMotionEvent *event
+       CODE: 
+               RETVAL = event->yrel;
+       OUTPUT:
+               RETVAL