ESCInputsManager
Extends: Node
Description
Escoria inputs manager Catches, handles and distributes input events for the game
Constants Descriptions
ESC_SHOW_DEBUG_PROMPT
const ESC_SHOW_DEBUG_PROMPT: String = "esc_show_debug_prompt"
Input action for use by InputMap
ESC_UI_PRIMARY_ACTION
const ESC_UI_PRIMARY_ACTION: String = "esc_ui_primary_action"
Input action for use by InputMap that represents a “primary action” from an input device, such as a left-click on a mouse or the X button on an XBox controller
INPUT_ALL
const INPUT_ALL: int = 0
INPUT_NONE
const INPUT_NONE: int = 1
INPUT_SKIP
const INPUT_SKIP: int = 2
SWITCH_ACTION_VERB
const SWITCH_ACTION_VERB: String = "switch_action_verb"
Input action for use by InputMap
Property Descriptions
input_mode
var input_mode
The current input mode
hover_stack
var hover_stack: Array
A LIFO stack of hovered items
hotspot_focused
var hotspot_focused: String = ""
The global id of the topmost item from the hover_stack
custom_input_handler
var custom_input_handler
Function reference that can be used to intercept and process input events. If set, this function must have the following signature:
(event: InputEvent, is_default_state: bool) -> bool
Parameters
event: The event to process
is_default_state: Whether the current state is escoria.GAME_STATE.DEFAULT
Returns Whether the function processed the event.
Method Descriptions
register_core
func register_core()
Register core signals (from escoria.gd)
register_inventory_item
func register_inventory_item(item: Node)
Connect the item signals to the local methods
register_background
func register_background(background: ESCBackground)
register_custom_input_handler
func register_custom_input_handler(callback) -> void
Registers a function that can be used to intercept and process input events.
callback
must have the following signature:
(event: InputEvent, is_default_state: bool) -> bool
where
event: The event to process
is_default_state: Whether the current state is escoria.GAME_STATE.DEFAULT
returns whether the function processed the event
callback
is responsible for calling get_tree().set_input_as_handled()
,
if appropriate.
Parameters
callback: Function reference satisfying the above contract
try_custom_input_handler
func try_custom_input_handler(event: InputEvent, is_default_state: bool) -> bool
If a callback was specified via register_custom_input_handler()
,
forwards the event to the callback and returns its result; otherwise,
returns false
.
Parameters
event: The event to process
is_default_state: Whether the current state is escoria.GAME_STATE.DEFAULT
Returns Result of custom_input_handler
if set; otherwise, false
clear_stack
func clear_stack()
Clear the stack of hovered items