Changeset 1968 for code/branches/objecthierarchy/src/orxonox
- Timestamp:
- Oct 20, 2008, 1:47:41 AM (16 years ago)
- Location:
- code/branches/objecthierarchy/src/orxonox
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/objecthierarchy/src/orxonox/CMakeLists.txt
r1959 r1968 45 45 objects/worldentities/WorldEntity.cc 46 46 objects/worldentities/PositionableEntity.cc 47 objects/worldentities/MovableEntity.cc 47 48 # objects/Backlight.cc 48 49 objects/Camera.cc -
code/branches/objecthierarchy/src/orxonox/objects/Backlight.h
r1907 r1968 33 33 34 34 #include "WorldEntity.h" 35 #include "tools/Timer.h"36 35 #include "tools/BillboardSet.h" 37 36 -
code/branches/objecthierarchy/src/orxonox/objects/infos/LevelInfo.cc
r1949 r1968 89 89 void LevelInfo::setGametype(const std::string& gametype) 90 90 { 91 std::cout << "0: " << gametype << std::endl;92 91 Identifier* identifier = ClassByString(gametype); 93 92 if (identifier) 94 93 { 95 std::cout << "1: " << identifier->getName() << std::endl;96 94 this->gametype_ = gametype; 97 95 this->gametypeIdentifier_ = identifier; -
code/branches/objecthierarchy/src/orxonox/objects/worldentities/PositionableEntity.h
r1950 r1968 43 43 void registerVariables(); 44 44 45 using WorldEntity::setPosition; 46 using WorldEntity::translate; 47 using WorldEntity::setOrientation; 48 using WorldEntity::rotate; 49 using WorldEntity::lookAt; 50 using WorldEntity::setDirection; 51 45 52 inline void setPosition(const Vector3& position) 46 53 { this->node_->setPosition(position); } -
code/branches/objecthierarchy/src/orxonox/overlays/hud/ChatOverlay.cc
r1953 r1968 90 90 COUT(0) << "Chat: " << text << std::endl; 91 91 92 Timer<ChatOverlay>* timer = new Timer<ChatOverlay>; 93 ExecutorMember<ChatOverlay>* executor = createExecutor(createFunctor(&ChatOverlay::dropMessage)); 94 executor->setDefaultValues(timer); 95 timer->setTimer(this->displayTime_, false, this, executor); 92 new Timer<ChatOverlay>(this->displayTime_, false, this, createExecutor(createFunctor(&ChatOverlay::dropMessage)), true); 96 93 97 94 this->updateOverlayText(); 98 95 } 99 96 100 void ChatOverlay::dropMessage( Timer<ChatOverlay>* timer)97 void ChatOverlay::dropMessage() 101 98 { 102 99 this->messages_.pop_front(); 103 100 this->updateOverlayText(); 104 105 delete timer;106 101 } 107 102 -
code/branches/objecthierarchy/src/orxonox/overlays/hud/ChatOverlay.h
r1953 r1968 54 54 private: 55 55 void updateOverlayText(); 56 void dropMessage( Timer<ChatOverlay>* timer);56 void dropMessage(); 57 57 58 58 float displayTime_; -
code/branches/objecthierarchy/src/orxonox/tools/Timer.cc
r1755 r1968 92 92 this->bLoop_ = false; 93 93 this->bActive_ = false; 94 this->bKillAfterCall_ = false; 94 95 95 96 this->time_ = 0; … … 112 113 { 113 114 (*this->executor_)(); 115 116 if (this->bKillAfterCall_) 117 delete this; 114 118 } 115 119 … … 136 140 { 137 141 // It's time to call the function 138 if (this->bLoop_ )142 if (this->bLoop_ && !this->bKillAfterCall_) 139 143 { 140 144 this->time_ += this->interval_; // Q: Why '+=' and not '='? A: Think about it. It's more accurate like that. Seriously. -
code/branches/objecthierarchy/src/orxonox/tools/Timer.h
r1755 r1968 116 116 TimerBase(); 117 117 118 Executor* executor_; //!< The executor of the function that should be called when the time expires 119 120 long long interval_; //!< The time-interval in micro seconds 121 bool bLoop_; //!< If true, the function gets called every 'interval' seconds 122 bool bActive_; //!< If true, the Timer ticks and calls the function if the time's up 123 124 long long time_; //!< Internal variable, counting the time till the next function-call 118 Executor* executor_; //!< The executor of the function that should be called when the time expires 119 120 long long interval_; //!< The time-interval in micro seconds 121 bool bLoop_; //!< If true, the function gets called every 'interval' seconds 122 bool bActive_; //!< If true, the Timer ticks and calls the function if the time's up 123 bool bKillAfterCall_; //!< If true the timer gets deleted after it called the function 124 125 long long time_; //!< Internal variable, counting the time till the next function-call 125 126 }; 126 127 … … 139 140 @param exeuctor A executor of the function to call 140 141 */ 141 Timer(float interval, bool bLoop, T* object, ExecutorMember<T>* exeuctor )142 { 143 this->setTimer(interval, bLoop, object, exeuctor );142 Timer(float interval, bool bLoop, T* object, ExecutorMember<T>* exeuctor, bool bKillAfterCall = false) 143 { 144 this->setTimer(interval, bLoop, object, exeuctor, bKillAfterCall); 144 145 } 145 146 … … 151 152 @param exeuctor A executor of the function to call 152 153 */ 153 void setTimer(float interval, bool bLoop, T* object, ExecutorMember<T>* executor )154 void setTimer(float interval, bool bLoop, T* object, ExecutorMember<T>* executor, bool bKillAfterCall = false) 154 155 { 155 156 this->deleteExecutor(); … … 162 163 163 164 this->time_ = this->interval_; 165 this->bKillAfterCall_ = bKillAfterCall; 164 166 } 165 167 }; … … 177 179 @param exeuctor A executor of the function to call 178 180 */ 179 StaticTimer(float interval, bool bLoop, ExecutorStatic* executor )180 { 181 this->setTimer(interval, bLoop, executor );181 StaticTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false) 182 { 183 this->setTimer(interval, bLoop, executor, bKillAfterCall); 182 184 } 183 185 … … 189 191 @param executor A executor of the function to call 190 192 */ 191 void setTimer(float interval, bool bLoop, ExecutorStatic* executor )193 void setTimer(float interval, bool bLoop, ExecutorStatic* executor, bool bKillAfterCall = false) 192 194 { 193 195 this->deleteExecutor(); … … 199 201 200 202 this->time_ = this->interval_; 203 this->bKillAfterCall_ = bKillAfterCall; 201 204 } 202 205 };
Note: See TracChangeset
for help on using the changeset viewer.