Go to the documentation of this file.
6 #ifndef CNOID_UTIL_SHARED_JOYSTICK_H
7 #define CNOID_UTIL_SHARED_JOYSTICK_H
9 #include <cnoid/Referenced>
10 #include <cnoid/Joystick>
22 joystick = &defaultJoystick;
25 prevButtonState =
false;
29 this->joystick = joystick;
45 if(!prevButtonState && state){
47 if(mode_ >= numModes_){
51 prevButtonState = state;
69 return (fabs(pos) >= threshold) ? pos : 0.0;
72 double getPosition(
int targetMode,
int axis,
double threshold = 0.0)
const {
bool getButtonState(int targetMode, int button) const
Definition: SharedJoystick.h:80
@ LOGO_BUTTON
Definition: Joystick.h:55
double getPosition(int targetMode, int axis, double threshold=0.0) const
Definition: SharedJoystick.h:72
double getPosition(int axis, double threshold=0.0) const
Definition: SharedJoystick.h:67
Definition: Joystick.h:18
void updateState(int targetMode)
Definition: SharedJoystick.h:42
static const Joystick::ButtonID MODE_BUTTON1
Definition: SharedJoystick.h:18
SharedJoystick()
Definition: SharedJoystick.h:21
Definition: JoystickInterface.h:13
Definition: Referenced.h:103
void setJoystick(JoystickInterface *joystick)
Definition: SharedJoystick.h:28
static const Joystick::ButtonID MODE_BUTTON2
Definition: SharedJoystick.h:19
virtual bool readCurrentState()=0
Definition: AbstractSceneLoader.h:11
ButtonID
Definition: Joystick.h:44
@ SELECT_BUTTON
Definition: Joystick.h:51
bool getModeButtonState()
Definition: SharedJoystick.h:37
Definition: Referenced.h:54
void setMode(int id)
Definition: SharedJoystick.h:63
int mode() const
Definition: SharedJoystick.h:55
int addMode()
Definition: SharedJoystick.h:32
bool getButtonState(int button) const
Definition: SharedJoystick.h:76
Definition: SharedJoystick.h:14
bool isMode(int id) const
Definition: SharedJoystick.h:59
ref_ptr< SharedJoystick > SharedJoystickPtr
Definition: SharedJoystick.h:92
virtual double getPosition(int axis) const =0
virtual bool getButtonState(int button) const =0