From: Kartik Thakore Date: Thu, 5 Nov 2009 02:02:31 +0000 (-0500) Subject: Rolled back peep,poll,wait event. As the data structures have not be implmented prope... X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=09d4c93b5b9f7860a2400242d6e2a4514ecbb781;p=sdlgit%2FSDL_perl.git Rolled back peep,poll,wait event. As the data structures have not be implmented properly. The wstat 11 error before was due to a segv cause by using T_PTR type on SDL_Event * it needs to be O_OBJECT. Please take a look at src/Core/objects/Rect.xs --- diff --git a/src/Core/Events.xs b/src/Core/Events.xs index cbeb46a..8602c1e 100644 --- a/src/Core/Events.xs +++ b/src/Core/Events.xs @@ -63,4 +63,4 @@ events_wait_event(event = NULL) CODE: RETVAL = SDL_WaitEvent(event); OUTPUT: - RETVAL \ No newline at end of file + RETVAL diff --git a/t/core_events.t b/t/core_events.t index e873c67..c179845 100644 --- a/t/core_events.t +++ b/t/core_events.t @@ -3,17 +3,13 @@ use strict; use SDL; use SDL::Event; #use SDL::Surface; -#use SDL::Video; +use SDL::Video; use Test::More; -plan ( tests => 14 ); +plan ( tests => 5); my @done =qw/ pump_events -peep_events -poll_event -push_event -wait_event /; @@ -21,9 +17,13 @@ use_ok( 'SDL::Events' ); can_ok ('SDL::Events', @done); SDL::init(SDL_INIT_VIDEO); - + +SDL::Video::set_video_mode(640,480,32, SDL_SWSURFACE); + is(SDL::Events::pump_events(), undef, '[pump_events] Returns undef'); +=pod + my $events = SDL::Event->new(); my $num_peep_events = SDL::Events::peep_events( $events, 127, SDL_PEEKEVENT, SDL_ALLEVENTS); is($num_peep_events >= 0, 1, '[peep_events] Size of event queue is ' . $num_peep_events); @@ -32,14 +32,18 @@ my $event = SDL::Event->new(); my $value = SDL::Events::poll_event($event); is(($value == 1) || ($value == 0), 1, '[poll_event] Returns 1 or 0'); + my $event2 = SDL::Event->new(); is(SDL::Events::push_event($event2), 0, '[push_event] Returns 0 on success'); my $event3 = SDL::Event->new(); is(SDL::Events::push_event($event3), 0, '[push_event] Returns 0 on success'); + my $events2 = SDL::Event->new(); my $num_peep_events2 = SDL::Events::peep_events( $events2, 127, SDL_PEEKEVENT, SDL_ALLEVENTS); -is($num_peep_events2 > $num_peep_events, 1, '[peep_events] Size of event queue is ' . $num_peep_events2); +is($num_peep_events2 > $num_peep_events, 1, '[peep_events] Size of event queue is ' . $num_peep_events2."\t". SDL::get_error()); + + my $events3 = SDL::Event->new(); $num_peep_events = SDL::Events::peep_events( $events3, 1, SDL_ADDEVENT, SDL_ALLEVENTS); @@ -49,11 +53,20 @@ my $events4 = SDL::Event->new(); $num_peep_events = SDL::Events::peep_events( $events4, 1, SDL_GETEVENT, SDL_ALLEVENTS); is($num_peep_events, 1, '[peep_events] Got 1 event from the front of the queue'); + + my $event4 = SDL::Event->new(); is(SDL::Events::wait_event($event4), 1, '[wait_event] Returns 1 on success'); is(SDL::Events::wait_event(), 1, '[wait_event] Returns 1 on success'); +=cut + + my @left = qw/ +peep_events +poll_event +push_event +wait_event seteventfilter eventstate getkeystate diff --git a/typemap b/typemap index b65aa5d..103dcf3 100644 --- a/typemap +++ b/typemap @@ -14,6 +14,21 @@ Sint16 * T_PTR Sint32 T_IV Sint32 * T_PTR SDL_Event * T_PTR +SDL_ActiveEvent O_OBJECT +SDL_KeyboardEvent O_OBJECT +SDL_TextInputEvent O_OBJECT +SDL_MouseMotionEvent O_OBJECT +SDL_MouseButtonEvent O_OBJECT +SDL_JoyAxisEvent O_OBJECT +SDL_JoyHatEvent O_OBJECT +SDL_JoyBallEvent O_OBJECT +SDL_ResizeEvent O_OBJECT +SDL_ExposeEvent O_OBJECT +SDL_SysWMEvent O_OBJECT +SDL_UserEvent O_OBJECT +SDL_QuitEvent O_OBJECT +SDLKey O_OBJECT +SDLMod O_OBJECT SDL_Surface * O_OBJECT SDL_SysWMmsg * T_PTR SDL_CD * T_PTR