|parrotcode: Parrot extension representing SDL Events|
|Contents | Libraries|
SDL::Event - Parrot extension representing SDL Events
# load this library load_bytecode 'library/SDL/Event.imc' # create a new SDL::Event object .local pmc event .local int event_type find_type event_type, 'SDL::Event' event = new event_type # ... create a new event_handler and its hander_args # start the event loop event.'process_events'( event_handler, handler_args ) # or handle one event at a time in your own loop event.'handle_event'( event_handler, handler_args )
SDL::Event encapsulates event information for SDL. This may change internally as we migrate to Parrot events, but most of the interesting information happens in SDL::EventHandler instead, so go read that first.
You may discover that you don't really care about this class beyond what you've already learned from the SYNOPSIS already.
The SDL::Event object has the following methods:
SDL_Eventstructure. You probably don't need to use this directly, unless you're working with raw SDL calls.
SDL_Event.hlibrary; they're all lower cased here. For example, a key down event will have the name
event_handlerobject (either subclassing
SDL::EventHandleror implementing its necessary methods) and a
PerlHashof arguments to pass to all event handlers, loops around SDL's event loop and calls appropriate methods in
event_handlercorresponding to what happens.
check_interval, this will poll for events every
check_intervalseconds. This makes it possible to check for events in your main thread, without breaking Parrot's own event loop (used for timers, for example). This is an optional parameter and can be any number of seconds or fractions thereof.
event_handlerobject (either subclass SDL::EventHandler or reimplement the appropriate methods yourself) and a
PerlHashPMC of data to pass to all handler calls, handles one event, if any are present. If there are no events pending, this will return directly.
Written and maintained by chromatic, <chromatic at wgz dot org>, with some design from Allison Randal. Please send patches, feedback, and suggestions to the Perl 6 Internals mailing list.
Copyright (c) 2004, The Perl Foundation.