Unit CastleInputs

Description

Key and mouse shortcuts (TInputShortcut) and global management of them.

See https://castle-engine.io/manual_key_mouse.php for overview.

TInputShortcut instance represents a key/mouse shortcut. Instances of this class are spread throughout the engine. We have two different ways of using TInputShortcut instance:

  • Global

    TInputShortcut instance with TInputShortcut.Group <> igLocal is called "global". Such instance is automatically (at construction) added to InputsAll and InputsGroup(Group) lists.

    The purpose of such global input map is to be able to detect key conflicts, be able to restore whole input map to default, load/save them to the user config file, and so on. For example CastleViewport.Input_Interact is global.

    Global shortcuts are owned (they will be freed by) this unit (more specifically, they will be freed by InputsAll). When creating them, pass Nil to the Owner parameter of constructor TInputShortcut.Create. This implies that InputsAll and InputsGroup(Group) lists will never shrink, which is useful — once added, shortcuts will not disappear. Global TInputShortcut instances are always in practice also global variables.

  • Local

    TInputShortcut instance with TInputShortcut.Group = igLocal is called "local". It means it's a normal component, it's not automatically present on any global list, so it doesn't conflict with other global shortcuts.

    For example TCastleWalkNavigation contains a number of them like TCastleWalkNavigation.Input_Forward.

You create new inputs by simply constructing new TInputShortcut instances. Make sure you add all global inputs before calling Config.Load, as some functionality assumes that all shortcuts are already added at the time Config.Load is called. The engine units themselves never call Config.Load, it is left to the final application.

Source: ui/castleinputs.pas (line 65).

Uses

Overview

Classes, Interfaces, Objects and Records

Name Description
Class TInputShortcutBinding Abstract input binding, like a given key / mouse button / game contoller press.
Class TInputShortcutBindingList List of TInputShortcutBinding.
Class TInputShortcutBindingControllerAxis Trigger TInputShortcut by a game controller axis.
Class TInputShortcutBindingControllerButton Trigger TInputShortcut by a game controller button.
Class TInputShortcut A keyboard and/or mouse shortcut for activating some action.
Class TInputShortcutList Group of TInputShortcut, to easily manage (search, load, save...) the inputs.

Functions and Procedures

function InputsAll: TInputShortcutList;
function InputsGroup(const Group: TInputGroupNotLocal): TInputShortcutList;

Types

TInputGroup = (...);
TInputGroupNotLocal = igBasic..High(TInputGroup);
TGameControllerAxis = (...);

Description

Functions and Procedures

function InputsAll: TInputShortcutList;

List of all global inputs. All TInputShortcut instances with group other than igLocal will be automatically added here.

Source: ui/castleinputs.pas (line 606).

function InputsGroup(const Group: TInputGroupNotLocal): TInputShortcutList;

This item has no description.

Source: ui/castleinputs.pas (line 608).

Types

TInputGroup = (...);

Type of input, for TInputShortcut.Group.

Values
  • igLocal
  • igBasic
  • igItems
  • igOther

Source: ui/castleinputs.pas (line 78).

TInputGroupNotLocal = igBasic..High(TInputGroup);

This item has no description.

Source: ui/castleinputs.pas (line 79).

TGameControllerAxis = (...);

This item has no description.

Values
  • gaLeftStick
  • gaRightStick
  • gaLeftTrigger
  • gaRightTrigger

Source: ui/castleinputs.pas (line 121).


Generated by PasDoc 0.17.0.snapshot.