Changeset 2800 for code/branches/gui/src/core
- Timestamp:
- Mar 19, 2009, 10:34:54 AM (16 years ago)
- Location:
- code/branches/gui/src/core
- Files:
-
- 16 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/gui/src/core/Core.cc
r2799 r2800 563 563 } 564 564 565 void Core:: tick(const Clock& time)566 { 567 this->tclThreadManager_-> tick(time.getDeltaTime());565 void Core::update(const Clock& time) 566 { 567 this->tclThreadManager_->update(time); 568 568 } 569 569 } -
code/branches/gui/src/core/Core.h
r2799 r2800 66 66 67 67 bool isLoaded() { return this->loaded_; } 68 void tick(const Clock& time);68 void update(const Clock& time); 69 69 70 70 static Core& getInstance() { assert(Core::singletonRef_s); return *Core::singletonRef_s; } -
code/branches/gui/src/core/TclThreadManager.cc
r1792 r2800 35 35 #include <OgreTimer.h> 36 36 37 #include "Clock.h" 37 38 #include "CoreIncludes.h" 38 39 #include "ConsoleCommand.h" … … 598 599 } 599 600 600 void TclThreadManager:: tick(float dt)601 void TclThreadManager::update(const Clock& time) 601 602 { 602 603 { … … 633 634 boost::try_mutex::scoped_lock interpreter_lock(this->orxonoxInterpreterBundle_.interpreterMutex_); 634 635 #endif 635 unsigned long maxtime = (unsigned long)( dt* 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE);636 unsigned long maxtime = (unsigned long)(time.getDeltaTime() * 1000000 * TCLTHREADMANAGER_MAX_CPU_USAGE); 636 637 Ogre::Timer timer; 637 638 while (!this->queueIsEmpty()) -
code/branches/gui/src/core/TclThreadManager.h
r2710 r2800 90 90 void debug(const std::string& error); 91 91 92 v irtual void tick(float dt);92 void update(const Clock& time); 93 93 94 94 std::list<unsigned int> getThreadList() const; -
code/branches/gui/src/core/input/CalibratorCallback.h
r1755 r2800 52 52 void keyHeld (const KeyEvent& evt) { } 53 53 54 void tickInput(float dt) { }54 void updateInput(float dt) { } 55 55 }; 56 56 } -
code/branches/gui/src/core/input/ExtendedInputState.cc
r2773 r2800 402 402 } 403 403 404 void ExtendedInputState:: tickInput(float dt)404 void ExtendedInputState::updateInput(float dt) 405 405 { 406 406 for (unsigned int i = 0; i < allHandlers_.size(); ++i) 407 407 { 408 allHandlers_[i]-> tickInput(dt);409 } 410 } 411 412 void ExtendedInputState:: tickInput(float dt, unsigned int device)408 allHandlers_[i]->updateInput(dt); 409 } 410 } 411 412 void ExtendedInputState::updateInput(float dt, unsigned int device) 413 413 { 414 414 switch (device) … … 416 416 case Keyboard: 417 417 for (unsigned int i = 0; i < keyHandlers_.size(); ++i) 418 keyHandlers_[i]-> tickKey(dt);418 keyHandlers_[i]->updateKey(dt); 419 419 break; 420 420 421 421 case Mouse: 422 422 for (unsigned int i = 0; i < mouseHandlers_.size(); ++i) 423 mouseHandlers_[i]-> tickMouse(dt);423 mouseHandlers_[i]->updateMouse(dt); 424 424 break; 425 425 426 426 default: // joy sticks 427 427 for (unsigned int i = 0; i < joyStickHandlers_[device - 2].size(); ++i) 428 joyStickHandlers_[device - 2][i]-> tickJoyStick(dt, device - 2);428 joyStickHandlers_[device - 2][i]->updateJoyStick(dt, device - 2); 429 429 break; 430 430 } -
code/branches/gui/src/core/input/ExtendedInputState.h
r1887 r2800 68 68 ~ExtendedInputState() { } 69 69 70 void tickInput(float dt);71 void tickInput(float dt, unsigned int device);70 void updateInput(float dt); 71 void updateInput(float dt, unsigned int device); 72 72 73 73 void keyPressed (const KeyEvent& evt); -
code/branches/gui/src/core/input/InputBuffer.cc
r2662 r2800 224 224 225 225 /** 226 @brief This tick() function is called by the InputManager if the InputBuffer is active.226 @brief This update() function is called by the InputManager if the InputBuffer is active. 227 227 @param dt Delta time 228 228 */ 229 void InputBuffer:: tickInput(float dt)229 void InputBuffer::updateInput(float dt) 230 230 { 231 231 timeSinceKeyPressed_ += dt; -
code/branches/gui/src/core/input/InputBuffer.h
r2662 r2800 171 171 void processKey (const KeyEvent &e); 172 172 173 void tickInput(float dt);174 void tickKey(float dt) { }173 void updateInput(float dt); 174 void updateKey(float dt) { } 175 175 176 176 std::string buffer_; -
code/branches/gui/src/core/input/InputInterfaces.h
r2662 r2800 474 474 public: 475 475 virtual ~InputHandler() { } 476 virtual void tickInput(float dt) = 0;476 virtual void updateInput(float dt) = 0; 477 477 }; 478 478 … … 488 488 virtual void keyReleased(const KeyEvent& evt) = 0; 489 489 virtual void keyHeld (const KeyEvent& evt) = 0; 490 virtual void tickKey (float dt) = 0;490 virtual void updateKey (float dt) = 0; 491 491 }; 492 492 … … 504 504 virtual void mouseMoved (IntVector2 abs, IntVector2 rel, IntVector2 clippingSize) = 0; 505 505 virtual void mouseScrolled (int abs, int rel) = 0; 506 virtual void tickMouse (float dt) = 0;506 virtual void updateMouse (float dt) = 0; 507 507 }; 508 508 … … 520 520 virtual void joyStickButtonHeld (unsigned int joyStickID, JoyStickButtonCode::ByEnum id) = 0; 521 521 virtual void joyStickAxisMoved (unsigned int joyStickID, unsigned int axis, float value) = 0; 522 virtual void tickJoyStick (float dt, unsigned int joyStick) = 0;522 virtual void updateJoyStick (float dt, unsigned int joyStick) = 0; 523 523 }; 524 524 … … 531 531 virtual ~EmptyHandler() { } 532 532 533 void tickInput(float dt) { }534 void tickJoyStick(float dt, unsigned int joyStick) { }535 void tickMouse(float dt) { }536 void tickKey(float dt) { }533 void updateInput(float dt) { } 534 void updateJoyStick(float dt, unsigned int joyStick) { } 535 void updateMouse(float dt) { } 536 void updateKey(float dt) { } 537 537 538 538 void keyPressed (const KeyEvent& evt) { } -
code/branches/gui/src/core/input/InputManager.cc
r2662 r2800 43 43 44 44 #include "util/Exception.h" 45 #include "core/Clock.h" 45 46 #include "core/CoreIncludes.h" 46 47 #include "core/ConfigValueIncludes.h" … … 670 671 @brief 671 672 Public interface. Only reloads immediately if the call stack doesn't 672 include the tick() method.673 include the update() method. 673 674 @param joyStickSupport 674 675 Whether or not to initialise joy sticks as well. … … 742 743 @brief 743 744 Updates the states and the InputState situation. 744 @param dt745 Delta time746 */ 747 void InputManager:: tick(float dt)745 @param time 746 Clock holding the current time. 747 */ 748 void InputManager::update(const Clock& time) 748 749 { 749 750 if (internalState_ == Uninitialised) … … 849 850 } 850 851 851 // tickthe handlers for each active handler852 // update the handlers for each active handler 852 853 for (unsigned int i = 0; i < devicesNum_; ++i) 853 854 { 854 activeStatesTop_[i]-> tickInput(dt, i);855 activeStatesTop_[i]->updateInput(time.getDeltaTime(), i); 855 856 if (stateMaster_->isInputDeviceEnabled(i)) 856 stateMaster_-> tickInput(dt, i);857 } 858 859 // tickthe handler with a general tick afterwards857 stateMaster_->updateInput(time.getDeltaTime(), i); 858 } 859 860 // update the handler with a general tick afterwards 860 861 for (unsigned int i = 0; i < activeStatesTicked_.size(); ++i) 861 activeStatesTicked_[i]-> tickInput(dt);862 stateMaster_-> tickInput(dt);862 activeStatesTicked_[i]->updateInput(time.getDeltaTime()); 863 stateMaster_->updateInput(time.getDeltaTime()); 863 864 } 864 865 … … 869 870 @brief 870 871 Updates the currently active states (according to activeStates_) for each device. 871 Also, a list of all active states (no duplicates!) is compiled for the general tick.872 Also, a list of all active states (no duplicates!) is compiled for the general update(). 872 873 */ 873 874 void InputManager::_updateActiveStates() … … 1290 1291 @remarks 1291 1292 You can't remove the internal states "empty", "calibrator" and "detector". 1292 The removal process is being postponed if InputManager:: tick() is currently running.1293 The removal process is being postponed if InputManager::update() is currently running. 1293 1294 */ 1294 1295 bool InputManager::requestDestroyState(const std::string& name) -
code/branches/gui/src/core/input/InputManager.h
r2662 r2800 125 125 bool requestLeaveState (const std::string& name); 126 126 127 void tick(float dt);127 void update(const Clock& time); 128 128 129 129 static InputManager& getInstance() { assert(singletonRef_s); return *singletonRef_s; } -
code/branches/gui/src/core/input/InputState.h
r1887 r2800 71 71 virtual void unRegisterOnLeave() { executorOnLeave_ = 0; } 72 72 73 virtual void tickInput(float dt, unsigned int device) = 0;74 virtual void tickInput(float dt) = 0;73 virtual void updateInput(float dt, unsigned int device) = 0; 74 virtual void updateInput(float dt) = 0; 75 75 76 76 virtual void keyPressed (const KeyEvent& evt) = 0; -
code/branches/gui/src/core/input/KeyBinder.cc
r2713 r2800 309 309 } 310 310 311 void KeyBinder:: tickMouse(float dt)311 void KeyBinder::updateMouse(float dt) 312 312 { 313 313 if (bDeriveMouseInput_) … … 349 349 // Why dividing relative value by dt? The reason lies in the simple fact, that when you 350 350 // press a button that has relative movement, that value has to be multiplied by dt to be 351 // frame rate independent. This can easily (and only) be done in tickInput(float).351 // frame rate independent. This can easily (and only) be done in updateInput(float). 352 352 // Hence we need to divide by dt here for the mouse to compensate, because the relative 353 353 // move movements have nothing to do with dt. … … 362 362 } 363 363 364 void KeyBinder:: tickJoyStick(float dt, unsigned int joyStick)364 void KeyBinder::updateJoyStick(float dt, unsigned int joyStick) 365 365 { 366 366 for (unsigned int i = 0; i < JoyStickAxisCode::numberOfAxes * 2; i++) -
code/branches/gui/src/core/input/KeyBinder.h
r2710 r2800 68 68 69 69 protected: // functions 70 void tickInput(float dt);71 void tickKey(float dt) { }72 void tickMouse(float dt);73 void tickJoyStick(float dt, unsigned int joyStick);70 void updateInput(float dt); 71 void updateKey(float dt) { } 72 void updateMouse(float dt); 73 void updateJoyStick(float dt, unsigned int joyStick); 74 74 // internal 75 75 void tickHalfAxis(HalfAxis& halfAxis); … … 134 134 @brief 135 135 Commands that have additional parameters (axes) are executed at the end of 136 the tick() so that all values can be buffered for single execution.136 update() so that all values can be buffered for single execution. 137 137 */ 138 138 std::vector<BufferedParamCommand*> paramCommandBuffer_; … … 200 200 { joyStickButtons_[joyStickID][id].execute(KeybindMode::OnHold); } 201 201 202 inline void KeyBinder:: tickInput(float dt)202 inline void KeyBinder::updateInput(float dt) 203 203 { 204 204 // execute all buffered bindings (additional parameter) -
code/branches/gui/src/core/input/SimpleInputState.h
r1887 r2800 59 59 ~SimpleInputState() { } 60 60 61 void tickInput(float dt);62 void tickInput(float dt, unsigned int device);61 void updateInput(float dt); 62 void updateInput(float dt, unsigned int device); 63 63 64 64 void keyPressed (const KeyEvent& evt); … … 87 87 }; 88 88 89 inline void SimpleInputState:: tickInput(float dt)89 inline void SimpleInputState::updateInput(float dt) 90 90 { 91 91 for (unsigned int i = 0; i < allHandlers_.size(); ++i) 92 92 { 93 allHandlers_[i]-> tickInput(dt);93 allHandlers_[i]->updateInput(dt); 94 94 } 95 95 } 96 96 97 inline void SimpleInputState:: tickInput(float dt, unsigned int device)97 inline void SimpleInputState::updateInput(float dt, unsigned int device) 98 98 { 99 99 switch (device) … … 101 101 case InputDevice::Keyboard: 102 102 if (keyHandler_) 103 keyHandler_-> tickKey(dt);103 keyHandler_->updateKey(dt); 104 104 break; 105 105 106 106 case InputDevice::Mouse: 107 107 if (mouseHandler_) 108 mouseHandler_-> tickMouse(dt);108 mouseHandler_->updateMouse(dt); 109 109 break; 110 110 111 111 default: // joy sticks 112 112 if (joyStickHandler_[device - 2]) 113 joyStickHandler_[device - 2]-> tickJoyStick(dt, device - 2);113 joyStickHandler_[device - 2]->updateJoyStick(dt, device - 2); 114 114 break; 115 115 }
Note: See TracChangeset
for help on using the changeset viewer.