- Will merge with Parrot's event system at some point
- (That is, at some point after Parrot has a usable event system)
- Subclass SDL::EventHandler:
.local pmc parent_class
.local pmc class_type
getclass parent_class, 'SDL::EventHandler'
subclass class_type, parent_class, 'MoveLogo::EventHandler'
Define methods for the events you want to handle:
.sub key_down_down method
.param pmc event_args
.local pmc screen
.local pmc sprite
screen = event_args[ 'screen' ]
sprite = event_args[ 'sprite' ]
# change position, velocity, etc. here
.end
Create SDL::Event object, event handler object, and handler args hash
Call wait_event
on event
object with event handler and args:
event.'wait_event'( event_handler, handler_args )