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

index 0556555..233147a 100644 (file)
--- a/Build.PL
+++ b/Build.PL
@@ -63,6 +63,20 @@ my %subsystems =
                },
                libraries => [qw( SDL )],
        },
+#      JoyButtonEvent => {
+#              file      => {
+#                      from  => 'src/Core/objects/JoyButtonEvent.xs',
+#                      to    => 'lib/SDL/JoyButtonEvent.xs',
+#              },
+#              libraries => [qw( SDL )],
+#      },
+       JoyHatEvent => {
+               file      => {
+                       from  => 'src/Core/objects/JoyHatEvent.xs',
+                       to    => 'lib/SDL/JoyHatEvent.xs',
+               },
+               libraries => [qw( SDL )],
+       },
        KeyboardEvent => {
                file      => {
                        from  => 'src/Core/objects/KeyboardEvent.xs',
diff --git a/src/Core/objects/JoyButtonEvent.xs b/src/Core/objects/JoyButtonEvent.xs
new file mode 100644 (file)
index 0000000..ffed2a6
--- /dev/null
@@ -0,0 +1,57 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::JoyButtonEvent   PACKAGE = SDL::JoyButtonEvent    PREFIX = jbevent_
+
+=for documentation
+
+SDL_JoyButtonEvent -- Joystick button event structure
+
+ typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 button;
+  Uint8 state;
+ } SDL_JoyButtonEvent;
+
+
+=cut
+
+Uint8
+jbevent_type ( event, ... )
+       SDL_JoyButtonEvent *event
+       CODE:
+               RETVAL = event->type;
+       OUTPUT:
+               RETVAL
+
+Uint8
+jbevent_which ( event, ... )
+       SDL_JoyButtonEvent *event
+       CODE: 
+               RETVAL = event->which;
+       OUTPUT:
+               RETVAL
+
+Uint8
+jbevent_button ( event, ... )
+       SDL_JoyButtonEvent *event
+       CODE: 
+               RETVAL = event->button;
+       OUTPUT:
+               RETVAL
+
+Uint8
+jbevent_state ( event, ... )
+       SDL_JoyButtonEvent *event
+       CODE: 
+               RETVAL = event->state;
+       OUTPUT:
+               RETVAL
diff --git a/src/Core/objects/JoyHatEvent.xs b/src/Core/objects/JoyHatEvent.xs
new file mode 100644 (file)
index 0000000..390890b
--- /dev/null
@@ -0,0 +1,57 @@
+#include "EXTERN.h"
+#include "perl.h"
+#include "XSUB.h"
+
+#ifndef aTHX_
+#define aTHX_
+#endif
+
+#include <SDL.h>
+
+MODULE = SDL::JoyHatEvent      PACKAGE = SDL::JoyHatEvent    PREFIX = jhevent_
+
+=for documentation
+
+SDL_JoyHatEvent -- Joystick hat position change event structure
+
+ typedef struct{
+  Uint8 type;
+  Uint8 which;
+  Uint8 hat;
+  Uint8 value;
+ } SDL_JoyHatEvent;
+
+
+=cut
+
+Uint8
+jhevent_type ( event, ... )
+       SDL_JoyHatEvent *event
+       CODE: 
+               RETVAL = event->type;
+       OUTPUT:
+               RETVAL
+
+Uint8
+jhevent_which ( event, ... )
+       SDL_JoyHatEvent *event
+       CODE: 
+               RETVAL = event->which;
+       OUTPUT:
+               RETVAL
+
+Uint8
+jhevent_hat ( event, ... )
+       SDL_JoyHatEvent *event
+       CODE: 
+               RETVAL = event->hat;
+       OUTPUT:
+               RETVAL
+
+Sint16
+jhevent_value ( event, ... )
+       SDL_JoyHatEvent *event
+       CODE: 
+               RETVAL = event->value;
+       OUTPUT:
+               RETVAL