Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/presentation/src/orxonox/overlays/stats/Scoreboard.cc @ 2492

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

Merged overlay branch into presentation branch.

File size: 3.0 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 "OrxonoxStableHeaders.h"
28#include "Scoreboard.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#include "objects/gametypes/Gametype.h"
41#include "CreateLines.h"
42
43namespace orxonox
44{
45    CreateFactory(Scoreboard);
46
47    /**
48        @brief Constructor: Creates the scoreboard.
49    */
50    Scoreboard::Scoreboard(BaseObject* creator)
51        : OrxonoxOverlay(creator)
52    {
53        RegisterObject(Scoreboard);
54
55        createlines_ = new CreateLines(this);
56        // this->gametype_ = new Gametype(this);
57    }
58
59    /**
60        @brief Initializes the lines.
61    */
62    void Scoreboard::XMLPort(Element& xmlElement, XMLPort::Mode mode)
63    {
64        SUPER(Scoreboard, XMLPort, xmlElement, mode);
65
66        printLines();
67
68        COUT(0) << "XMLPort executed." << std::endl;
69
70    }
71
72    /**
73        @brief Prints the scoreboard on the screen.
74    */
75    void Scoreboard::printLines() {
76
77        numberOfColumns = 2;
78        // numberOfLines = this->gametype_->getNumberOfPlayers();
79        numberOfLines = 3;
80        topOffset = 0.1;
81        lineSpacing = 0.1;
82
83        for (unsigned int i = 0; i < numberOfLines; i++) {
84
85            columnIndex = 0;
86            leftOffset = 0.1;
87
88            this->createlines_->setNumberOfColumns(numberOfColumns, i);
89
90            // columnText = this->gametype_->getPlayersName();
91            columnText = "PlayerName";
92            this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
93            this->createlines_->setColumnText(columnIndex, columnText);
94
95            columnIndex++;
96            leftOffset = leftOffset + 0.3;
97
98            // columnText = this->gametype_->getPlayersFrags();
99            columnText = "PlayerFrags";
100            this->createlines_->alignColumn(columnIndex, topOffset, leftOffset);
101            this->createlines_->setColumnText(columnIndex, columnText);
102
103            topOffset = topOffset + lineSpacing;
104
105        }
106
107    }
108
109}
Note: See TracBrowser for help on using the repository browser.