Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 5944 was 5929, checked in by rgrieder, 15 years ago

Merged core5 branch back to the trunk.
Key features include clean level unloading and an extended XML event system.

Two important notes:
Delete your keybindings.ini files! * or you will still get parser errors when loading the key bindings.
Delete build_dir/lib/modules/libgamestates.module! * or orxonox won't start.
Best thing to do is to delete the build folder ;)

  • Property svn:eol-style set to native
File size: 4.1 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);
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));
[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    }
[2200]89
[2495]90    /**
91        @brief Ensures that the number of OverlayElements is equal to numberOfColumns.
92    */
93    //void CreateLines::setNumberOfColumns(unsigned int numberOfColumns, unsigned int lineIndex) {
[2222]94
[2495]95    //    Ogre::OverlayManager* ovMan = Ogre::OverlayManager::getSingletonPtr();
[2386]96
[2495]97    //    unsigned int colIndex = 0;
[2222]98
[2495]99    //    while (textColumns_.size() < numberOfColumns)
100    //    {
[3280]101    //        Ogre::TextAreaOverlayElement* tempTextArea = static_cast<Ogre::TextAreaOverlayElement*>(ovMan->createOverlayElement("TextArea", "StatsLineTextArea" + getName() + multi_cast<std::string>(lineIndex) + multi_cast<std::string>(colIndex)));
[2495]102    //        textColumns_.push_back(tempTextArea);
103    //        this->background_->addChild(tempTextArea);
[2222]104
[2495]105    //        colIndex++;
106    //    }
[2222]107
[2495]108    //    while (textColumns_.size() > numberOfColumns)
109    //    {
110    //        this->background_->_removeChild(textColumns_.back());
111    //        ovMan->destroyOverlayElement(textColumns_.back());
112    //        textColumns_.pop_back();
113    //    }
114    //}
[2222]115
[2495]116    //void CreateLines::alignColumn(int columnIndex, float leftOffset, float topOffset)
117    //{
118    //    this->textColumns_[columnIndex]->setPosition(leftOffset, topOffset);
119    //}
[2200]120
[2495]121    //void CreateLines::setColumnText(int columnIndex, std::string columnText)
122    //{
123    //    this->textColumns_[columnIndex]->setCaption(columnText);
124    //}
[2200]125}
Note: See TracBrowser for help on using the repository browser.