A device abstracting a gamepad controller.
More...
A device abstracting a gamepad controller.
First implemented on modern gamepads, making its interface following more closely their design. Typical usage looks like :
◆ GamepadDevice()
| nkInputs::GamepadDevice::GamepadDevice |
( |
System * |
system | ) |
|
|
noexcept |
Constructor. Used internally, for creation the create() method should be called.
- Parameters
-
| system | The system to link the device to. |
◆ ~GamepadDevice()
| virtual nkInputs::GamepadDevice::~GamepadDevice |
( |
| ) |
|
|
virtual |
◆ getSystem()
| System* nkInputs::GamepadDevice::getSystem |
( |
| ) |
const |
- Returns
- The system the device is linked to.
◆ getLeftJoystickStatus()
- Returns
- The current left joystick's status.
◆ getRightJoystickStatus()
- Returns
- The current right joystick's status.
◆ getLeftTriggerStatus()
| virtual float nkInputs::GamepadDevice::getLeftTriggerStatus |
( |
| ) |
const |
|
pure virtual |
- Returns
- The current left trigger's status.
◆ getRightTriggerStatus()
| virtual float nkInputs::GamepadDevice::getRightTriggerStatus |
( |
| ) |
const |
|
pure virtual |
- Returns
- The current right trigger's status.
◆ isButtonDown()
- Parameters
-
| button | The button which state should be retrieved. |
- Returns
- Whether the button is down, or pressed (true) or not (false).
◆ setGamepadSlot()
| virtual void nkInputs::GamepadDevice::setGamepadSlot |
( |
unsigned int |
v | ) |
|
|
pure virtual |
Sets the gamepad slot the device should track. Modern gamepads connect to four different slots that can be tracked by using their index within [0, 3]. Defaults to 0.
- Parameters
-
| v | The gamepad slot to use. |
◆ setLeftJoystickDeadzone()
| virtual void nkInputs::GamepadDevice::setLeftJoystickDeadzone |
( |
float |
v | ) |
|
|
pure virtual |
Sets the deadzone the left joystick should use. The deadzone corresponds to the amplitude of movement from the stick that won't trigger any reaction from the device. Defaults to 0.239.
- Parameters
-
| v | The value for the deadzone, between [0, 1]. |
◆ setRightJoystickDeadzone()
| virtual void nkInputs::GamepadDevice::setRightJoystickDeadzone |
( |
float |
v | ) |
|
|
pure virtual |
Sets the deadzone the right joystick should use. The deadzone corresponds to the amplitude of movement from the stick that won't trigger any reaction from the device. Defaults to 0.265.
- Parameters
-
| v | The value for the deadzone, between [0, 1]. |
◆ setTriggersDeadzone()
| virtual void nkInputs::GamepadDevice::setTriggersDeadzone |
( |
float |
v | ) |
|
|
pure virtual |
Sets the deadzone the triggers should use. The deadzone corresponds to the amplitude of movement from the triggers that won't trigger any reaction from the device. Defaults to 0.117.
- Parameters
-
| v | The value for the deadzone, between [0, 1]. |
◆ setLeftMotorVibration()
| virtual void nkInputs::GamepadDevice::setLeftMotorVibration |
( |
float |
v | ) |
|
|
pure virtual |
Sets the vibration level for the left motor. On modern gamepads, the left motor corresponds to the low frequency vibrations.
- Parameters
-
| v | The strength for the vibration, between [0, 1]. |
◆ setRightMotorVibration()
| virtual void nkInputs::GamepadDevice::setRightMotorVibration |
( |
float |
v | ) |
|
|
pure virtual |
Sets the vibration level for the right motor. On modern gamepads, the right motor corresponds to the high frequency vibrations.
- Parameters
-
| v | The strength for the vibration, between [0, 1]. |
◆ update()
| virtual void nkInputs::GamepadDevice::update |
( |
| ) |
|
|
pure virtual |
Updates the device to gather its latest status.
◆ create()
Creates a standalone device, linking it to a system, but no manager. This method can be used to allocate a device and manually manage its lifetime.
- Parameters
-
| system | The system to create the device into. If left to nullptr, then the Singleton instance will be used. |
- Returns
- The created device instance.
The documentation for this class was generated from the following file: