Module: Metro::HasEvents::ClassMethods
- Defined in:
- lib/metro/events/has_events.rb
Instance Method Summary collapse
-
#event(event_type, *args, &block) ⇒ Object
Register an event for the scene.
-
#events ⇒ Object
A list of all the EventFactories defined for this event holding object.
Instance Method Details
#event(event_type, *args, &block) ⇒ Object
Register an event for the scene.
Here in this scene if the Escape Key is pressed and released the example scene will transition to the title scene.
Here in this scene if the GpLeft or GpUp buttons are pressed down the method ‘previous_options` will be executed.
This example uses a block instead of a method name but it is absolultey the same as the last example.
93 94 95 |
# File 'lib/metro/events/has_events.rb', line 93 def event(event_type,*args,&block) EventDictionary.add target: metro_name, type: event_type, args: args, block: block end |
#events ⇒ Object
Returns a list of all the EventFactories defined for this event holding object.
100 101 102 |
# File 'lib/metro/events/has_events.rb', line 100 def events EventDictionary.events_for_targets(hierarchy) end |