SDL::Event - a SDL perl extension |
new()
type()
pump()
poll()
wait()
active_gain()
active_state()
key_state()
key_sym()
key_name()
key_mod()
key_unicode()
key_scancode()
motion_state()
motion_x()
motion_y()
motion_xrel()
motion_yrel()
button_state()
button_x()
button_y()
button()
SDL::Event - a SDL perl extension
use SDL::Event; my $event = new SDL::Event; # create a new event $event->pump(); # pump all events from SDL Event Queue $event->poll(); # Get the top one from the queue while ($event->wait()) { my $type = $event->type(); # get event type # ... handle event exit if $type == SDL_QUIT; } =head1 DESCRIPTION
SDL::Event
offers an object-oriented approach to SDL events. By creating
an instance of SDL::Event via new()
you can wait for events, and then determine
the type of the event and take an appropriate action.
Here is an example of a simple event handler loop routine. See also the SDL::App::loop manpage.
sub loop { my ($self,$href) = @_; my $event = new SDL::Event; while ( $event->wait() ) { # ... insert here your event handling like: if ( ref($$href{$event->type()}) eq "CODE" ) { &{$$href{$event->type()}}($event); $self->sync(); } } }
new()
Create a new event object.
type()
Returns the type of the event, see list of exported symbols for which are available.
pump()
poll()
wait()
Waits for an event end returns then. Always returns true.
Set the state for all events of the given event's type
Toggle unicode on the event.
Sets the delay and intervall of the key repeat rate (e.g. when a user holds down a key on the keyboard).
active_gain()
active_state()
key_state()
key_sym()
key_name()
key_mod()
key_unicode()
key_scancode()
motion_state()
motion_x()
Returns the motion of the mouse in X direction as an absolute value.
motion_y()
Returns the motion of the mouse in Y direction as an absolute value.
motion_xrel()
Returns the motion of the mouse in X direction as a relative value.
motion_yrel()
Returns the motion of the mouse in Y direction as a relative value.
button_state()
Returns the state of the mouse buttons.
button_x()
button_y()
button()
David J. Goehrig Documentation by Tels <http://bloodgate.com/>
perl the SDL::App manpage
SDL::Event - a SDL perl extension |