Marine systems simulation
GenericGamepadInput.h
1#ifndef _CGENERICGAMEPADINPUT_H_
2#define _CGENERICGAMEPADINPUT_H_
3#include <string>
4#include <SimObject.h>
5
10#ifdef FH_VISUALIZATION
11#pragma warning(push)
12#pragma warning( disable : 4251 )
13 #include <ois/OIS.h>
14#pragma warning(pop)
15#endif
16
17namespace Ship{
18 #ifdef FH_VISUALIZATION
19 class GenericGamepadInput: public SimObject, OIS::JoyStickListener{
20 #else
21 class GenericGamepadInput: public SimObject{
22 #endif
23 public:
24 enum button_index{
25 BUTTON1 = 0,//< Cross
26 BUTTON2, //< Circle
27 BUTTON3, //< Square
28 BUTTON4, //< Triangle
29 BUTTON5, //< L1
30 BUTTON6, //< R1
31 BUTTON7, //< Select
32 BUTTON8, //< Start
33 BUTTON9, //< Left analog button
34 BUTTON10, //< Right analog button
35 NUMBUTTON
36 };
37
38 enum axes_index{
39 XAXIS=0,//< Vertical left analog
40 YAXIS, //< Horizontal left analog
41 ZAXIS,// L2/R2
42 NUMAXIS
43 };
44
45 enum rotation_index{
46 ROTATION_X,// Vertical right analog
47 ROTATION_Y,// horizontal right analog
48 NUMROTATION
49 };
50
51 enum pov_index{
52 POV_VERTICAL,
53 POV_HORIZONTAL,
54 NUM_POV
55 };
56
57 GenericGamepadInput(const std::string simObjectName, ISimObjectCreator* const creator);
58
59 void OdeFcn(const double T, const double *const X, double *const XDot, const bool IsMajorTimeStep);
60
61#ifdef FH_VISUALIZATION
62 virtual void RenderInit(Ogre::Root* const ogreRoot, ISimObjectCreator* const creator);
63 virtual void RenderUpdate( const double T, const double* const X );
64 bool buttonPressed(const OIS::JoyStickEvent &arg, int button);
65 bool buttonReleased(const OIS::JoyStickEvent &arg, int button);
66 bool axisMoved(const OIS::JoyStickEvent &arg, int axis);
67 bool povMoved(const OIS::JoyStickEvent &arg, int index);
68#endif
69 const double *XAxis(const double T, const double* const X); ; //< Vertical left analog
70 const double *YAxis(const double T, const double* const X); ; //< Horizontal left analog
71 const double *ZAxis(const double T, const double* const X); ; // L2/R2
72 const double *XAxisrotation(const double T, const double* const X); ; // Vertical right analog
73 const double *YAxisrotation(const double T, const double* const X); ; // horizontal right analog
74
75 const double *POVVertical(const double T, const double* const X); ; // Vertical d-pad
76 const double *POVHorizontal(const double T, const double* const X); ; // horizontal d-pad
77
78 const double *XDotAxis(const double T, const double* const X); ; //< Vertical left analog
79 const double *YDotAxis(const double T, const double* const X); ; //< Horizontal left analog
80 const double *ZDotAxis(const double T, const double* const X); ; // L2/R2
81 const double *XDotAxisrotation(const double T, const double* const X); ; // Vertical right analog
82 const double *YDotAxisrotation(const double T, const double* const X); ; // horizontal right analog
83
84 const double *XIntAxis(const double T, const double* const X); ; //< Vertical left analog
85 const double *YIntAxis(const double T, const double* const X); ; //< Horizontal left analog
86 const double *ZIntAxis(const double T, const double* const X); ; // L2/R2
87 const double *XIntAxisrotation(const double T, const double* const X); ; // Vertical right analog
88 const double *YIntAxisrotation(const double T, const double* const X); ; // horizontal right analog
89 const double *POVIntVertical(const double T, const double* const X); ; // Vertical d-pad
90 const double *POVIntHorizontal(const double T, const double* const X); ; // horizontal d-pad
91
92 const double *Button1(const double T, const double* const X); //< Cross
93 const double *Button2(const double T, const double* const X); //< Circle
94 const double *Button3(const double T, const double* const X); //< Square
95 const double *Button4(const double T, const double* const X); //< Triangle
96 const double *Button5(const double T, const double* const X); //< L1
97 const double *Button6(const double T, const double* const X); //< R1
98 const double *Button7(const double T, const double* const X); //< Select
99 const double *Button8(const double T, const double* const X); //< Start
100 const double *Button9(const double T, const double* const X); //< Left analog button
101 const double *Button10(const double T, const double* const X);//< Right analog button
102
103 const double *AxisVector(const double T, const double* const X); ; //< Vertical left analog
104 const double *RotationVector(const double T, const double* const X); ; //< Vertical left analog
105 const double *ButtonVector(const double T, const double* const X); ; //< Vertical left analog
106
107 private:
108 bool m_stickButtons;
109 double m_invertVertical;
110
111 double m_axis[NUMAXIS];
112 double m_dotAxis[NUMAXIS];
113 double m_intAxis[NUMAXIS];
114 int m_stateAxis[NUMAXIS];
115 double m_rotation[NUMROTATION];
116 double m_dotRotation[NUMROTATION];
117 double m_intRotation[NUMROTATION];
118 int m_stateRotation[NUMROTATION];
119 double m_button[NUMBUTTON];
120 double m_pov[NUM_POV];
121 int m_statePov[NUM_POV];
122 };
123}
124#endif
Definition: GenericGamepadInput.h:21
Simple waypoint object.
Definition: CableAttach.h:16