Changeset 2800 for code/branches/gui/src
- Timestamp:
- Mar 19, 2009, 10:34:54 AM (16 years ago)
- Location:
- code/branches/gui/src
- Files:
-
- 30 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 } -
code/branches/gui/src/network/Client.cc
r2773 r2800 45 45 #include "Host.h" 46 46 #include "synchronisable/Synchronisable.h" 47 #include "core/Clock.h" 47 48 #include "core/CoreIncludes.h" 48 49 #include "packet/Packet.h" … … 138 139 * @param time 139 140 */ 140 void Client:: tick(floattime){141 void Client::update(const Clock& time){ 141 142 // COUT(3) << "."; 142 143 if(client_connection.isConnected() && isSynched_){ -
code/branches/gui/src/network/Client.h
r2773 r2800 76 76 //bool sendChat(packet::Chat *chat); 77 77 78 void tick(floattime);78 void update(const Clock& time); 79 79 80 80 private: -
code/branches/gui/src/network/Server.cc
r2773 r2800 51 51 #include "ClientInformation.h" 52 52 #include "util/Sleep.h" 53 #include "core/Clock.h" 53 54 #include "core/ConsoleCommand.h" 54 55 #include "core/CoreIncludes.h" … … 149 150 * @param time time since last tick 150 151 */ 151 void Server:: tick(floattime) {152 void Server::update(const Clock& time) { 152 153 processQueue(); 153 154 //this steers our network frequency 154 timeSinceLastUpdate_+=time ;155 timeSinceLastUpdate_+=time.getDeltaTime(); 155 156 if(timeSinceLastUpdate_>=NETWORK_PERIOD){ 156 157 timeSinceLastUpdate_ -= static_cast<unsigned int>( timeSinceLastUpdate_ / NETWORK_PERIOD ) * NETWORK_PERIOD; -
code/branches/gui/src/network/Server.h
r2662 r2800 71 71 bool processChat(const std::string& message, unsigned int playerID); 72 72 bool queuePacket(ENetPacket *packet, int clientID); 73 void tick(floattime);73 void update(const Clock& time); 74 74 unsigned int getPing(unsigned int clientID); 75 75 double getPacketLoss(unsigned int clientID); -
code/branches/gui/src/orxonox/gamestates/GSClient.cc
r2171 r2800 31 31 32 32 #include "core/input/InputManager.h" 33 #include "core/Clock.h" 33 34 #include "core/CommandLine.h" 34 35 #include "core/Core.h" … … 60 61 GSLevel::enter(this->getParent()->getViewport()); 61 62 62 client_->tick(0); 63 // TODO: Get Clock from Game or GameStateManager, but with 0 delta time 64 client_->update(Clock()); 63 65 } 64 66 … … 78 80 { 79 81 GSLevel::ticked(time); 80 client_-> tick(time.getDeltaTime());82 client_->update(time); 81 83 82 84 this->tickChild(time); -
code/branches/gui/src/orxonox/gamestates/GSDedicated.cc
r2662 r2800 30 30 #include "GSDedicated.h" 31 31 32 #include "core/Clock.h" 32 33 #include "core/CommandLine.h" 33 34 #include "core/Core.h" … … 83 84 timeSinceLastUpdate_ -= static_cast<unsigned int>(timeSinceLastUpdate_ / NETWORK_PERIOD) * NETWORK_PERIOD; 84 85 GSLevel::ticked(time); 85 server_-> tick(time.getDeltaTime());86 server_->update(time); 86 87 this->tickChild(time); 87 88 } -
code/branches/gui/src/orxonox/gamestates/GSGUI.cc
r2790 r2800 31 31 32 32 #include <OgreViewport.h> 33 #include "core/Clock.h" 33 34 #include "core/input/InputManager.h" 34 35 #include "core/input/SimpleInputState.h" … … 64 65 { 65 66 // tick CEGUI 66 guiManager_-> tick(time.getDeltaTime());67 guiManager_->update(time); 67 68 68 69 this->tickChild(time); -
code/branches/gui/src/orxonox/gamestates/GSGraphics.cc
r2759 r2800 233 233 float dt = time.getDeltaTime(); 234 234 235 this->inputManager_-> tick(dt);235 this->inputManager_->update(time); 236 236 // tick console 237 this->console_-> tick(dt);237 this->console_->update(time); 238 238 this->tickChild(time); 239 239 -
code/branches/gui/src/orxonox/gamestates/GSRoot.cc
r2799 r2800 134 134 uint64_t timeBeforeTick = time.getRealMicroseconds(); 135 135 136 Core::getInstance(). tick(time);136 Core::getInstance().update(time); 137 137 138 138 for (ObjectList<TimerBase>::iterator it = ObjectList<TimerBase>::begin(); it; ++it) -
code/branches/gui/src/orxonox/gamestates/GSServer.cc
r2171 r2800 73 73 { 74 74 GSLevel::ticked(time); 75 server_-> tick(time.getDeltaTime());75 server_->update(time); 76 76 this->tickChild(time); 77 77 } -
code/branches/gui/src/orxonox/gamestates/GSStandalone.cc
r2790 r2800 86 86 } 87 87 // tick CEGUI 88 guiManager_-> tick(time.getDeltaTime());88 guiManager_->update(time); 89 89 90 90 GSLevel::ticked(time); -
code/branches/gui/src/orxonox/gui/GUIManager.h
r2790 r2800 40 40 #include <CEGUIInputEvent.h> 41 41 #include <CEGUISystem.h> 42 #include "core/Clock.h" 42 43 #include "core/input/InputInterfaces.h" 43 44 … … 71 72 bool initialise(Ogre::RenderWindow* renderWindow); 72 73 void loadScene(const std::string& name); 73 void tick(float dt)74 void update(const Clock& time) 74 75 { 75 76 assert(guiSystem_); 76 guiSystem_->injectTimePulse( dt);77 guiSystem_->injectTimePulse(time.getDeltaTime()); 77 78 } 78 79 void showGUI(const std::string& name, Ogre::SceneManager* sceneManager);// bool showBackground); // tolua_export … … 108 109 { guiSystem_->injectMouseWheelChange(rel);} 109 110 110 void tickInput(float dt) { }111 void tickKey(float dt) { }112 void tickMouse(float dt) { }111 void updateInput(float dt) { } 112 void updateKey(float dt) { } 113 void updateMouse(float dt) { } 113 114 114 115 void loadScenes(); -
code/branches/gui/src/orxonox/overlays/console/InGameConsole.cc
r2087 r2800 42 42 #include "util/Convert.h" 43 43 #include "util/Debug.h" 44 #include "core/Clock.h" 44 45 #include "core/CoreIncludes.h" 45 46 #include "core/ConfigValueIncludes.h" … … 347 348 @brief Used to control the actual scrolling and the cursor. 348 349 */ 349 void InGameConsole:: tick(float dt)350 void InGameConsole::update(const Clock& time) 350 351 { 351 352 if (this->scroll_ != 0) … … 358 359 // enlarge oldTop a little bit so that this exponential function 359 360 // reaches 0 before infinite time has passed... 360 float deltaScroll = (oldTop - 0.01) * dt* this->scrollSpeed_;361 float deltaScroll = (oldTop - 0.01) * time.getDeltaTime() * this->scrollSpeed_; 361 362 if (oldTop - deltaScroll >= 0) 362 363 { … … 373 374 // scrolling up 374 375 // note: +0.01 for the same reason as when scrolling down 375 float deltaScroll = (1.2 * this->relativeHeight + 0.01 + oldTop) * dt* this->scrollSpeed_;376 float deltaScroll = (1.2 * this->relativeHeight + 0.01 + oldTop) * time.getDeltaTime() * this->scrollSpeed_; 376 377 if (oldTop - deltaScroll <= -1.2 * this->relativeHeight) 377 378 { … … 388 389 if (this->bActive_) 389 390 { 390 this->cursor_ += dt;391 this->cursor_ += time.getDeltaTime(); 391 392 if (this->cursor_ >= this->blinkTime) 392 393 { -
code/branches/gui/src/orxonox/overlays/console/InGameConsole.h
r2087 r2800 53 53 void setConfigValues(); 54 54 55 v irtual void tick(float dt);55 void update(const Clock& time); 56 56 57 57 static InGameConsole& getInstance() { assert(singletonRef_s); return *singletonRef_s; }
Note: See TracChangeset
for help on using the changeset viewer.