Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
inputpolling [2019/04/19 19:47] – [HotKey] admin | inputpolling [2020/11/04 14:52] – [Runtime] admin | ||
---|---|---|---|
Line 6: | Line 6: | ||
Therefor we provide the easy to use **TGorillaInputController** component to access keyboard, mouse and gamepad feedbacks. Also in combination! | Therefor we provide the easy to use **TGorillaInputController** component to access keyboard, mouse and gamepad feedbacks. Also in combination! | ||
+ | |||
+ | ===== Input Devices ===== | ||
+ | The input controller sets up handlers for keyboard, mouse and gamepad, and enables all by default. | ||
+ | |||
+ | <file pascal> | ||
+ | FInput.Supported := [TGorillaInputDeviceType.Keyboard, | ||
+ | TGorillaInputDeviceType.GamePad]; | ||
+ | </ | ||
+ | |||
+ | If you do not need any of the device, you can disable them, by reducing the " | ||
+ | |||
+ | <file pascal> | ||
+ | FInput.Supported := [TGorillaInputDeviceType.GamePad]; | ||
+ | </ | ||
+ | |||
===== HotKey ===== | ===== HotKey ===== | ||
- | A HotKey is a combination of inputs that are simultanously active. Each HotKey can manage inputs from keyboard, mouse and/or gamepad. | + | A HotKey is a combination of simultanously active |
An input is a hardware message: | An input is a hardware message: | ||
Line 22: | Line 37: | ||
If a HotKey was detected, the controller will call the OnTriggered event and/or an attached TAction instance. | If a HotKey was detected, the controller will call the OnTriggered event and/or an attached TAction instance. | ||
- | You are allowed to setup your HotKeys at design- and at runtime. | + | You are allowed to setup your HotKeys at design- and runtime. |
+ | |||
+ | ==== LockTime ==== | ||
+ | Set the LockTime property (in milliseconds) to suppress a hotkey for a specific time. | ||
+ | Because input commands come very often, f.e. if a button on the gamepad was pressed. As long as you hold the button the system will recognize the hotkey for this button. | ||
+ | For sequence detection this may be a problem. Therefor we want to lock the gamepad hotkey for a certain time. | ||
==== DesignTime ==== | ==== DesignTime ==== | ||
Line 34: | Line 54: | ||
- Here we can now add a new **TGorillaHotKeyInputItem**. | - Here we can now add a new **TGorillaHotKeyInputItem**. | ||
- In the item select the " | - In the item select the " | ||
- | - and add the message input code | + | - and add the message input code (tables below) |
- Repeat it for any further inputs you wish to combine. | - Repeat it for any further inputs you wish to combine. | ||
==== Runtime ==== | ==== Runtime ==== | ||
Line 47: | Line 67: | ||
end; | end; | ||
+ | procedure TForm1.FormCreate(Sender: | ||
var | var | ||
FInput : TGorillaInputController; | FInput : TGorillaInputController; | ||
Line 60: | Line 81: | ||
LHotKey.AddInput(TGorillaInputDeviceType.Keyboard, | LHotKey.AddInput(TGorillaInputDeviceType.Keyboard, | ||
LHotKey.AddInput(TGorillaInputDeviceType.Keyboard, | LHotKey.AddInput(TGorillaInputDeviceType.Keyboard, | ||
+ | end; | ||
+ | | ||
+ | procedure TForm1.FormClose(Sender: | ||
+ | begin | ||
+ | FInput.DisposeOf(); | ||
+ | FInput := nil; | ||
+ | end; | ||
</ | </ | ||
- | |||
- | |||
===== Persistent Messages ===== | ===== Persistent Messages ===== | ||
- | Besides the HotKey settings the component supports persistent/continuously | + | Besides the HotKey settings the component supports persistent/continuous |
A persistent message is a continuously notified message from the system and not a temporary message like a click or key-press. | A persistent message is a continuously notified message from the system and not a temporary message like a click or key-press. | ||
+ | |||
+ | Persistent messages can not be notified by HotKeys. You need to request those separately. | ||
Supported persistent messages are: | Supported persistent messages are: | ||
Line 93: | Line 121: | ||
</ | </ | ||
- | ===== Input-Codes ===== | + | ===== Input-Codes |
- | All available InputCodes are defined in the Gorilla.Controller.Input.Consts unit. | + | All available InputCodes |
==== Keyboard ==== | ==== Keyboard ==== | ||
Line 247: | Line 275: | ||
</ | </ | ||
+ | __Notes:__ | ||
+ | You are allowed declare an input multiple times in a sequence. | ||
+ | |||
+ | Each sequence can hold up to 16 HotKeys. | ||
==== DesignTime ==== | ==== DesignTime ==== | ||
Line 280: | Line 312: | ||
</ | </ | ||
+ | Next: [[Pathfinding|Pathfinding]] |