vulp
1.4.0
|
Source for a joystick controller. More...
#include <Joystick.h>
Public Member Functions | |
Joystick (const std::string &device_path="/dev/input/js0") | |
Open the device file. More... | |
~Joystick () override | |
Close device file. More... | |
bool | present () const noexcept |
Check if the device file was opened successfully. More... | |
std::string | prefix () const noexcept final |
Prefix of output in the observation dictionary. More... | |
void | write (Dictionary &output) final |
Write output to a dictionary. More... | |
![]() | |
virtual | ~Source () |
Destructor is virtual to deallocate lists of observers properly. More... | |
Source for a joystick controller.
Axes are the same for PS4 and Xbox controllers, but buttons differ slightly. See comments in read for the exact mapping.
Definition at line 40 of file Joystick.h.
vulp::observation::sources::Joystick::Joystick | ( | const std::string & | device_path = "/dev/input/js0" | ) |
Open the device file.
[in] | device_path | Path to the joystick device file. |
Definition at line 21 of file Joystick.cpp.
|
override |
Close device file.
Definition at line 29 of file Joystick.cpp.
|
inlinefinalvirtualnoexcept |
Prefix of output in the observation dictionary.
Reimplemented from vulp::observation::Source.
Definition at line 55 of file Joystick.h.
|
inlinenoexcept |
Check if the device file was opened successfully.
Definition at line 52 of file Joystick.h.
|
finalvirtual |
Write output to a dictionary.
[out] | output | Dictionary to write observations to. |
Reimplemented from vulp::observation::Source.
Definition at line 128 of file Joystick.cpp.