Cheetah Software
1.0
|
#include <GameController.h>
Public Member Functions | |
GameController (QObject *parent=0) | |
void | updateGamepadCommand (GamepadCommand &gamepadCommand) |
void | findNewController () |
~GameController () | |
Private Attributes | |
QGamepad * | _qGamepad = nullptr |
Definition at line 17 of file GameController.h.
|
explicit |
By default, the game controller selects the "first" joystick, printing a warning if there are multiple joysticks On Linux, this is /dev/input/js0 If no joystick is found, it will print an error message, and will return zero. It is possible to change/add a joystick later with findNewController
Definition at line 22 of file GameController.cpp.
References findNewController().
GameController::~GameController | ( | ) |
void GameController::findNewController | ( | ) |
Re-run the joystick finding code to select the "first" joystick. This can be used to set up the joystick if the simulator is started without a joystick plugged in
Definition at line 31 of file GameController.cpp.
References _qGamepad.
void GameController::updateGamepadCommand | ( | GamepadCommand & | gamepadCommand | ) |
Overwrite a driverCommand with the current joystick state. If there's no joystick, sends zeros TODO: what happens if the joystick is unplugged?
Definition at line 59 of file GameController.cpp.
References _qGamepad, GamepadCommand::a, GamepadCommand::b, GamepadCommand::back, GamepadCommand::leftBumper, GamepadCommand::leftStickAnalog, GamepadCommand::leftStickButton, GamepadCommand::leftTriggerAnalog, GamepadCommand::leftTriggerButton, GamepadCommand::rightBumper, GamepadCommand::rightStickAnalog, GamepadCommand::rightStickButton, GamepadCommand::rightTriggerAnalog, GamepadCommand::rightTriggerButton, GamepadCommand::start, GamepadCommand::x, GamepadCommand::y, and GamepadCommand::zero().
|
private |
Definition at line 26 of file GameController.h.