Changeset 8680
- Timestamp:
- May 30, 2011, 9:55:38 AM (13 years ago)
- Location:
- code/branches/presentation/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/presentation/src/modules/tetris/Tetris.cc
r8661 r8680 233 233 if(this->player_ == NULL) 234 234 return; 235 235 236 unsigned int cameraIndex = 0; 236 237 if(this->activeStone_ != NULL) 238 { 239 // Get camera settings 240 cameraIndex = this->activeStone_->getCurrentCameraIndex(); 237 241 this->player_->stopControl(); 242 } 238 243 239 244 // Make the last stone to be created the active stone. … … 242 247 this->player_->startControl(this->activeStone_); 243 248 this->activeStone_->setVelocity(0.0f, -this->center_->getStoneSpeed(), 0.0f); 249 this->activeStone_->setCameraPosition(cameraIndex); 244 250 } 245 251 -
code/branches/presentation/src/orxonox/worldentities/ControllableEntity.cc
r8580 r8680 120 120 121 121 XMLPortParam(ControllableEntity, "hudtemplate", setHudTemplate, getHudTemplate, xmlelement, mode); 122 XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTem kplate, xmlelement, mode);122 XMLPortParam(ControllableEntity, "camerapositiontemplate", setCameraPositionTemplate, getCameraPositionTemplate, xmlelement, mode); 123 123 124 124 XMLPortObject(ControllableEntity, CameraPosition, "camerapositions", addCameraPosition, getCameraPosition, xmlelement, mode); … … 170 170 } 171 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; 172 206 } 173 207 -
code/branches/presentation/src/orxonox/worldentities/ControllableEntity.h
r8580 r8680 116 116 inline const std::list<SmartPtr<CameraPosition> >& getCameraPositions() const 117 117 { return this->cameraPositions_; } 118 unsigned int getCurrentCameraIndex() const; 119 bool setCameraPosition(unsigned int index); 118 120 119 121 inline void setCameraPositionTemplate(const std::string& name) 120 122 { this->cameraPositionTemplate_ = name; } 121 inline const std::string& getCameraPositionTem kplate() const123 inline const std::string& getCameraPositionTemplate() const 122 124 { return this->cameraPositionTemplate_; } 123 125
Note: See TracChangeset
for help on using the changeset viewer.