TSdlKeyboard
Represents a keyboard.
Definition
Unit: Neslib.Sdl3.Input
Properties
Name | Description |
---|---|
Focus | The window which currently has keyboard focus. |
HasKeyboard | Whether a keyboard is currently connected. |
HasScreenKeyboardSupport | Whether the platform has screen keyboard support. |
Keyboards | A list of currently connected keyboards. |
ModState | The current key modifier state for the keyboard. |
Name | The name of the keyboard. |
State | Get a snapshot of the current state of the keyboard. |
Operators
Name | Description |
---|---|
Equal(TSdlKeyboard, TSdlKeyboard) | Used to compare against another TSdlKeyboard. |
Equal(TSdlKeyboard, Pointer) | Used to compare against nil . |
Implicit | Used to set the value to nil . |
NotEqual(TSdlKeyboard, TSdlKeyboard) | Used to compare against another TSdlKeyboard. |
NotEqual(TSdlKeyboard, Pointer) | Used to compare against nil . |
Methods
Name | Description |
---|---|
Reset | Clear the state of the keyboard. |
Property Descriptions
Focus
The window which currently has keyboard focus.
class property Focus: TSdlWindow read GetFocus
Type: TSdlWindow
Remarks
This property should only be used on the main thread.
HasKeyboard
Whether a keyboard is currently connected.
class property HasKeyboard: Boolean read GetHasKeyboard
Type: Boolean
See Also
Remarks
This property should only be used on the main thread.
HasScreenKeyboardSupport
Whether the platform has screen keyboard support.
class property HasScreenKeyboardSupport: Boolean read GetHasScreenKeyboardSupport
Type: Boolean
See Also
Remarks
This property should only be used on the main thread.
Keyboards
A list of currently connected keyboards.
Note that this will include any device or virtual driver that includes keyboard functionality, including some mice, KVM switches, motherboard power buttons, etc. You should wait for input from a device before you consider it actively in use.
class property Keyboards: TArray<TSdlKeyboard> read GetKeyboards
Type: TArray<TSdlKeyboard>
Exceptions
ESdlError
: Raised on failure.
See Also
Remarks
This property should only be used on the main thread.
ModState
The current key modifier state for the keyboard.
You can also set this state. This allows you to impose modifier key states on your application. This does not change the keyboard state, only the key modifier flags that SDL reports.
class property ModState: TSdlKeyMods read GetModState write SetModState
Type: TSdlKeyMods
See Also
Remarks
It is safe to use this property from any thread.
Name
The name of the keyboard.
Returns an empty string if the keyboard doesn't have a name.
property Name: String read GetName
Type: String
Exceptions
ESdlError
: Raised on failure.
See Also
Remarks
This property should only be used on the main thread.
State
Get a snapshot of the current state of the keyboard.
TSdlEvents.Pump to update the state array.
This property gives you the current state after all events have been processed, so if a key or button has been pressed and released before you process events, then the pressed state will never show up in this property.
Note: This property doesn't take into account whether shift has been pressed or not.
class property State: TSdlKeyboardState read GetState
Type: TSdlKeyboardState
See Also
Remarks
It is safe to use this property from any thread.
Operator Descriptions
Equal(TSdlKeyboard, TSdlKeyboard)
Used to compare against another TSdlKeyboard.
class operator Equal(const ALeft, ARight: TSdlKeyboard): Boolean; inline; static
Parameters
ALeft
: TSdlKeyboard
ARight
: TSdlKeyboard
Returns
Boolean
Equal(TSdlKeyboard, Pointer)
Used to compare against nil
.
class operator Equal(const ALeft: TSdlKeyboard; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TSdlKeyboard
ARight
: Pointer
Returns
Boolean
Implicit(Pointer)
Used to set the value to nil
.
class operator Implicit(const AValue: Pointer): TSdlKeyboard; inline; static
Parameters
AValue
: Pointer
Returns
NotEqual(TSdlKeyboard, TSdlKeyboard)
Used to compare against another TSdlKeyboard.
class operator NotEqual(const ALeft, ARight: TSdlKeyboard): Boolean; inline; static
Parameters
ALeft
: TSdlKeyboard
ARight
: TSdlKeyboard
Returns
Boolean
NotEqual(TSdlKeyboard, Pointer)
Used to compare against nil
.
class operator NotEqual(const ALeft: TSdlKeyboard; const ARight: Pointer): Boolean; inline; static
Parameters
ALeft
: TSdlKeyboard
ARight
: Pointer
Returns
Boolean
Method Descriptions
Reset
Clear the state of the keyboard.
This method will generate key up events for all pressed keys.
class procedure Reset; inline; static
See Also
Remarks
This method should only be called on the main thread.