[Orxonox-commit 6967] r11588 - in code/branches/CampaignMap_HS17: data/levels data/overlays src/modules/overlays/hud
boltn at orxonox.net
boltn at orxonox.net
Fri Nov 24 13:15:13 CET 2017
Author: boltn
Date: 2017-11-24 13:15:12 +0100 (Fri, 24 Nov 2017)
New Revision: 11588
Modified:
code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo
code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
Log:
nur einmal auszfuehrenden code aus tick in initialize fkt verschoben
Modified: code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw
===================================================================
--- code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw 2017-11-21 15:51:31 UTC (rev 11587)
+++ code/branches/CampaignMap_HS17/data/levels/NC_StoryModeLevel.oxw 2017-11-24 12:15:12 UTC (rev 11588)
@@ -7,7 +7,6 @@
<?lua
include("stats.oxo")
- include("StoryModeHUD2.oxo")
include("templates/lodInformation.oxt")
include("templates/StoryMode.oxt")
include("HUDTemplates3.oxo")
@@ -31,19 +30,19 @@
<SpawnPoint position="000.000, 000.000, 1000.000" spawnclass=SpaceShip orientation="0, 0, 0, -1" pawndesign= spaceshipescort />
- <StoryModePlanet levelName="gaggiplanet1" position="0,0,0" direction="0,0,0">
+ <StoryModePlanet levelName="plizzanet1" position="0,0,0" direction="0,0,0">
<attached>
<Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
</attached>
</StoryModePlanet>
-<StoryModePlanet levelName="gaggiplanet2" position="600,0,0" direction="0,0,0">
+<StoryModePlanet levelName="plizzanet2" position="600,0,0" direction="0,0,0">
<attached>
<Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
</attached>
</StoryModePlanet>
-<StoryModePlanet levelName="gaggiplanet3" position="1200,0,0" direction="0,0,0">
+<StoryModePlanet levelName="plizzanet3" position="1200,0,0" direction="0,0,0">
<attached>
<Model position="0,0,0" mesh="planets/moon.mesh" scale=100 />
</attached>
Modified: code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo
===================================================================
--- code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo 2017-11-21 15:51:31 UTC (rev 11587)
+++ code/branches/CampaignMap_HS17/data/overlays/HUDTemplates3.oxo 2017-11-24 12:15:12 UTC (rev 11588)
@@ -54,7 +54,7 @@
name = "StoryMode"
correctaspect = false
font = "Monofur"
- textSize = 0.05
+ textSize = 0.01
align = "center"
/>
Modified: code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo
===================================================================
--- code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo 2017-11-21 15:51:31 UTC (rev 11587)
+++ code/branches/CampaignMap_HS17/data/overlays/StoryModeHUD2.oxo 2017-11-24 12:15:12 UTC (rev 11588)
@@ -7,7 +7,7 @@
name = "StoryMode"
correctaspect = true
font = "Arial"
- textSize = 0.5
+ textSize = 0.01f
/>
</OverlayGroup>
Modified: code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc
===================================================================
--- code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc 2017-11-21 15:51:31 UTC (rev 11587)
+++ code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.cc 2017-11-24 12:15:12 UTC (rev 11588)
@@ -91,40 +91,49 @@
float yScale = this->getActualSize().y;
- for(unsigned int i = 0; i < ObjectList<StoryModePlanet>().size(); i++){
+ int i = 0;
+ for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
+
Ogre::TextAreaOverlayElement* text = static_cast<Ogre::TextAreaOverlayElement*>( Ogre::OverlayManager::getSingleton()
.createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
texts.push_back(text);
- //text->setFontName(this->fontName_);
- //text->setCharHeight(this->textSize_ * yScale);
texts[i]->setDimensions(xScale, yScale);
+ //PROBLEM: function doesn't get called automatically by the xml macro,
+ //which is why we need to call it manually here. works with storymodeplanet.h...
+ this->setFont("Monofur");
+ this->setTextSize(0.05f);
+
+ //font name of the text needs to be set here, not in the xml setter function
+ texts[i]->setFontName(this->fontName_);
+ texts[i]->setCharHeight(this->textSize_ * yScale);
+
+ //set text
+ texts[i]->setCaption(planet->getLevelName());
+
texts[i]->hide();
this->background_->addChild(texts[i]);
+ i++;
}
- //this->setFont("Monofur");
- //this->setTextSize("0.5f");
}
- // Set the Font size of the Text.
+ // Set the Font of this HUD.
void StoryModeHUD::setFont(const std::string& font)
{
const Ogre::ResourcePtr& fontPtr = Ogre::FontManager::getSingleton().getByName(font);
if (fontPtr.isNull())
{
- orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found" << endl;
+ this->fontName_ = "Monofur";
+ orxout(internal_warning) << "StoryModeHUD: Font '" << font << "' not found. Font has been set to Monofur." << endl;
return;
}
this->fontName_ = font;
- for(Ogre::TextAreaOverlayElement* text : texts)
- if(text != nullptr)
- text->setFontName(this->fontName_);
}
- // Gets the Font of the Text
+ // Gets the Font of this HUD
const std::string& StoryModeHUD::getFont() const
{
return this->fontName_;
@@ -135,7 +144,8 @@
{
if (size <= 0.0f)
{
- orxout(internal_warning) << "StoryModeHUD: Negative font size not allowed" << endl;
+ this->textSize_ = 0.05f;
+ orxout(internal_warning) << "StoryModeHUD: Non positive font size not allowed. Font size has been set to 0.05" << endl;
return;
}
this->textSize_ = size;
@@ -164,9 +174,6 @@
int i = 0;
for(StoryModePlanet* planet : ObjectList<StoryModePlanet>()){
- //display name next to cursor
- texts[i]->setCaption(planet->getLevelName());
-
// Transform to screen coordinates
Vector3 pos = camTransform * planet->getWorldPosition();
Modified: code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h
===================================================================
--- code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h 2017-11-21 15:51:31 UTC (rev 11587)
+++ code/branches/CampaignMap_HS17/src/modules/overlays/hud/StoryModeHUD.h 2017-11-24 12:15:12 UTC (rev 11588)
@@ -53,10 +53,10 @@
private:
std::vector<Ogre::TextAreaOverlayElement*> texts;
void initialize();
- void setTextSize(float size);
- float getTextSize() const;
+ virtual void setTextSize(float size);
+ virtual float getTextSize() const;
- void setFont(const std::string& font);
+ virtual void setFont(const std::string& font);
const std::string& getFont() const;
std::string fontName_;
More information about the Orxonox-commit
mailing list