From: Tobias Leich Date: Fri, 6 Nov 2009 16:19:52 +0000 (+0100) Subject: added event accessors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=7a2c40640c3086a789a3c9904b6ffd4b1df63057;p=sdlgit%2FSDL_perl.git added event accessors --- diff --git a/Build.PL b/Build.PL index 7d0e178..eccf7f6 100644 --- a/Build.PL +++ b/Build.PL @@ -56,6 +56,13 @@ my %subsystems = }, libraries => [qw( SDL )], }, + Event => { + file => { + from => 'src/Core/objects/Event.xs', + to => 'lib/SDL/Event.xs', + }, + libraries => [qw( SDL )], + }, ExposeEvent => { file => { from => 'src/Core/objects/ExposeEvent.xs', diff --git a/src/Core/objects/Event.xs b/src/Core/objects/Event.xs index a0f45bd..539da64 100644 --- a/src/Core/objects/Event.xs +++ b/src/Core/objects/Event.xs @@ -8,7 +8,7 @@ #include -MODULE = SDL::Event PACKAGE = SDL::Rect PREFIX = event_ +MODULE = SDL::Event PACKAGE = SDL::Event PREFIX = event_ =for documentation @@ -36,9 +36,9 @@ SDL_Event -- General event structure SDL_Event * event_new (CLASS) - char* CLASS + char *CLASS CODE: - SDL_Event* empty_event; + SDL_Event *empty_event; RETVAL = empty_event; OUTPUT: RETVAL @@ -56,6 +56,8 @@ event_type ( event, ... ) SDL_ActiveEvent * event_active ( event, ... ) SDL_Event *event + PREINIT: + char *CLASS = "SDL::ActiveEvent"; CODE: RETVAL = NULL; if ( &event != NULL ) @@ -63,4 +65,147 @@ event_active ( event, ... ) OUTPUT: RETVAL +SDL_KeyboardEvent * +event_key ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::KeyboardEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->key); + OUTPUT: + RETVAL + +SDL_MouseMotionEvent * +event_motion ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::MouseMotionEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->motion); + OUTPUT: + RETVAL + +SDL_MouseButtonEvent * +event_button ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::MouseButtonEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->button); + OUTPUT: + RETVAL + +SDL_JoyAxisEvent * +event_jaxis ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::JoyAxisEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->jaxis); + OUTPUT: + RETVAL + +SDL_JoyBallEvent * +event_jball ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::JoyBallEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->jball); + OUTPUT: + RETVAL + +SDL_JoyHatEvent * +event_jhat ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::JoyHatEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->jhat); + OUTPUT: + RETVAL + +SDL_JoyButtonEvent * +event_jbutton ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::JoyButtonEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->jbutton); + OUTPUT: + RETVAL + +SDL_ResizeEvent * +event_resize ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::ResizeEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->resize); + OUTPUT: + RETVAL + +SDL_ExposeEvent * +event_expose ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::ExposeEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->expose); + OUTPUT: + RETVAL + +SDL_QuitEvent * +event_quit ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::QuitEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->quit); + OUTPUT: + RETVAL + +SDL_UserEvent * +event_user ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::UserEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->user); + OUTPUT: + RETVAL + +SDL_SysWMEvent * +event_syswm ( event, ... ) + SDL_Event *event + PREINIT: + char *CLASS = "SDL::SysWMEvent"; + CODE: + RETVAL = NULL; + if ( &event != NULL ) + RETVAL = &(event->syswm); + OUTPUT: + RETVAL