Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Feb 15, 2018, 12:11:04 AM (7 years ago)
Author:
landauf
Message:

[CampaignMap_HS17] some cleanup

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  
    6666    {
    6767        RegisterObject(StoryModeHUD);
     68
     69        this->textSize_ = 1.0;
    6870    }
    6971
    7072    // Destructor of the StoryMode HUD
    7173    StoryModeHUD::~StoryModeHUD()
    72     {}
     74    {
     75        for(Ogre::TextAreaOverlayElement* text : texts)
     76            Ogre::OverlayManager::getSingleton().destroyOverlayElement(text);
     77    }
    7378
    7479    // Functions of the StoryMode HUD
     
    9297        CameraManager::getInstance().getActiveCamera()->setOrientation(Vector3::UNIT_X, Degree(-30));
    9398
    94         int i = 0;
    9599        for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){
    96100
     
    100104
    101105            texts.push_back(text);
    102             texts[i]->setDimensions(xScale, yScale);
     106            text->setDimensions(xScale, yScale);
    103107
    104108            //font name of the text needs to be set here, not in the xml setter function
    105             texts[i]->setFontName(this->fontName_);
    106             texts[i]->setCharHeight(this->textSize_ * yScale);
     109            text->setFontName(this->fontName_);
     110            text->setCharHeight(this->textSize_ * yScale);
    107111
    108112            //set text
    109             texts[i]->setCaption(planet->getLevelName());
     113            text->setCaption(planet->getLevelName());
    110114
    111             texts[i]->hide();
     115            text->hide();
    112116       
    113             this->background_->addChild(texts[i]);
    114             i++;
     117            this->background_->addChild(text);
    115118        }
    116119    }
     
    170173        const Matrix4& camTransform = cam->getOgreCamera()->getProjectionMatrix() * cam->getOgreCamera()->getViewMatrix();
    171174
    172         int i = 0;
     175        size_t i = 0;
    173176        for(NameableStaticEntity* planet : ObjectList<NameableStaticEntity>()){
     177            if (i >= texts.size()) {
     178                break;
     179            }
     180            Ogre::TextAreaOverlayElement* text = texts[i];
     181            i++;
    174182
    175183            // Transform to screen coordinates
     
    180188                   
    181189                // Position text
    182                 texts[i]->setLeft((pos.x+1)/2); // The (0,0) Coordinate is in the upper left corner.
    183                 texts[i]->setTop((-pos.y+1)/2);  // With those two calculations we set the desired positions
     190                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
    184192
    185193                // Make sure the overlays are shown
    186                 texts[i]->show();
     194                text->show();
    187195            }
    188             i++;
    189 
    190196        }
    191197    }
  • code/branches/Presentation_HS17_merge/src/modules/overlays/hud/StoryModeHUD.h

    r11743 r11745  
    5050            virtual void tick(float dt) override;
    5151
     52        private:
     53            void initialize();
    5254
    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;
    5857
    59             virtual void setFont(const std::string& font);
     58            void setFont(const std::string& font);
    6059            const std::string& getFont() const;
    6160
     61            std::vector<Ogre::TextAreaOverlayElement*> texts;
    6262            std::string fontName_;
    6363            float textSize_;
  • code/branches/Presentation_HS17_merge/src/orxonox/worldentities/NameableStaticEntity.h

    r11743 r11745  
    11/*
    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 */
    931
    1032#ifndef _NameableStaticEntity_H__
  • code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.cc

    r11743 r11745  
    4848    {
    4949        RegisterObject(StoryModePawn);
    50         enableCollisionCallback();
    5150    }
    5251
     
    7372    }
    7473
    75     void StoryModePawn::XMLPort(Element& xmlelement, XMLPort::Mode mode)
    76     {
    77         SUPER(StoryModePawn, XMLPort, xmlelement, mode);
    78     }
    79 
    8074    /**
    8175    @brief
  • code/branches/Presentation_HS17_merge/src/orxonox/worldentities/pawns/StoryModePawn.h

    r11743 r11745  
    4242            StoryModePawn(Context* context);
    4343
    44             virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode) override;
    45 
    4644            virtual void moveFrontBack(const Vector2& value) override;
    4745
Note: See TracChangeset for help on using the changeset viewer.