Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/orxonox/overlays/stats/CreateLines.cc @ 3128

Last change on this file since 3128 was 3110, checked in by rgrieder, 16 years ago

Removed old msvc specific support for precompiled header files.

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