Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/overlays/stats/CreateLines.cc @ 9847

Last change on this file since 9847 was 6502, checked in by rgrieder, 15 years ago

Removed a ton of msvc warnings revealed with OGRE v1.7 (they removed the warning suppressors in OgrePrerequisites.h).
All of them are conversions from one type to another that might be lossy (mostly double to float, please always use "3.7f" instead of "3.7" as constants when using floats).

  • Property svn:eol-style set to native
File size: 4.7 KB
RevLine 
[2200]1/*
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 *      Benjamin Hildebrandt
24 *
25 */
26
27#include "CreateLines.h"
28
[2495]29#include "overlays/OverlayText.h"
30#include "overlays/stats/Stats.h"
31
[2200]32namespace orxonox
33{
34    /**
[2320]35        @brief Constructor: Creates a line.
[2200]36    */
[2495]37    CreateLines::CreateLines(float leftOffset, float topOffset, float width, float height)
[2200]38    {
[2495]39        playerNameText_ = new OverlayText(0);
[6502]40        playerNameText_->setTextSize(0.04f);
41        playerNameText_->setColour(ColourValue(0.0f, 0.75f, 0.2f, 1.0f));
42        playerNameText_->setPosition(Vector2(0.1f, topOffset + 0.01f));
[2495]43
44        scoreText_ = new OverlayText(0);
[6502]45        scoreText_->setTextSize(0.04f);
46        scoreText_->setColour(ColourValue(0.0f, 0.75f, 0.2f, 1.0f));
47        scoreText_->setPosition(Vector2(0.6f, topOffset + 0.01f));
[2495]48
49        deathsText_ = new OverlayText(0);
[6502]50        deathsText_->setTextSize(0.04f);
51        deathsText_->setColour(ColourValue(0, 0.75f, 0.2f, 1.0f));
52        deathsText_->setPosition(Vector2(0.8f, topOffset + 0.01f));
[2495]53
54        background_ = new Stats(0);
55        background_->setPosition(Vector2(leftOffset, topOffset));
56        background_->setSize(Vector2(width, height));
[2200]57    }
58
[2495]59    CreateLines::~CreateLines()
[2200]60    {
[5929]61        this->playerNameText_->destroy();
62        this->scoreText_->destroy();
63        this->deathsText_->destroy();
64        this->background_->destroy();
[2200]65    }
66
[2495]67    void CreateLines::setPlayerName(const std::string& str)
68    {
69        this->playerNameText_->setCaption(str);
70    }
[2200]71
[2495]72    void CreateLines::setScore(const std::string& str)
73    {
74        this->scoreText_->setCaption(str);
75    }
[2200]76
[2495]77    void CreateLines::setDeaths(const std::string& str)
78    {
79        this->deathsText_->setCaption(str);
80    }
[2386]81
[2495]82    void CreateLines::setVisibility(bool visible)
83    {
84        this->scoreText_->setVisible(visible);
85        this->deathsText_->setVisible(visible);
86        this->playerNameText_->setVisible(visible);
87        this->background_->setVisible(visible);
88    }
[5980]89    void CreateLines::changedVisibility()
90    {
91        this->scoreText_->changedVisibility();
92        this->deathsText_->changedVisibility();
93        this->playerNameText_->changedVisibility();
94        this->background_->changedVisibility();
95    }
[6417]96
[5980]97    void CreateLines::setOverlayGroup( OverlayGroup* group )
98    {
99        this->scoreText_->setOverlayGroup( group );
100        this->deathsText_->setOverlayGroup( group );
101        this->playerNameText_->setOverlayGroup( group );
102        this->background_->setOverlayGroup( group );
103    }
[2200]104
[2495]105    /**
106        @brief Ensures that the number of OverlayElements is equal to numberOfColumns.
107    */
108    //void CreateLines::setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex) {
[2222]109
[2495]110    //    Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
[2386]111
[2495]112    //    unsigned int colIndex = 0;
[2222]113
[2495]114    //    while (textColumns_.size() < numberOfColumns)
115    //    {
[3280]116    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + multi_cast<std::string>(lineIndex) + multi_cast<std::string>(colIndex)));
[2495]117    //        textColumns_.push_back(tempTextArea);
118    //        this->background_->addChild(tempTextArea);
[2222]119
[2495]120    //        colIndex++;
121    //    }
[2222]122
[2495]123    //    while (textColumns_.size() > numberOfColumns)
124    //    {
125    //        this->background_->_removeChild(textColumns_.back());
126    //        ovMan->destroyOverlayElement(textColumns_.back());
127    //        textColumns_.pop_back();
128    //    }
129    //}
[2222]130
[2495]131    //void CreateLines::alignColumn(int columnIndex, float leftOffset, float topOffset)
132    //{
133    //    this->textColumns_[columnIndex]->setPosition(leftOffset, topOffset);
134    //}
[2200]135
[2495]136    //void CreateLines::setColumnText(int columnIndex, std::string columnText)
137    //{
138    //    this->textColumns_[columnIndex]->setCaption(columnText);
139    //}
[2200]140}
Note: See TracBrowser for help on using the repository browser.