User Tools

Site Tools


docs:controlmode

The ControlMode Service tracks which controller type was most recently used by the player and makes that information available to other parts of the game. This information can then be used to ensure that the UI behaves correctly (i.e. snapping cursor to entries in a list, modifying labels, or moving UI elements around).

Usage:

# Get current Mode:
Services.ControlMode.current_mode

# Force set mode:
Services.ControlMode.current_mode = Services.ControlMode.Modes.KEYBOARD

# Find out when mode changes:
Services.ControlMode.connect("mode_changed", self, "_callback")

Class Reference

Enums

  • Modes {KEYBOARD, MOUSE}
    • Different options for current_mode

Signals

  • mode_changed
    • Fired whenever the mode is changed

Properties

  • current_mode: int
    • Must be set to a valid Mode
  • mode_switch_speed: int
    • Number of px/sec that the mouse has to move before the current_mode will switch from KEYBOARD to MOUSE
  • locked: bool
    • If true the current_mode mode will be read-only
docs/controlmode.txt · Last modified: 2021/02/15 23:32 by 89.45.224.37