Castle Game Engine: CastleKeysMouse: Class TKeysPressed

# Class TKeysPressed
Description | Hierarchy | Fields | Methods | Properties
## Unit CastleKeysMouse ## Declaration `type TKeysPressed = class(TObject)` ## Description Tracking the "pressed" state of keys. Allows you to query is key (TKey) pressed, and is some character (Char type) pressed. ## Hierarchy TObject TKeysPressed ## Overview ### Fields
| `Keys: TKeysBooleans;`
| `Characters: TCharactersBooleans;`
### Methods
| `function Modifiers: TModifierKeys;`
| `procedure KeyDown(const Key: TKey; const CharKey: char);`
| `procedure KeyUp(const Key: TKey; out CharKey: char);`
| `procedure Clear;`
### Properties
| `property Items [Key:TKey]: boolean read GetItems;`
## Description ### Fields
| `Keys: TKeysBooleans;`
Check is a key (TKey) pressed. This array is read-only from outside of this class! Always Keys[K_None] = false.
| `Characters: TCharactersBooleans;`
Check is a character pressed. This array is read-only from outside of this class! Always Characters[#0] = false. Note that since a given character may be generated by various key combinations, this doesn't work as reliably as Keys array. For example, consider pressing a, then shift, then releasing a — for a short time character 'A', and not 'a', should be pressed. Although we do our best (have some mapping tables to track characters), and in practice this works Ok. But still checking for keys on Keys array, when possible, is advised.
### Methods
| `function Modifiers: TModifierKeys;`
Check which modifier keys are pressed. The result it based on current Keys[K_Ctrl], Keys[K_Shift] etc. values.
| `procedure KeyDown(const Key: TKey; const CharKey: char);`
Call when key is pressed. Pass TKey, and corresponding character (Char). Pass Key = K_None if this is not representable as TKey, pass CharKey = #0 if this is not representable as char. But never pass both Key = K_None and CharKey = #0 (this would have no meaning).
| `procedure KeyUp(const Key: TKey; out CharKey: char);`
Call when key is released. Never pass Key = K_None here. It returns which character was released as a consequence of this key release.
| `procedure Clear;`
Mark all keys as released. That is, this sets all Keys and Characters items to `False`. Also resets internal arrays used to track Characters from KeyDown and KeyUp.
### Properties
| `property Items [Key:TKey]: boolean read GetItems;`
Check is a key (TKey) pressed. Returns the same values as are in the Keys table. Although this is more comfortable: it's a default property of this class, so you can write simply `KeysPressed[K_X]` instead of `KeysPressed.Keys[K_X]`.
Generated by PasDoc 0.13.0 on 2015-06-15 04:43:10