[Orxonox-commit 7128] r11745 - in code/branches/Presentation_HS17_merge/src: modules/overlays/hud orxonox/worldentities orxonox/worldentities/pawns
landauf at orxonox.net
landauf at orxonox.net
Thu Feb 15 00:11:04 CET 2018
Author: landauf
Date: 2018-02-15 00:11:04 +0100 (Thu, 15 Feb 2018)
New Revision: 11745
Modified:
code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.cc
code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc
code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h
Log:
[CampaignMap_HS17] some cleanup
Modified: code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.cc 2018-02-14 22:44:50 UTC (rev 11744)
+++ code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.cc 2018-02-14 23:11:04 UTC (rev 11745)
@@ -65,11 +65,16 @@
StoryModeHUD::StoryModeHUD(Context* context) : OrxonoxOverlay(context)
{
RegisterObject(StoryModeHUD);
+
+ this->textSize_ = 1.0;
}
// Destructor of the StoryMode HUD
StoryModeHUD::~StoryModeHUD()
- {}
+ {
+ for(Ogre::TextAreaOverlayElement* text : texts)
+ Ogre::OverlayManager::getSingleton().destroyOverlayElement(text);
+ }
// Functions of the StoryMode HUD
@@ -91,7 +96,6 @@
//Sets the Camera angle at 30 degrees above it, so levels can be seen better
CameraManager::getInstance().getActiveCamera()->setOrientation(Vector3::UNIT_X, Degree(-30));
- int i = 0;
for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){
@@ -99,19 +103,18 @@
.createOverlayElement("TextArea", "StoryModeHUD_navText_" + getUniqueNumberString()));
texts.push_back(text);
- texts[i]->setDimensions(xScale, yScale);
+ text->setDimensions(xScale, yScale);
//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);
+ text->setFontName(this->fontName_);
+ text->setCharHeight(this->textSize_ * yScale);
//set text
- texts[i]->setCaption(planet->getLevelName());
+ text->setCaption(planet->getLevelName());
- texts[i]->hide();
+ text->hide();
- this->background_->addChild(texts[i]);
- i++;
+ this->background_->addChild(text);
}
}
@@ -169,8 +172,13 @@
// camTransform is a Matrix, which converts 3D world of the game into 2D on your screen
const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
- int i = 0;
+ size_t i = 0;
for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){
+ if (i >= texts.size()) {
+ break;
+ }
+ Ogre::TextAreaOverlayElement* text = texts[i];
+ i++;
// Transform to screen coordinates
Vector3 pos = camTransform * planet->getWorldPosition();
@@ -179,14 +187,12 @@
if (!(pos.z > 1.0)){
// Position text
- texts[i]->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
- texts[i]->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions
+ text->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
+ text->setTop((-pos.y+1)/2); // With those two calculations we set the desired positions
// Make sure the overlays are shown
- texts[i]->show();
+ text->show();
}
- i++;
-
}
}
-}
\ No newline at end of file
+}
Modified: code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h 2018-02-14 22:44:50 UTC (rev 11744)
+++ code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h 2018-02-14 23:11:04 UTC (rev 11745)
@@ -49,16 +49,16 @@
virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
virtual void tick(float dt) override;
-
private:
- std::vector<Ogre::TextAreaOverlayElement*> texts;
void initialize();
- virtual void setTextSize(float size);
- virtual float getTextSize() const;
- virtual void setFont(const std::string& font);
+ void setTextSize(float size);
+ float getTextSize() const;
+
+ void setFont(const std::string& font);
const std::string& getFont() const;
+ std::vector<Ogre::TextAreaOverlayElement*> texts;
std::string fontName_;
float textSize_;
bool firstTick = true;
Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h 2018-02-14 22:44:50 UTC (rev 11744)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h 2018-02-14 23:11:04 UTC (rev 11745)
@@ -1,11 +1,33 @@
/*
-*This is the header of the NameableStaticEntity.cc file
-*In this file we define a constructor, destructor and additional function (which is important to name a planet)
-*
-*Author: Bolt Nikole
-*Co-Author: Fanconi Claudio
-*
-*/
+ * ORXONOX - the hottest 3D action shooter ever to exist
+ * > www.orxonox.net <
+ *
+ *
+ * License notice:
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * Author:
+ * Bolt Nikola
+ * Co-authors:
+ * Claudio Fanconi
+ *
+ * This is the header of the NameableStaticEntity.cc file
+ * In this file we define a constructor, destructor and additional function (which is important to name a planet)
+ *
+ */
#ifndef _NameableStaticEntity_H__
#define _NameableStaticEntity_H__
@@ -33,4 +55,4 @@
std::string levelName_;
};
}
-#endif
\ No newline at end of file
+#endif
Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc 2018-02-14 22:44:50 UTC (rev 11744)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc 2018-02-14 23:11:04 UTC (rev 11745)
@@ -47,7 +47,6 @@
StoryModePawn::StoryModePawn(Context* context) : SpaceShip(context)
{
RegisterObject(StoryModePawn);
- enableCollisionCallback();
}
void StoryModePawn::moveFrontBack(const Vector2& value)
@@ -72,11 +71,6 @@
Pawn::rotateYaw(value);
}
- void StoryModePawn::XMLPort(Element& xmlelement, XMLPort::Mode mode)
- {
- SUPER(StoryModePawn, XMLPort, xmlelement, mode);
- }
-
/**
@brief
Removed, does nothing.
Modified: code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h
===================================================================
--- code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h 2018-02-14 22:44:50 UTC (rev 11744)
+++ code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h 2018-02-14 23:11:04 UTC (rev 11745)
@@ -41,8 +41,6 @@
public:
StoryModePawn(Context* context);
- virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
-
virtual void moveFrontBack(const Vector2& value) override;
virtual void moveRightLeft(const Vector2& value) override;
More information about the Orxonox-commit
mailing list