InputMap
A singleton that manages all InputEventAction
s.
class InputMap
Manages all InputEventAction
which can be created/modified from the project settings menu Project > Project Settings > Input Map or in code with addAction(_:deadzone:)
and actionAddEvent(action:event:)
. See _input(event:)
.
Superclasses
class Object
Base class for all other classes in the engine.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Type members
static func actionAddEvent(action: StringName, event: InputEvent?
) Adds an
InputEvent
to an action. ThisInputEvent
will trigger the action.static func actionEraseEvent(action: StringName, event: InputEvent?
) Removes an
InputEvent
from an action.static func actionEraseEvents(action: StringName
) Removes all events from an action.
static func actionGetDeadzone(action: StringName
) -> Double Returns a deadzone value for the action.
static func actionGetEvents(action: StringName
) -> ObjectCollection<InputEvent> Returns an array of
InputEvent
s associated with a given action.static func actionHasEvent(action: StringName, event: InputEvent?
) -> Bool Returns
true
if the action has the givenInputEvent
associated with it.static func actionSetDeadzone(action: StringName, deadzone: Double
) Sets a deadzone value for the action.
static func addAction(StringName, deadzone: Double
) Adds an empty action to the
InputMap
with a configurabledeadzone
.static func eraseAction(StringName
) Removes an action from the
InputMap
.static func eventIsAction(event: InputEvent?, action: StringName, exactMatch: Bool
) -> Bool Returns
true
if the given event is part of an existing action. This method ignores keyboard modifiers if the givenInputEvent
is not pressed (for proper release detection). SeeactionHasEvent(action:event:)
if you don’t want this behavior.static func getActions(
) -> VariantCollection<StringName> Returns an array of all actions in the
InputMap
.static func hasAction(StringName
) -> Bool Returns
true
if theInputMap
has a registered action with the given name.static func loadFromProjectSettings(
) Clears all
InputEventAction
in theInputMap
and load it anew fromProjectSettings
.class var godotClassName: StringName