Event List¶
There are many events that are built into Spyral. The following is a complete lists of them. You can register a handler for an event, and even queue your own custom events.
Director¶
- "director.update" : Event(delta)
Parameters: delta (float) – The amount of time progressed since the last tick Triggered by: Every tick of the clock
- "director.pre_update" : Event()
Triggered by: Every tick of the clock, before "director.update"
- "director.post_update" : Event()
Triggered by: Every tick of the clock, after "director.update"
- "director.render" : Event()
Triggered by: Every time the director draws the scene
- "director.pre_render" : Event()
Triggered by: Directly before "director.render"
- "director.post_render" : Event()
Triggered by: Directly after "director.render"
- "director.redraw" : Event()
Triggered by: Every time the Director is forced to redraw the screen (e.g., if the window regains focus after being minimized).
- "director.scene.enter" : Event(scene)
Parameters: scene (Scene) – The new scene Triggered by: Whenever a new scene is on top of the stack, e.g., a new scene is pushed, another scene is popped
- "director.scene.exit" : Event(scene)
Parameters: scene (Scene) – The old scene Triggered by: Whenever a scene is slips off the stack, e.g., a new scene is pushed on top, a scene is popped
Animations¶
- "<sprite>.<attribute>.animation.start" : Event(animation, sprite)
Parameters: Triggered by: A new animation starting on a sprite.
User Input¶
- "input.mouse.down[.left | .right | .middle | .scroll_up | .scroll_down]" : Event(pos, button)
Parameters: - pos (2-tuple) – The location of the mouse cursor
- button (str) – Either "left", "right", "middle", "scroll_up", or "scroll_down".
Triggered by: Either any mouse button being pressed, or a specific mouse button being pressed
- "input.mouse.up[.left | .right | .middle | .scroll_up | .scroll_down]" : Event(pos, button)
Parameters: - pos (2-tuple) – The location of the mouse cursor
- button (str) – Either "left", "right", "middle", "scroll_up", or "scroll_down".
Triggered by: Either any mouse button being released, or a specific mouse button being released
- "input.mouse.motion" : Event(pos, rel, buttons, left, right, middle)
Parameters: - pos (2-tuple) – The location of the mouse cursor
- rel (2-tuple) – The relative change in the location of the mouse cursor
- buttons (3-tuple) – a 3-tuple of boolean values corresponding to whether the left, middle, and right buttons are being pressed
- left (bool) – whether the left button is being pressed
- middle (bool) – whether the middle button is being pressed
- right (bool) – whether the right button is being pressed
Triggered by: The mouse being moved
- "input.keyboard.up[.* | .f | .down | etc...]" : Event(unicode, key, mod)
Parameters: Triggered by: A key being released
System¶
- "system.quit" : Event()
Triggered by: The OS killing this program, e.g., by pressing the exit button the window handle.
- "system.video_resize" : Event(size, width, height)
Parameters: - size (2-tuple) – The new size of the window
- width (int) – The new width of the window
- height (int) – The new height of the window
Triggered by: Your game loses focus in the OS, e.g., by the window being minimized
- "system.video_expose" : Event()
Triggered by: The OS requests that a portion of the display be redrawn.
- "system.focus_change" : Event(gain, state)
Parameters: - gain (???) –
???
- state (???) –
???
Triggered by: Your game loses focus in the OS, e.g., by the window being minimized
- gain (???) –
Forms¶
- "form.<form name>.<widget name>.changed" : Event(widget, form, value)
Parameters: Triggered by: The widget having its value changed (e.g., Button being pressed or released, TextInput being edited)
- "form.<form name>.<widget name>.clicked" : Event(widget, form, value)
Note
Only Button‘s trigger this event.
Parameters: Triggered by: The widget being pressed and then released.