Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 2837 was 2662, checked in by rgrieder, 16 years ago

Merged presentation branch back to trunk.

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