Changeset 3270 for code/branches/core4/src/core/input/InputManager.h
- Timestamp:
- Jul 6, 2009, 12:03:05 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/core4/src/core/input/InputManager.h
r3196 r3270 54 54 namespace orxonox 55 55 { 56 /**57 @brief58 Helper class to realise a vector<int[4]>59 */60 class POVStates61 {62 public:63 int& operator[](unsigned int index) { return povStates[index]; }64 int povStates[4];65 };66 67 /**68 @brief69 Helper class to realise a vector< {int[4], int[4]} >70 */71 class SliderStates72 {73 public:74 IntVector2 sliderStates[4];75 };76 77 struct JoyStickCalibration78 {79 int middleValue[24];80 float positiveCoeff[24];81 float negativeCoeff[24];82 };83 84 56 struct InputStatePriority : OrxEnum<InputStatePriority> 85 57 { … … 101 73 class _CoreExport InputManager 102 74 : public OrxonoxClass, 103 public OIS::KeyListener, public OIS::MouseListener , public OIS::JoyStickListener75 public OIS::KeyListener, public OIS::MouseListener 104 76 { 105 77 // --> setConfigValues is private 106 78 friend class ClassIdentifier<InputManager>; 79 friend class JoyStick; 107 80 108 81 public: … … 115 88 Calibrating = 0x08, 116 89 ReloadRequest = 0x10, 117 JoyStickSupport = 0x20 // used with ReloadRequest to store a bool118 90 }; 119 91 120 InputManager ( );92 InputManager (size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight); 121 93 ~InputManager(); 122 94 123 void initialise(size_t windowHnd, int windowWidth, int windowHeight, bool joyStickSupport = true);124 125 void reloadInputSystem( bool joyStickSupport = true);95 void initialise(size_t windowHnd, unsigned int windowWidth, unsigned int windowHeight); 96 97 void reloadInputSystem(); 126 98 127 99 void clearBuffers(); … … 129 101 unsigned int numberOfKeyboards() { return keyboard_ ? 1 : 0; } 130 102 unsigned int numberOfMice() { return mouse_ ? 1 : 0; } 131 unsigned int numberOfJoySticks() { return joySticks Size_; }103 unsigned int numberOfJoySticks() { return joySticks_.size(); } 132 104 133 105 void setWindowExtents(const int width, const int height); … … 156 128 // console commands 157 129 static void calibrate(); 158 static void reload( bool joyStickSupport = true);130 static void reload(); 159 131 160 132 public: // variables 161 133 static EmptyHandler EMPTY_HANDLER; 162 static const unsigned int sliderAxes = 8; 134 135 private: // functions for friends 136 OIS::InputManager* getInputSystem() { return this->inputSystem_; } 137 bool checkJoyStickID(const std::string&); 163 138 164 139 private: // functions … … 168 143 // Intenal methods 169 144 void _initialiseKeyboard(); 170 void _initialiseMouse( );145 void _initialiseMouse(unsigned int windowWidth, unsigned int windowHeight); 171 146 void _initialiseJoySticks(); 172 147 void _configureJoySticks(); … … 181 156 void _destroyJoySticks(); 182 157 void _destroyState(InputState* state); 183 void _clearBuffers(); 184 185 void _reload(bool joyStickSupport); 158 159 void _reload(); 186 160 187 161 void _fireAxis(unsigned int iJoyStick, int axis, int value); … … 197 171 bool keyPressed (const OIS::KeyEvent &arg); 198 172 bool keyReleased (const OIS::KeyEvent &arg); 199 bool buttonPressed (const OIS::JoyStickEvent &arg, int button);200 bool buttonReleased(const OIS::JoyStickEvent &arg, int button);201 bool axisMoved (const OIS::JoyStickEvent &arg, int axis);202 bool sliderMoved (const OIS::JoyStickEvent &arg, int id);203 bool povMoved (const OIS::JoyStickEvent &arg, int id);204 // don't remove that! Or else add OIS as dependency library to orxonox.205 bool vector3Moved (const OIS::JoyStickEvent &arg, int id) { return true; }206 173 207 174 void setConfigValues(); … … 212 179 OIS::Keyboard* keyboard_; //!< OIS mouse 213 180 OIS::Mouse* mouse_; //!< OIS keyboard 214 std::vector<OIS::JoyStick*> joySticks_; //!< OIS joy sticks 215 unsigned int joySticksSize_; 216 std::vector<std::string> joyStickIDs_; //!< Execution unique identification strings for the joy sticks 181 std::vector<JoyStick*> joySticks_; //!< Orxonox joy sticks 217 182 unsigned int devicesNum_; 218 183 size_t windowHnd_; //!< Render window handle … … 234 199 std::vector<InputState*> activeStatesTicked_; 235 200 236 // joystick calibration237 std::vector<std::vector<int> > joyStickMinValues_;238 std::vector<std::vector<int> > joyStickMaxValues_;239 std::vector<std::vector<int> > joyStickMiddleValues_;240 std::vector<ConfigValueContainer*> calibrationConfigValueContainers_;241 std::vector<JoyStickCalibration> joyStickCalibrations_;242 243 201 unsigned int keyboardModifiers_; //!< Bit mask representing keyboard modifiers. 244 std::vector<POVStates> povStates_; //!< Keeps track of the joy stick POV states.245 std::vector<SliderStates> sliderStates_; //!< Keeps track of the possibly two slider axes.246 202 247 203 std::vector<Key> keysDown_; 248 std::vector<MouseButtonCode::ByEnum> mouseButtonsDown_; 249 std::vector<std::vector<JoyStickButtonCode::ByEnum> > joyStickButtonsDown_; 250 251 // ConfigValues 252 std::string calibrationFilename_; //!< Joy stick calibration ini filename 204 std::vector<MouseButtonCode::ByEnum> mouseButtonsDown_; 253 205 254 206 static InputManager* singletonRef_s;
Note: See TracChangeset
for help on using the changeset viewer.