#include <SDL.h>
#include <SDL_events.h>
+/* Static Memory for event filter call back */
+static SV * eventfiltersv;
+
+
+int eventfilter_cb( const void * event)
+{
+
+ dSP;
+ int count;
+ int filter_signal;
+
+ ENTER;
+ SAVETMPS;
+ PUSHMARK(SP);
+
+ XPUSHs((SDL_Event *)event);
+
+ PUTBACK;
+
+ filter_signal = call_sv(eventfiltersv, G_SCALAR);
+
+ SPAGAIN;
+
+ if (count != 1 ) croak("callback returned more than 1 value\n");
+
+ filter_signal = POPi;
+
+ FREETMPS;
+ LEAVE;
+
+ return filter_signal;
+}
+
+
+
+
+
MODULE = SDL::Events PACKAGE = SDL::Events PREFIX = events_
=for documentation
RETVAL = SDL_WaitEvent(event);
OUTPUT:
RETVAL
+
+void
+events_set_event_filter(callback)
+ SV* callback
+ CODE:
+ eventfiltersv = callback;
+ SDL_SetEventFilter( (SDL_EventFilter*)eventfilter_cb);
push_event
poll_event
wait_event
+set_event_filter
+
/;
my @done_event =qw/
my $num_peep_events = SDL::Events::peep_events($event, 127, SDL_PEEKEVENT, SDL_ALLEVENTS);
is($num_peep_events >= 0, 1, '[peep_events] Size of event queue is ' . $num_peep_events);
+my $callback = sub { print shift->type; return 1; };
+SDL::Events::set_event_filter( $callback );
+pass '[set_event_filter] takes a callback';
+
my @left = qw/
-seteventfilter
eventstate
getkeystate
getmodstate