vulp
2.2.2
|
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... | |
Public Member Functions inherited from vulp::observation::Source | |
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 27 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 8 of file Joystick.cpp.
|
override |
Close device file.
Definition at line 16 of file Joystick.cpp.
|
inlinefinalvirtualnoexcept |
Prefix of output in the observation dictionary.
Reimplemented from vulp::observation::Source.
Definition at line 42 of file Joystick.h.
|
inlinenoexcept |
Check if the device file was opened successfully.
Definition at line 39 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 115 of file Joystick.cpp.