Antkeeper
0.0.1
|
A virtual gamepad which generates gamepad-related input events. More...
#include <gamepad.hpp>
Public Member Functions | |
gamepad () | |
Constructs a gamepad input device. More... | |
void | set_activation_threshold (gamepad_axis axis, float min, float max) |
Sets the activation threshold for a gamepad axis. More... | |
void | set_response_curve (gamepad_axis axis, gamepad_response_curve curve) |
Sets the activation response curve of an axis. More... | |
void | set_left_deadzone_cross (bool cross) |
Sets the type of deadzone shape for the axes on the left stick. More... | |
void | set_right_deadzone_cross (bool cross) |
Sets the type of deadzone shape for the axes on the right stick. More... | |
void | set_left_deadzone_roundness (float roundness) |
Sets the roundness of the deadzone for the axes on the left stick. More... | |
void | set_right_deadzone_roundness (float roundness) |
Sets the roundness of the deadzone for the axes on the right stick. More... | |
void | press (gamepad_button button) |
Simulates a gamepad button press. More... | |
void | release (gamepad_button button) |
Simulates a gamepad button release. More... | |
void | move (gamepad_axis axis, float position) |
Simulates a gamepad axis movement. More... | |
::event::channel< gamepad_button_pressed_event > & | get_button_pressed_channel () noexcept |
Returns the channel through which gamepad button pressed events are published. More... | |
::event::channel< gamepad_button_released_event > & | get_button_released_channel () noexcept |
Returns the channel through which gamepad button released events are published. More... | |
::event::channel< gamepad_axis_moved_event > & | get_axis_moved_channel () noexcept |
Returns the channel through which gamepad axis moved events are published. More... | |
constexpr device_type | get_device_type () const noexcept override |
Returns device_type::gamepad. More... | |
![]() | |
void | connect () |
Simulates the device being connected. More... | |
void | disconnect () |
Simulates the device being disconnected. More... | |
bool | is_connected () const noexcept |
Returns true if the device is currently connected. More... | |
void | set_uuid (const ::uuid &id) |
Sets the universally unique identifier (UUID) of this input device. More... | |
const ::uuid & | get_uuid () const noexcept |
Returns the universally unique identifier (UUID) of this input device. More... | |
::event::channel< device_connected_event > & | get_connected_channel () noexcept |
Returns the channel through which device connected events are published. More... | |
::event::channel< device_disconnected_event > & | get_disconnected_channel () noexcept |
Returns the channel through which device disconnected events are published. More... | |
A virtual gamepad which generates gamepad-related input events.
Definition at line 48 of file gamepad.hpp.
input::gamepad::gamepad | ( | ) |
Constructs a gamepad input device.
Definition at line 28 of file gamepad.cpp.
|
inlinenoexcept |
Returns the channel through which gamepad axis moved events are published.
Definition at line 136 of file gamepad.hpp.
|
inlinenoexcept |
Returns the channel through which gamepad button pressed events are published.
Definition at line 124 of file gamepad.hpp.
|
inlinenoexcept |
Returns the channel through which gamepad button released events are published.
Definition at line 130 of file gamepad.hpp.
|
inlineconstexproverridevirtualnoexcept |
void input::gamepad::move | ( | gamepad_axis | axis, |
float | position | ||
) |
Simulates a gamepad axis movement.
axis | Gamepad axis. |
position | Position on the axis, on [-1, 1] . |
@TODO Support arbitrary number of gamepad axes.
Definition at line 80 of file gamepad.cpp.
void input::gamepad::press | ( | gamepad_button | button | ) |
Simulates a gamepad button press.
button | Button to press. |
Definition at line 70 of file gamepad.cpp.
void input::gamepad::release | ( | gamepad_button | button | ) |
Simulates a gamepad button release.
button | Button to release. |
Definition at line 75 of file gamepad.cpp.
void input::gamepad::set_activation_threshold | ( | gamepad_axis | axis, |
float | min, | ||
float | max | ||
) |
Sets the activation threshold for a gamepad axis.
axis | Gamepad axis. |
min | Axis minimum activation threshold. |
max | Axis maximum activation threshold. |
Definition at line 39 of file gamepad.cpp.
void input::gamepad::set_left_deadzone_cross | ( | bool | cross | ) |
Sets the type of deadzone shape for the axes on the left stick.
cross | If true , the x and y axes are independently activated, if false , activation of the x and y axes are dependent on their combined magnitude. |
Definition at line 50 of file gamepad.cpp.
void input::gamepad::set_left_deadzone_roundness | ( | float | roundness | ) |
Sets the roundness of the deadzone for the axes on the left stick.
roundness | Roundness of the deadzone shape for non-cross deadzones. A value of 0.0 results in a square deadzone, while a value of 1.0 results in a circular deadzone. Values between 0.0 and 1.0 result in a rounded rectangle deadzone. |
Definition at line 60 of file gamepad.cpp.
void input::gamepad::set_response_curve | ( | gamepad_axis | axis, |
gamepad_response_curve | curve | ||
) |
Sets the activation response curve of an axis.
axis | Gamepad axis. |
curve | Activation response curve. |
Definition at line 45 of file gamepad.cpp.
void input::gamepad::set_right_deadzone_cross | ( | bool | cross | ) |
Sets the type of deadzone shape for the axes on the right stick.
cross | If true , the x and y axes are independently activated, if false , activation of the x and y axes are dependent on their combined magnitude. |
Definition at line 55 of file gamepad.cpp.
void input::gamepad::set_right_deadzone_roundness | ( | float | roundness | ) |
Sets the roundness of the deadzone for the axes on the right stick.
roundness | Roundness of the deadzone shape for non-cross deadzones. A value of 0.0 results in a square deadzone, while a value of 1.0 results in a circular deadzone. Values between 0.0 and 1.0 result in a rounded rectangle deadzone. |
Definition at line 65 of file gamepad.cpp.