Changeset 3196 for code/trunk/src/core/input
- Timestamp:
- Jun 20, 2009, 9:20:47 AM (15 years ago)
- Location:
- code/trunk
- Files:
-
- 2 deleted
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/pch (added) merged: 3114-3118,3124-3125,3127-3131,3133,3138-3194
- Property svn:mergeinfo changed
-
code/trunk/src/core/input/CMakeLists.txt
r2710 r3196 1 1 ADD_SOURCE_FILES(CORE_SRC_FILES 2 2 Button.cc 3 CalibratorCallback.cc4 3 ExtendedInputState.cc 5 4 HalfAxis.cc -
code/trunk/src/core/input/ExtendedInputState.cc
r2896 r3196 36 36 37 37 #include <cassert> 38 #include " util/Debug.h"38 #include "core/Executor.h" 39 39 40 40 namespace orxonox … … 457 457 this->bHandlersChanged_ = true; 458 458 } 459 460 void ExtendedInputState::onEnter() 461 { 462 if (executorOnEnter_) 463 (*executorOnEnter_)(); 464 } 465 466 void ExtendedInputState::onLeave() 467 { 468 if (executorOnLeave_) 469 (*executorOnLeave_)(); 470 } 459 471 } -
code/trunk/src/core/input/ExtendedInputState.h
r2896 r3196 38 38 39 39 #include <vector> 40 41 40 #include "InputInterfaces.h" 42 41 #include "InputState.h" … … 89 88 void update(); 90 89 90 void onEnter(); 91 void onLeave(); 92 91 93 std::vector<KeyHandler*> keyHandlers_; 92 94 std::vector<MouseHandler*> mouseHandlers_; -
code/trunk/src/core/input/HalfAxis.h
r2087 r3196 37 37 38 38 #include "core/CorePrereqs.h" 39 39 40 #include "Button.h" 40 41 #include "InputCommands.h" -
code/trunk/src/core/input/InputBuffer.cc
r2896 r3196 28 28 29 29 #include "InputBuffer.h" 30 31 #include <iostream>32 30 33 31 #include "util/Clipboard.h" … … 57 55 } 58 56 59 InputBuffer::InputBuffer(const std::string allowedChars)57 InputBuffer::InputBuffer(const std::string& allowedChars) 60 58 { 61 59 RegisterRootObject(InputBuffer); -
code/trunk/src/core/input/InputBuffer.h
r2896 r3196 32 32 #include "core/CorePrereqs.h" 33 33 34 #include <list> 34 35 #include <string> 35 #include <list>36 37 36 #include "core/OrxonoxClass.h" 38 37 #include "InputInterfaces.h" … … 80 79 InputBuffer(); 81 80 ~InputBuffer(); 82 InputBuffer(const std::string allowedChars);81 InputBuffer(const std::string& allowedChars); 83 82 84 83 void setConfigValues(); … … 145 144 void updated(const char& update, bool bSingleInput); 146 145 147 inline std::stringget() const146 inline const std::string& get() const 148 147 { return this->buffer_; } 149 148 inline unsigned int getSize() const -
code/trunk/src/core/input/InputCommands.cc
r2087 r3196 35 35 #include "InputCommands.h" 36 36 #include "util/Math.h" 37 #include "core/CommandExecutor.h"38 37 39 38 namespace orxonox -
code/trunk/src/core/input/InputInterfaces.h
r2896 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include "ois/OISKeyboard.h"41 #include "ois/OISMouse.h"42 #include "ois/OISJoyStick.h"40 #include <ois/OISKeyboard.h> 41 #include <ois/OISMouse.h> 42 #include <ois/OISJoyStick.h> 43 43 #include "util/Math.h" 44 44 -
code/trunk/src/core/input/InputManager.cc
r3084 r3196 38 38 #include <climits> 39 39 #include <cassert> 40 41 #include "ois/OISException.h" 42 #include "ois/OISInputManager.h" 43 #include "core/ConsoleCommand.h" 44 45 // HACK 46 #ifdef ORXONOX_PLATFORM_LINUX 47 # include "ois/linux/LinuxMouse.h" 48 #endif 49 40 #include <ois/OISException.h> 41 #include <ois/OISInputManager.h> 42 43 #include "util/Convert.h" 50 44 #include "util/Exception.h" 45 #include "util/Debug.h" 51 46 #include "core/Clock.h" 52 47 #include "core/CoreIncludes.h" 53 48 #include "core/ConfigValueIncludes.h" 54 #include "core/Co mmandExecutor.h"49 #include "core/ConsoleCommand.h" 55 50 #include "core/CommandLine.h" 56 #include "util/Debug.h"57 51 58 52 #include "InputBuffer.h" 59 #include "KeyBinder.h"60 53 #include "KeyDetector.h" 61 #include "CalibratorCallback.h"62 54 #include "InputState.h" 63 55 #include "SimpleInputState.h" 64 56 #include "ExtendedInputState.h" 65 57 #include "JoyStickDeviceNumberListener.h" 58 59 // HACK (include this as last, X11 seems to define some macros...) 60 #ifdef ORXONOX_PLATFORM_LINUX 61 # include <ois/linux/LinuxMouse.h> 62 #endif 66 63 67 64 namespace orxonox … … 367 364 for (unsigned int i = 0; i < configValueVectorSize; ++i) 368 365 { 369 list[i] = omni_cast<int>(ConfigFileManager::getInstance().getValue(370 ConfigFileType::JoyStickCalibration, sectionName, valueName, i, omni_cast<std::string>(defaultValue), false));366 list[i] = multi_cast<int>(ConfigFileManager::getInstance().getValue( 367 ConfigFileType::JoyStickCalibration, sectionName, valueName, i, multi_cast<std::string>(defaultValue), false)); 371 368 } 372 369 … … 403 400 // Generate some sort of execution unique id per joy stick 404 401 std::string id = "JoyStick_"; 405 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Button)) + "_";406 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Axis)) + "_";407 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Slider)) + "_";408 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_POV)) + "_";409 id += omni_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Vector3)) + "_";402 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Button)) + "_"; 403 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Axis)) + "_"; 404 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Slider)) + "_"; 405 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_POV)) + "_"; 406 id += multi_cast<std::string>(joySticks_[iJoyStick]->getNumberOfComponents(OIS::OIS_Vector3)) + "_"; 410 407 id += joySticks_[iJoyStick]->vendor(); 411 408 for (unsigned int i = 0; i < iJoyStick; ++i) … … 414 411 { 415 412 // Two joysticks are probably equal --> add the index as well 416 id += "_" + omni_cast<std::string>(iJoyStick);413 id += "_" + multi_cast<std::string>(iJoyStick); 417 414 } 418 415 } … … 497 494 joyStickMinValues_[iJoyStick][i] = -32768; 498 495 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 499 this->joyStickIDs_[iJoyStick], "MinValue", i, omni_cast<std::string>(joyStickMinValues_[iJoyStick][i]), false);496 this->joyStickIDs_[iJoyStick], "MinValue", i, multi_cast<std::string>(joyStickMinValues_[iJoyStick][i]), false); 500 497 501 498 // Maximum values … … 503 500 joyStickMaxValues_[iJoyStick][i] = 32767; 504 501 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 505 this->joyStickIDs_[iJoyStick], "MaxValue", i, omni_cast<std::string>(joyStickMaxValues_[iJoyStick][i]), false);502 this->joyStickIDs_[iJoyStick], "MaxValue", i, multi_cast<std::string>(joyStickMaxValues_[iJoyStick][i]), false); 506 503 507 504 // Middle values 508 505 ConfigFileManager::getInstance().setValue(ConfigFileType::JoyStickCalibration, 509 this->joyStickIDs_[iJoyStick], "MiddleValue", i, omni_cast<std::string>(joyStickMiddleValues_[iJoyStick][i]), false);506 this->joyStickIDs_[iJoyStick], "MiddleValue", i, multi_cast<std::string>(joyStickMiddleValues_[iJoyStick][i]), false); 510 507 } 511 508 } … … 1169 1166 else 1170 1167 { 1171 float fValue = value - joyStickCalibrations_[iJoyStick].middleValue[axis];1168 float fValue = static_cast<float>(value - joyStickCalibrations_[iJoyStick].middleValue[axis]); 1172 1169 if (fValue > 0.0f) 1173 1170 fValue *= joyStickCalibrations_[iJoyStick].positiveCoeff[axis]; -
code/trunk/src/core/input/InputManager.h
r3084 r3196 40 40 41 41 #include <map> 42 #include <set> 43 #include <string> 42 44 #include <vector> 43 #include <stack> 45 #include <ois/OISKeyboard.h> 46 #include <ois/OISMouse.h> 47 #include <ois/OISJoyStick.h> 48 44 49 #include "util/Math.h" 45 50 #include "util/OrxEnum.h" -
code/trunk/src/core/input/InputState.h
r2896 r3196 39 39 #include <string> 40 40 #include <vector> 41 #include "core/Executor.h"42 41 #include "InputInterfaces.h" 43 42 … … 63 62 void resetHandlersChanged() { bHandlersChanged_ = false; } 64 63 65 virtual void onEnter() { if (executorOnEnter_) (*executorOnEnter_)(); }66 virtual void onLeave() { if (executorOnLeave_) (*executorOnLeave_)(); }64 virtual void onEnter() = 0; 65 virtual void onLeave() = 0; 67 66 68 67 virtual void registerOnEnter(Executor* executor) { executorOnEnter_ = executor; } … … 92 91 InputState() 93 92 : bHandlersChanged_(false) 93 , executorOnEnter_(0) 94 , executorOnLeave_(0) 94 95 , priority_(0) 95 96 , bAlwaysGetsInput_(false) 96 97 , bTransparent_(false) 97 , executorOnEnter_(0)98 , executorOnLeave_(0)99 98 { } 100 99 virtual ~InputState() { } … … 108 107 109 108 bool bHandlersChanged_; 109 Executor* executorOnEnter_; 110 Executor* executorOnLeave_; 110 111 111 112 private: … … 123 124 bool bAlwaysGetsInput_; 124 125 bool bTransparent_; 125 126 Executor* executorOnEnter_;127 Executor* executorOnLeave_;128 126 }; 129 127 } -
code/trunk/src/core/input/KeyBinder.cc
r2896 r3196 33 33 34 34 #include "KeyBinder.h" 35 36 #include <fstream>37 #include <string>38 35 39 36 #include "util/Convert.h" … … 320 317 { 321 318 mouseAxes_[2*i + 0].absVal_ 322 = -mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;319 = -mouseRelative_[i] / deriveTime_ * 0.0005f * mouseSensitivityDerived_; 323 320 mouseAxes_[2*i + 1].absVal_ = 0.0f; 324 321 } … … 327 324 mouseAxes_[2*i + 0].absVal_ = 0.0f; 328 325 mouseAxes_[2*i + 1].absVal_ 329 = mouseRelative_[i] / deriveTime_ * 0.0005 * mouseSensitivityDerived_;326 = mouseRelative_[i] / deriveTime_ * 0.0005f * mouseSensitivityDerived_; 330 327 } 331 328 else -
code/trunk/src/core/input/KeyBinder.h
r2896 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include <cassert> 41 #include <string> 40 42 #include <vector> 41 #include <cassert>42 43 43 44 #include "InputInterfaces.h" -
code/trunk/src/core/input/KeyDetector.cc
r1887 r3196 34 34 35 35 #include "KeyDetector.h" 36 36 37 #include "util/Debug.h" 37 38 #include "core/CoreIncludes.h" 38 #include "core/CommandExecutor.h"39 #include "core/CommandEvaluation.h"40 #include "InputCommands.h"41 39 #include "Button.h" 42 40 -
code/trunk/src/core/input/KeyDetector.h
r1887 r3196 38 38 #include "core/CorePrereqs.h" 39 39 40 #include <string> 40 41 #include "KeyBinder.h" 41 42 -
code/trunk/src/core/input/SimpleInputState.cc
r1887 r3196 34 34 35 35 #include "SimpleInputState.h" 36 #include "core/Executor.h" 36 37 37 38 namespace orxonox … … 148 149 bHandlersChanged_ = true; 149 150 } 151 152 void SimpleInputState::onEnter() 153 { 154 if (executorOnEnter_) 155 (*executorOnEnter_)(); 156 } 157 158 void SimpleInputState::onLeave() 159 { 160 if (executorOnLeave_) 161 (*executorOnLeave_)(); 162 } 150 163 } -
code/trunk/src/core/input/SimpleInputState.h
r2896 r3196 79 79 void update(); 80 80 void numberOfJoySticksChanged(unsigned int n); 81 82 void onEnter(); 83 void onLeave(); 81 84 82 85 KeyHandler* keyHandler_;
Note: See TracChangeset
for help on using the changeset viewer.