[2225] | 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" |
---|
[2320] | 28 | #include "Scoreboard.h" |
---|
[2225] | 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" |
---|
[2320] | 40 | #include "objects/gametypes/Gametype.h" |
---|
| 41 | #include "CreateLines.h" |
---|
[2225] | 42 | |
---|
| 43 | namespace orxonox |
---|
| 44 | { |
---|
| 45 | CreateFactory(Scoreboard); |
---|
| 46 | |
---|
| 47 | /** |
---|
[2320] | 48 | @brief Constructor: Creates the scoreboard. |
---|
[2225] | 49 | */ |
---|
| 50 | Scoreboard::Scoreboard(BaseObject* creator) |
---|
| 51 | : OrxonoxOverlay(creator) |
---|
| 52 | { |
---|
| 53 | RegisterObject(Scoreboard); |
---|
| 54 | } |
---|
| 55 | |
---|
[2320] | 56 | /** |
---|
| 57 | @brief Prints the scoreboard on the screen. |
---|
| 58 | */ |
---|
| 59 | void Scoreboard::printLines() { |
---|
| 60 | |
---|
| 61 | numberOfColumns = 2; |
---|
| 62 | numberOfLines = this->gametype_->getNumberOfPlayers(); |
---|
| 63 | columnIndex = 0; |
---|
| 64 | topOffset = 0.3; |
---|
| 65 | lineSpacing = 0.1; |
---|
| 66 | |
---|
| 67 | for (unsigned int i = 0; i < numberOfLines; i++) { |
---|
| 68 | |
---|
| 69 | leftOffset = 0.3; |
---|
| 70 | |
---|
| 71 | this->createlines_->setNumberOfColumns(numberOfColumns, i); |
---|
| 72 | |
---|
| 73 | columnText = this->gametype_->getPlayersName(); |
---|
| 74 | this->createlines_->alignColumn(columnIndex, topOffset, leftOffset); |
---|
| 75 | this->createlines_->setColumnText(columnIndex, columnText); |
---|
| 76 | |
---|
| 77 | columnIndex++; |
---|
| 78 | leftOffset = leftOffset + 0.4; |
---|
| 79 | |
---|
| 80 | columnText = this->gametype_->getPlayersFrags(); |
---|
| 81 | this->createlines_->alignColumn(columnIndex, topOffset, leftOffset); |
---|
| 82 | this->createlines_->setColumnText(columnIndex, columnText); |
---|
| 83 | |
---|
| 84 | topOffset = topOffset + lineSpacing; |
---|
| 85 | |
---|
| 86 | } |
---|
| 87 | |
---|
| 88 | } |
---|
| 89 | |
---|
[2225] | 90 | } |
---|