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.
Uses
- Classes
- Generics.Collections
- CastleKeysMouse
- CastleUtils
- CastleClassUtils
- CastleXMLConfig
- CastleUIControls
Overview
Classes, Interfaces, Objects and Records
Name | Description |
---|---|
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); |
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. |
function InputsGroup(const Group: TInputGroupNotLocal): TInputShortcutList; |
Types
TInputGroup = (...); |
Type of input, for TInputShortcut.Group. Values
|
TInputGroupNotLocal = igBasic..High(TInputGroup); |
Generated by PasDoc 0.16.0.