- Timestamp:
- Jun 14, 2011, 8:53:28 PM (13 years ago)
- Location:
- code/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
code/trunk
- Property svn:mergeinfo changed
-
code/trunk/src/orxonox/worldentities/ControllableEntity.cc
r7892 r8706 84 84 this->client_angular_velocity_ = Vector3::ZERO; 85 85 86 87 86 this->setConfigValues(); 88 87 this->setPriority( Priority::VeryHigh ); … … 121 120 122 121 XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode); 123 XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTem kplate, xmlelement, mode);122 XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemplate, xmlelement, mode); 124 123 125 124 XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode); … … 171 170 } 172 171 return 0; 172 } 173 174 unsigned int ControllableEntity::getCurrentCameraIndex() const 175 { 176 if (this->cameraPositions_.size() <= 0) 177 return 0; 178 179 unsigned int counter = 0; 180 for (std::list<SmartPtr<CameraPosition> >::const_iterator it = this->cameraPositions_.begin(); it != this->cameraPositions_.end(); ++it) 181 { 182 if ((*it) == this->currentCameraPosition_) 183 break; 184 counter++; 185 } 186 if (counter >= this->cameraPositions_.size()) 187 return 0; 188 189 return counter; 190 } 191 192 bool ControllableEntity::setCameraPosition(unsigned int index) 193 { 194 if(this->camera_ != NULL && this->cameraPositions_.size() > 0) 195 { 196 if(index >= this->cameraPositions_.size()) 197 index = 0; 198 199 CameraPosition* position = this->getCameraPosition(index); 200 position->attachCamera(this->camera_); 201 this->currentCameraPosition_ = position; 202 return true; 203 } 204 205 return false; 173 206 } 174 207 … … 373 406 } 374 407 408 this->createHud(); 409 } 410 411 // HACK-ish 412 void ControllableEntity::createHud(void) 413 { 375 414 if (!this->hud_ && GameMode::showsGraphics()) 376 415 { … … 381 420 this->hud_->setOwner(this); 382 421 } 422 } 423 } 424 425 void ControllableEntity::destroyHud(void) 426 { 427 if (this->hud_ != NULL) 428 { 429 this->hud_->destroy(); 430 this->hud_ = NULL; 383 431 } 384 432 }
Note: See TracChangeset
for help on using the changeset viewer.