From: Kartik Thakore Date: Thu, 5 Nov 2009 23:48:37 +0000 (-0500) Subject: Added UserEvent X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=c150728c9fd33d086910f91538b18a0027997034;p=sdlgit%2FSDL_perl.git Added UserEvent --- diff --git a/Build.PL b/Build.PL index 47b1046..7d0e178 100644 --- a/Build.PL +++ b/Build.PL @@ -112,6 +112,13 @@ my %subsystems = }, libraries => [qw( SDL )], }, + UserEvent => { + file => { + from => 'src/Core/objects/UserEvent.xs', + to => 'lib/SDL/UserEvent.xs', + }, + libraries => [qw( SDL )], + }, MultiThread => { file => { from => 'src/Core/MultiThread.xs', diff --git a/src/Core/objects/UserEvent.xs b/src/Core/objects/UserEvent.xs new file mode 100644 index 0000000..bc66ab2 --- /dev/null +++ b/src/Core/objects/UserEvent.xs @@ -0,0 +1,65 @@ +#include "EXTERN.h" +#include "perl.h" +#include "XSUB.h" + +#ifndef aTHX_ +#define aTHX_ +#endif + +#include + +MODULE = SDL::UserEvent PACKAGE = SDL::UserEvent PREFIX = uevent_ + +=for documentation + +SDL_UserEvent -- A user-defined event type + + typedef struct{ + Uint8 type; + int code; + void* data1; + void* data2; + } SDL_UserEvent; + + +=cut +Uint8 +uevent_type ( event, ... ) + SDL_UserEvent *event + CODE: + if( items > 2) + { + event->type = SvIV(ST(1)); + } + RETVAL = event->type; + OUTPUT: + RETVAL + +int +uevent_code ( event, ... ) + SDL_UserEvent *event + CODE: + if( items > 2 ) + { + event->code = SvIV(ST(1)); + } + RETVAL = event->code; + OUTPUT: + RETVAL + +void +uevent_data1 ( event, data ) + SDL_UserEvent *event + IV data + CODE: + void * dataP = INT2PTR( void *, data); + event->data1 = dataP; + + +void +uevent_data2 ( event, data ) + SDL_UserEvent *event + IV data + CODE: + void * dataP = INT2PTR( void *, data); + event->data2 = dataP; diff --git a/src/Core/objects/typemap b/src/Core/objects/typemap new file mode 100644 index 0000000..e69de29