ESCInputsManager
Extends: Resource
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
unset_hovered_node
func unset_hovered_node(item: ESCItem)
Unsets the hovered node.
Parameters
item: the item that was unfocused (mouse_exited)
set_hovered_node
func set_hovered_node(item: ESCItem) -> bool
Sets the hovered node and calls its mouse_entered() method if it was the top most item in hover_stack.
Parameters
item: the item that was focused (mouse_entered)
Returns True if item is the new top hovered object
on_item_non_interactive
func on_item_non_interactive(item: ESCItem) -> void
Function called when the item is set interactive, to re-trigger an input on underlying item.
Parameters
item: The ESCCItem that was set non-interactive
hover_stack_add_item
func hover_stack_add_item(item)
Add the given item to the stack if not already in it.
Parameters
item: the item to add to the hover stack
hover_stack_add_items
func hover_stack_add_items(items: Array)
Add the items contained in given list to the stack if not already in it.
Parameters
items: the items list (array) to add to the hover stack
hover_stack_erase_item
func hover_stack_erase_item(item)
Remove the given item from the stack
Parameters
item: the item to remove from the hover stack
hover_stack_clear
func hover_stack_clear()
Clear the stack of hovered items
Sub-classes
HoverStackSorter
Method Descriptions
sort_ascending_z_index (static)
func sort_ascending_z_index(a, b)