We have global key/mouse shortcuts in some global
CastleSceneManagerunit we have
Input_Interactand some game operations.
CastlePlayerunit we have
PlayerInput_Xxxglobal variables, these override some camera shortcuts when Player is used.
There are also local inputs, local to a specific camera instance,
Input_Xxx properties of
If you use TPlayer then
TPlayer uses it's own
and overrides (most of) camera inputs with global
PlayerInput_Xxx, so (most of) the
should not be accessed directly, instead change only the global
PlayerInput_Xxx. TPlayer sets typical AWSD key
controls scheme, and they are also state-sensitive: they change appropriately
when player is dead or blocked (see
Every key/mouse shortcut is a TInputShortcut.
They are configurable,
you can change the shortcuts whenever you want (see
TInputShortcut.Assign and other methods). You can also detect
conflicts in the keymap and handle them however you like (see
GameControlsMenu unit in "The Castle 1" sources
The state of keys on the global keymap (
be saved/loaded to the config file, if you call
See the chapter User preferences for more information about this.
You can also create new
Then can be global (added to
InputsAll, saved to config file and such) or local. See
unit API docs. You can easily handle them by overriding
TCastleWindow.EventPress methods, or assigning
TCastleWindow.OnPress callbacks. You will find then useful methods
TInputShortcut.IsEvent(TInputPressRelease) (to detect press/release of
TInputShortcut.IsPressed(IUIContainer) (to detect holding
(keeping pressed) of input).
An example application that creates a set of custom TInputShortcut instances, and saves/loads them to config file, is in examples/3d_rendering_processing/custom_input_shortcuts_saved_to_config.lpr.
Copyright Michalis Kamburelis. Thanks go to Paweł Wojciechowicz from Cat-astrophe Games for various graphics. Even this documentation is open-source, you can redistribute it on terms of the GNU General Public License.