Changeset 11588 for code/branches
- Timestamp:
- Nov 24, 2017, 1:15:12 PM (7 years ago)
- Location:
- code/branches/CampaignMap_HS17
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
r11584 r11588 8 8 <?lua 9 9 include("stats.oxo") 10 include("StoryModeHUD2.oxo")11 10 include("templates/lodInformation.oxt") 12 11 include("templates/StoryMode.oxt") … … 32 31 33 32 34 <StoryModePlanet levelName=" gaggiplanet1" position="0,0,0" direction="0,0,0">33 <StoryModePlanet levelName="plizzanet1" position="0,0,0" direction="0,0,0"> 35 34 <attached> 36 35 <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 /> … … 38 37 </StoryModePlanet> 39 38 40 <StoryModePlanet levelName=" gaggiplanet2" position="600,0,0" direction="0,0,0">39 <StoryModePlanet levelName="plizzanet2" position="600,0,0" direction="0,0,0"> 41 40 <attached> 42 41 <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 /> … … 44 43 </StoryModePlanet> 45 44 46 <StoryModePlanet levelName=" gaggiplanet3" position="1200,0,0" direction="0,0,0">45 <StoryModePlanet levelName="plizzanet3" position="1200,0,0" direction="0,0,0"> 47 46 <attached> 48 47 <Model position="0,0,0" mesh="planets/moon.mesh" scale=100 /> -
code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo
r11560 r11588 55 55 correctaspect = false 56 56 font = "Monofur" 57 textSize = 0.0 557 textSize = 0.01 58 58 align = "center" 59 59 /> -
code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo
r11584 r11588 8 8 correctaspect = true 9 9 font = "Arial" 10 textSize = 0. 510 textSize = 0.01f 11 11 /> 12 12 -
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
r11584 r11588 92 92 93 93 94 for(unsigned int i = 0; i < ObjectList<StoryModePlanet>().size(); i++){ 94 int i = 0; 95 for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){ 96 95 97 96 98 Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton() … … 98 100 99 101 texts.push_back(text); 100 //text->setFontName(this->fontName_);101 //text->setCharHeight(this->textSize_ * yScale);102 102 texts[i]->setDimensions(xScale, yScale); 103 104 //PROBLEM: function doesn't get called automatically by the xml macro, 105 //which is why we need to call it manually here. works with storymodeplanet.h... 106 this->setFont("Monofur"); 107 this->setTextSize(0.05f); 108 109 //font name of the text needs to be set here, not in the xml setter function 110 texts[i]->setFontName(this->fontName_); 111 texts[i]->setCharHeight(this->textSize_ * yScale); 112 113 //set text 114 texts[i]->setCaption(planet->getLevelName()); 103 115 104 116 texts[i]->hide(); 105 117 106 118 this->background_->addChild(texts[i]); 119 i++; 107 120 } 108 //this->setFont("Monofur");109 //this->setTextSize("0.5f");110 121 } 111 122 112 // Set the Font size of the Text.123 // Set the Font of this HUD. 113 124 void StoryModeHUD::setFont(const std::string& font) 114 125 { … … 116 127 if (fontPtr.isNull()) 117 128 { 118 orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found" << endl; 129 this->fontName_ = "Monofur"; 130 orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found. Font has been set to Monofur." << endl; 119 131 return; 120 132 } 121 133 this->fontName_ = font; 122 for(Ogre::TextAreaOverlayElement* text : texts)123 if(text != nullptr)124 text->setFontName(this->fontName_);125 134 } 126 135 127 // Gets the Font of th e Text136 // Gets the Font of this HUD 128 137 const std::string& StoryModeHUD::getFont() const 129 138 { … … 136 145 if (size <= 0.0f) 137 146 { 138 orxout(internal_warning) << "StoryModeHUD: Negative font size not allowed" << endl; 147 this->textSize_ = 0.05f; 148 orxout(internal_warning) << "StoryModeHUD: Non positive font size not allowed. Font size has been set to 0.05" << endl; 139 149 return; 140 150 } … … 165 175 for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){ 166 176 167 //display name next to cursor168 texts[i]->setCaption(planet->getLevelName());169 170 177 // Transform to screen coordinates 171 178 Vector3 pos = camTransform * planet->getWorldPosition(); -
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
r11584 r11588 54 54 std::vector<Ogre::TextAreaOverlayElement*> texts; 55 55 void initialize(); 56 v oid setTextSize(float size);57 float getTextSize() const;56 virtual void setTextSize(float size); 57 virtual float getTextSize() const; 58 58 59 v oid setFont(const std::string& font);59 virtual void setFont(const std::string& font); 60 60 const std::string& getFont() const; 61 61
Note: See TracChangeset
for help on using the changeset viewer.