Attention: Here be dragons

This is the latest (unstable) version of this documentation, which may document features not available in or compatible with released stable versions of Godot.

InputMap

Hérite de : Object

Un singleton qui gère tous les InputEventActions.

Description

Gère tous les InputEventAction qui peuvent être créés/modifiés dans le menu de Paramètres du projet Projet > Paramètres du projet > Contrôle ou dans le code avec add_action() et action_add_event(). Voir Node._input().

Tutoriels

Méthodes

void

action_add_event(action: StringName, event: InputEvent)

void

action_erase_event(action: StringName, event: InputEvent)

void

action_erase_events(action: StringName)

float

action_get_deadzone(action: StringName)

Array[InputEvent]

action_get_events(action: StringName)

bool

action_has_event(action: StringName, event: InputEvent)

void

action_set_deadzone(action: StringName, deadzone: float)

void

add_action(action: StringName, deadzone: float = 0.2)

void

erase_action(action: StringName)

bool

event_is_action(event: InputEvent, action: StringName, exact_match: bool = false) const

String

get_action_description(action: StringName) const

Array[StringName]

get_actions()

bool

has_action(action: StringName) const

void

load_from_project_settings()


Signaux

project_settings_loaded() 🔗

Emitted when the ProjectSettings InputMap has been loaded.


Descriptions des méthodes

void action_add_event(action: StringName, event: InputEvent) 🔗

Ajoute un InputEvent à une action. Cet InputEvent déclenchera l'action.


void action_erase_event(action: StringName, event: InputEvent) 🔗

Retire un InputEvent d'une action.


void action_erase_events(action: StringName) 🔗

Retire tous les événements d'une action.


float action_get_deadzone(action: StringName) 🔗

Returns a deadzone value for the action.


Array[InputEvent] action_get_events(action: StringName) 🔗

Renvoie un tableau d'InputEvents associés à une action donnée.

Note : Lorsqu'utilisé dans l'éditeur (par exemple un script outil ou EditorPlugin), cette méthode renverra les événements pour l'action de l'éditeur. Si vous souhaitez accéder aux liaisons des entrées de votre projet depuis l'éditeur, lisez les paramètres input/* de ProjectSettings.


bool action_has_event(action: StringName, event: InputEvent) 🔗

Renvoie true si l'action est associée au InputEvent spécifié.


void action_set_deadzone(action: StringName, deadzone: float) 🔗

Définit une valeur pour la zone morte de l'action.


void add_action(action: StringName, deadzone: float = 0.2) 🔗

Adds an empty action to the InputMap with a configurable deadzone.

An InputEvent can then be added to this action with action_add_event().


void erase_action(action: StringName) 🔗

Retirer une action de InputMap.


bool event_is_action(event: InputEvent, action: StringName, exact_match: bool = false) const 🔗

Returns true if the given event is part of an existing action. This method ignores keyboard modifiers if the given InputEvent is not pressed (for proper release detection). See action_has_event() if you don't want this behavior.

If exact_match is false, it ignores additional input modifiers for InputEventKey and InputEventMouseButton events, and the direction for InputEventJoypadMotion events.


String get_action_description(action: StringName) const 🔗

Renvoie la description facilement lisible de l'action donnée.


Array[StringName] get_actions() 🔗

Renvoie la liste de toutes les actions dans l'InputMap.


bool has_action(action: StringName) const 🔗

Renvoie true si l'InputMap a une action enregistrée avec le nom donné.


void load_from_project_settings() 🔗

Efface toutes les InputEventAction dans le InputMap et les rechargent depuis les ProjectSettings.