Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/core5/src/modules/overlays/stats/CreateLines.cc @ 5962

Last change on this file since 5962 was 5800, checked in by landauf, 15 years ago

replaced delete with destroy() in modules

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