From: Tobias Leich Date: Thu, 5 Nov 2009 18:43:41 +0000 (+0100) Subject: added JoyHatEvent X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=d3779af7dd81019142123e94f375cec2157115f9;p=sdlgit%2FSDL_perl.git added JoyHatEvent --- diff --git a/Build.PL b/Build.PL index 0556555..233147a 100644 --- 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 index 0000000..ffed2a6 --- /dev/null +++ b/src/Core/objects/JoyButtonEvent.xs @@ -0,0 +1,57 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifndef aTHX_ +#define aTHX_ +#endif + +#include + +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 index 0000000..390890b --- /dev/null +++ b/src/Core/objects/JoyHatEvent.xs @@ -0,0 +1,57 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifndef aTHX_ +#define aTHX_ +#endif + +#include + +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