Appearance
KeyboardAPI
cpp
#include <VAmiga.h>cpp
class KeyboardAPIDefined in VAmiga.h:1589
API of the keyboard.
Public Methods
| Return | Name | Description |
|---|---|---|
const KeyboardConfig & | getConfig const | Returns the component's current configuration. |
const KeyboardInfo & | getInfo const | Returns the component's current state. |
const KeyboardInfo & | getCachedInfo const | Returns the most recent state snapshot recorded by the emulator thread (see getInfo()). |
bool | isPressed const | Checks if a key is currently pressed. |
void | press | Presses a key. |
void | toggle | Toggles a key. |
void | release | Releases a key. |
void | releaseAll | Releases all currently pressed keys. |
bool | isLocked const | Checks if a key is currently locked. |
void | lock | Locks a key. A locked key stays down until it is unlocked, even if release() is called on it. |
void | unlock | Unlocks a previously locked key. |
void | abortTyping | Deletes all pending keyboard events. |
getConfig
const
cpp
const KeyboardConfig & getConfig() constDefined in VAmiga.h:1599
Returns the component's current configuration.
getInfo
const
cpp
const KeyboardInfo & getInfo() constDefined in VAmiga.h:1610
Returns the component's current state.
getInfo() reads the live state on the calling thread. The result is only consistent if the emulator is paused or suspended. getCachedInfo() returns the snapshot the emulator thread has recorded most recently, which is the one to use while the emulator runs. Both return references that can be overwritten by a later call or by the emulator thread, so copy the data if you need to keep it.
getCachedInfo
const
cpp
const KeyboardInfo & getCachedInfo() constDefined in VAmiga.h:1612
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).
isPressed
const
cpp
bool isPressed(KeyCode key) constDefined in VAmiga.h:1617
Checks if a key is currently pressed.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to check. |
press
cpp
void press(KeyCode key, double delay = 0.0, double duration = 0.0)Defined in VAmiga.h:1624
Presses a key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to press. |
delay | double | An optional delay in seconds until the key is pressed. |
duration | double | If specified, the key will be automatically released. |
toggle
cpp
void toggle(KeyCode key, double delay = 0.0, double duration = 0.0)Defined in VAmiga.h:1631
Toggles a key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to toggle. |
delay | double | An optional delay in seconds until the key is toggled. |
duration | double | If specified, the key will be toggled again after the additional delay. |
release
cpp
void release(KeyCode key, double delay = 0.0)Defined in VAmiga.h:1637
Releases a key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to release. |
delay | double | An optional delay in seconds. |
releaseAll
cpp
void releaseAll(double delay = 0.0)Defined in VAmiga.h:1642
Releases all currently pressed keys.
Parameters
| Parameter | Type | Description |
|---|---|---|
delay | double | An optional delay in seconds. |
isLocked
const
cpp
bool isLocked(KeyCode key) constDefined in VAmiga.h:1647
Checks if a key is currently locked.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to check. |
lock
cpp
void lock(KeyCode key, double delay = 0.0)Defined in VAmiga.h:1654
Locks a key. A locked key stays down until it is unlocked, even if release() is called on it.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to lock. |
delay | double | An optional delay in seconds until the key is locked. |
unlock
cpp
void unlock(KeyCode key, double delay = 0.0)Defined in VAmiga.h:1660
Unlocks a previously locked key.
Parameters
| Parameter | Type | Description |
|---|---|---|
key | KeyCode | The key to unlock. |
delay | double | An optional delay in seconds until the key is unlocked. |
abortTyping
cpp
void abortTyping()Defined in VAmiga.h:1664
Deletes all pending keyboard events.