From: Tobias Leich Date: Thu, 5 Nov 2009 17:16:32 +0000 (+0100) Subject: added KeyboardEvent structure X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=48db7efc8d466330ae47aa46417cd74a7faa62f6;p=sdlgit%2FSDL_perl.git added KeyboardEvent structure --- diff --git a/src/Core/objects/ActiveEvent.xs b/src/Core/objects/ActiveEvent.xs index 085e98f..3721798 100644 --- a/src/Core/objects/ActiveEvent.xs +++ b/src/Core/objects/ActiveEvent.xs @@ -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 index 0000000..580bdec --- /dev/null +++ b/src/Core/objects/KeyboardEvent.xs @@ -0,0 +1,48 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifndef aTHX_ +#define aTHX_ +#endif + +#include + +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