Changeset 3060 for code/trunk/src/orxonox/objects/items
- Timestamp:
- May 25, 2009, 3:07:31 PM (16 years ago)
- Location:
- code/trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
/code/branches/sound (added) merged: 2829,2866,2899,2930-2932,2950,2955,2966-2968,2980,2982,2984,2998-2999,3010
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/objects/items/Engine.cc
r2662 r3060 36 36 #include "objects/worldentities/pawns/SpaceShip.h" 37 37 #include "tools/Shader.h" 38 #include "sound/SoundBase.h" 38 39 39 40 namespace orxonox … … 66 67 this->setConfigValues(); 67 68 this->registerVariables(); 69 70 this->sound_ = NULL; 68 71 } 69 72 … … 76 79 if (this->boostBlur_) 77 80 delete this->boostBlur_; 81 82 if(this->sound_ != NULL) 83 delete this->sound_; 78 84 } 79 85 } … … 95 101 XMLPortParam(Engine, "accelerationleftright", setAccelerationLeftRight, setAccelerationLeftRight, xmlelement, mode); 96 102 XMLPortParam(Engine, "accelerationupdown", setAccelerationUpDown, setAccelerationUpDown, xmlelement, mode); 103 104 XMLPortParamLoadOnly(Engine, "sound", loadSound, xmlelement, mode); 97 105 } 98 106 … … 219 227 { 220 228 this->ship_ = ship; 229 221 230 if (ship) 222 231 { … … 230 239 this->boostBlur_ = 0; 231 240 } 241 242 if(this->sound_ != NULL) 243 this->sound_->attachToEntity(ship); 232 244 } 233 245 } … … 240 252 return Vector3::ZERO; 241 253 } 254 255 void Engine::loadSound(const std::string filename) 256 { 257 if(filename == "") return; 258 else 259 { 260 if(this->sound_ == NULL) 261 { 262 this->sound_ = new SoundBase(this->ship_); 263 } 264 265 this->sound_->loadFile(filename); 266 this->sound_->play(true); 267 } 268 } 242 269 } -
code/trunk/src/orxonox/objects/items/Engine.h
r2662 r3060 107 107 virtual const Vector3& getDirection() const; 108 108 109 void loadSound(const std::string filename); 110 109 111 private: 110 112 void networkcallback_shipID(); … … 129 131 Shader* boostBlur_; 130 132 float blurStrength_; 133 134 SoundBase* sound_; 131 135 }; 132 136 }
Note: See TracChangeset
for help on using the changeset viewer.