added MouseButtonEvent
Tobias Leich [Thu, 5 Nov 2009 18:08:20 +0000 (19:08 +0100)]
Build.PL
src/Core/objects/MouseButtonEvent.xs [new file with mode: 0644]

index 8203115..d422e00 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -63,6 +63,13 @@ my %subsystems =
                },
                libraries => [qw( SDL )],
        },
+       MouseButtonEvent => {
+               file      => {
+                       from  => 'src/Core/objects/MouseButtonEvent.xs',
+                       to    => 'lib/SDL/MouseButtonEvent.xs',
+               },
+               libraries => [qw( SDL )],
+       },
        MouseMotionEvent => {
                file      => {
                        from  => 'src/Core/objects/MouseMotionEvent.xs',
diff --git a/src/Core/objects/MouseButtonEvent.xs b/src/Core/objects/MouseButtonEvent.xs
new file mode 100644 (file)
index 0000000..f15cbc3
--- /dev/null
@@ -0,0 +1,74 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::MouseButtonEvent         PACKAGE = SDL::MouseButtonEvent    PREFIX = mbevent_
+
+=for documentation
+
+SDL_MouseButtonEvent -- Mouse button event structure
+
+ typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 button;
+  Uint8 state;
+  Uint16 x, y;
+ } SDL_MouseButtonEvent;
+
+
+=cut
+
+Uint8
+mbevent_type ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->type;
+       OUTPUT:
+               RETVAL
+
+Uint8
+mbevent_which ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->which;
+       OUTPUT:
+               RETVAL
+
+Uint8
+mbevent_button ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->button;
+       OUTPUT:
+               RETVAL
+
+Uint8
+mbevent_state ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->state;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mbevent_x ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->x;
+       OUTPUT:
+               RETVAL
+
+Uint16
+mbevent_y ( event, ... )
+       SDL_MouseButtonEvent *event
+       CODE: 
+               RETVAL = event->y;
+       OUTPUT:
+               RETVAL