Package com.victorvalentim.zividomelive
Class SceneActionMap
java.lang.Object
com.victorvalentim.zividomelive.SceneActionMap
Activation-scoped named actions and Processing input bindings.
Key and mouse bindings run on the Processing frame thread before the matching raw
Scene callback. Programmatic trigger(String) calls run synchronously on the
caller's thread, so scene code should trigger actions from Processing callbacks.
The runtime clears all bindings when the activation ends.
API stability: Advanced Stable.
- Since:
- 2.0.0
-
Method Summary
Modifier and TypeMethodDescriptionvoidbindKeyCodePressed(String name, int keyCode, Runnable action) Registers an action and binds it to a Processing key code.voidbindKeyPressed(String name, char key, Runnable action) Registers an action and binds it to a key-press character.voidBinds a named mouse handler such asMouseEvent.PRESSorMouseEvent.DRAG.voidclear()Removes every action and binding.voidRegisters or replaces a named action.intsize()booleanTriggers a named action programmatically.voidunregister(String name) Removes an action and all of its input bindings.
-
Method Details
-
register
Registers or replaces a named action.- Parameters:
name- stable non-blank action nameaction- callback to run
-
bindKeyPressed
Registers an action and binds it to a key-press character.- Parameters:
name- stable non-blank action namekey- Processing key characteraction- callback to run
-
bindKeyCodePressed
Registers an action and binds it to a Processing key code.- Parameters:
name- stable non-blank action namekeyCode- Processing key codeaction- callback to run
-
bindMouse
Binds a named mouse handler such asMouseEvent.PRESSorMouseEvent.DRAG.Only one binding is retained for each Processing mouse action constant.
- Parameters:
name- stable non-blank action namemouseAction- Processing mouse action constanthandler- event consumer to run
-
trigger
Triggers a named action programmatically.- Parameters:
name- action name- Returns:
- true when a registered action ran
-
unregister
Removes an action and all of its input bindings.- Parameters:
name- action name to remove
-
size
public int size()- Returns:
- number of named runnable actions plus separately registered mouse bindings
-
clear
public void clear()Removes every action and binding.
-