parrotcode: Parrot extension representing SDL Events | |
Contents | Libraries |
SDL::Event - Parrot extension representing SDL Events
# load this library
load_bytecode 'library/SDL/Event.pir'
# 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_Event
structure. You probably don't need to use this directly, unless you're working with raw SDL calls.SDL_Event.h
library; they're all lower cased here. For example, a key down event will have the name key_down
.unknown
.unknown
instead.event_handler
object (either subclassing SDL::EventHandler
or implementing its necessary methods) and a PerlHash
of arguments to pass to all event handlers, loops around SDL's event loop and calls appropriate methods in event_handler
corresponding to what happens.key_down
method of event_handler
, passing handler_args
.check_interval
, this will poll for events every check_interval
seconds. 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_handler
object (either subclass SDL::EventHandler or reimplement the appropriate methods yourself) and a PerlHash
PMC 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.handle_event()
or process_events()
.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.
|