Appearance
JoystickAPI
cpp
#include <VirtualC64.h>cpp
class JoystickAPIDefined in VirtualC64.h:987
Joystick Public API
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 VirtualC64.h:997
Returns the component's current configuration.
getInfo
const
cpp
const JoystickInfo & getInfo() constDefined in VirtualC64.h:1008
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 VirtualC64.h:1010
Returns the most recent state snapshot recorded by the emulator thread (see getInfo()).
trigger
cpp
void trigger(GamePadAction event)Defined in VirtualC64.h:1014
Triggers a joystick action.
trigger
cpp
void trigger(const std::array< bool, 5 > & state, const std::array< bool, 5 > & previous)Defined in VirtualC64.h:1026
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. |