NAME
UAV::Pilot::SDL::Events
SYNOPSIS
my $condvar = AnyEvent->condvar;
my $sdl_events = UAV::Pilot::SDL::Events->new({
condvar => $condvar,
});
$sdl_events->register( ... );
$sdl_events->init_event_loop;
$condvar->recv;
DESCRIPTION
Handles the SDL event loop in terms of AnyEvent
. In particular, it automatically handles SDL_QUIT
events, which you'll need if you open any SDL windows (which UAV::Pilot::Control::ARDrone::SDLNavOutput
does, for instance). Without that processing, you would need to manually stop the process with kill -9
or some such.
METHODS
new
new({
condvar => $cv,
})
Constructor. The condvar
argument is an AnyEvent::Condvar
.
register
register( $event_handler )
Adds a object that does the UAV::Pilot::SDL::EventHandler
role to the list. The process_events
method on that object will be called each time the event loop runs.
init_event_loop
Sets up the event loop. Note that you must still call recv
on the AnyEvent::Condvar
to start the loop running.