Appearance
JoystickAPI
cpp
#include <VAmiga.h>cpp
class JoystickAPIDefined in VAmiga.h:1541
API of a joystick.
Public Methods
| Return | Name | Description |
|---|---|---|
const JoystickConfig & | getConfig const | Returns the component's current configuration. |
const JoystickInfo & | getInfo const | Returns the component's current state. |
const JoystickInfo & | getCachedInfo const | Returns the most recent state snapshot recorded by the emulator thread (see getInfo()). |
void | trigger | Triggers a joystick action. |
void | trigger | Sets the complete joystick state. |
getConfig
const
cpp
const JoystickConfig & getConfig() constDefined in VAmiga.h:1551
Returns the component's current configuration.
getInfo
const
cpp
const JoystickInfo & getInfo() constDefined in VAmiga.h:1562
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 JoystickInfo & getCachedInfo() constDefined in VAmiga.h:1564
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).
trigger
cpp
void trigger(GamePadAction event)Defined in VAmiga.h:1568
Triggers a joystick action.
trigger
cpp
void trigger(const std::array< bool, 5 > & state, const std::array< bool, 5 > & previous)Defined in VAmiga.h:1580
Sets the complete joystick state.
The states are ordered up, down, left, right, fire. The directions are applied as given, which is harmless to repeat. The fire button is only forwarded if it differs in 'previous', because pressing it again would toggle autofire. Pass the state that was reported by the previous call.
Parameters
| Parameter | Type | Description |
|---|---|---|
state | const std::array< bool, 5 > & | The new states of up, down, left, right, and fire. |
previous | const std::array< bool, 5 > & | The previous states. |