- Timestamp:
- Feb 15, 2018, 12:11:04 AM (7 years ago)
- Location:
- code/branches/Presentation_HS17_merge/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.cc
r11743 r11745 66 66 { 67 67 RegisterObject(StoryModeHUD); 68 69 this->textSize_ = 1.0; 68 70 } 69 71 70 72 // Destructor of the StoryMode HUD 71 73 StoryModeHUD::~StoryModeHUD() 72 {} 74 { 75 for(Ogre::TextAreaOverlayElement* text : texts) 76 Ogre::OverlayManager::getSingleton().destroyOverlayElement(text); 77 } 73 78 74 79 // Functions of the StoryMode HUD … … 92 97 CameraManager::getInstance().getActiveCamera()->setOrientation(Vector3::UNIT_X, Degree(-30)); 93 98 94 int i = 0;95 99 for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){ 96 100 … … 100 104 101 105 texts.push_back(text); 102 text s[i]->setDimensions(xScale, yScale);106 text->setDimensions(xScale, yScale); 103 107 104 108 //font name of the text needs to be set here, not in the xml setter function 105 text s[i]->setFontName(this->fontName_);106 text s[i]->setCharHeight(this->textSize_ * yScale);109 text->setFontName(this->fontName_); 110 text->setCharHeight(this->textSize_ * yScale); 107 111 108 112 //set text 109 text s[i]->setCaption(planet->getLevelName());113 text->setCaption(planet->getLevelName()); 110 114 111 text s[i]->hide();115 text->hide(); 112 116 113 this->background_->addChild(texts[i]); 114 i++; 117 this->background_->addChild(text); 115 118 } 116 119 } … … 170 173 const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix(); 171 174 172 int i = 0;175 size_t i = 0; 173 176 for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){ 177 if (i >= texts.size()) { 178 break; 179 } 180 Ogre::TextAreaOverlayElement* text = texts[i]; 181 i++; 174 182 175 183 // Transform to screen coordinates … … 180 188 181 189 // Position text 182 text s[i]->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.183 text s[i]->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions190 text->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner. 191 text->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions 184 192 185 193 // Make sure the overlays are shown 186 text s[i]->show();194 text->show(); 187 195 } 188 i++;189 190 196 } 191 197 } -
code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h
r11743 r11745 50 50 virtual void tick(float dt) override; 51 51 52 private: 53 void initialize(); 52 54 53 private: 54 std::vector<Ogre::TextAreaOverlayElement*> texts; 55 void initialize(); 56 virtual void setTextSize(float size); 57 virtual float getTextSize() const; 55 void setTextSize(float size); 56 float getTextSize() const; 58 57 59 v irtual void setFont(const std::string& font);58 void setFont(const std::string& font); 60 59 const std::string& getFont() const; 61 60 61 std::vector<Ogre::TextAreaOverlayElement*> texts; 62 62 std::string fontName_; 63 63 float textSize_; -
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h
r11743 r11745 1 1 /* 2 *This is the header of the NameableStaticEntity.cc file 3 *In this file we define a constructor, destructor and additional function (which is important to name a planet) 4 * 5 *Author: Bolt Nikole 6 *Co-Author: Fanconi Claudio 7 * 8 */ 2 * ORXONOX - the hottest 3D action shooter ever to exist 3 * > www.orxonox.net < 4 * 5 * 6 * License notice: 7 * 8 * This program is free software; you can redistribute it and/or 9 * modify it under the terms of the GNU General Public License 10 * as published by the Free Software Foundation; either version 2 11 * of the License, or (at your option) any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 21 * 22 * Author: 23 * Bolt Nikola 24 * Co-authors: 25 * Claudio Fanconi 26 * 27 * This is the header of the NameableStaticEntity.cc file 28 * In this file we define a constructor, destructor and additional function (which is important to name a planet) 29 * 30 */ 9 31 10 32 #ifndef _NameableStaticEntity_H__ -
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc
r11743 r11745 48 48 { 49 49 RegisterObject(StoryModePawn); 50 enableCollisionCallback();51 50 } 52 51 … … 73 72 } 74 73 75 void StoryModePawn::XMLPort(Element& xmlelement, XMLPort::Mode mode)76 {77 SUPER(StoryModePawn, XMLPort, xmlelement, mode);78 }79 80 74 /** 81 75 @brief -
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h
r11743 r11745 42 42 StoryModePawn(Context* context); 43 43 44 virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;45 46 44 virtual void moveFrontBack(const Vector2& value) override; 47 45
Note: See TracChangeset
for help on using the changeset viewer.