Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/network/src/orxonox/hud/RadarObject.cc @ 1479

Last change on this file since 1479 was 1456, checked in by FelixSchulthess, 17 years ago

using a std::set for the radar objects, which still has a the small problem, that the first radar object is selected twice when cycling through radar objects

File size: 2.6 KB
RevLine 
[1454]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 *      Felix Schulthess
24 *   Co-authors:
25 *      ...
26 *
27 */
[1346]28
[1450]29#include <OgreOverlayManager.h>
30#include <OgreStringConverter.h>
[1373]31#include "OrxonoxStableHeaders.h"
[1450]32#include "GraphicsEngine.h"
[1346]33#include "RadarObject.h"
34
35namespace orxonox
36{
37    using namespace Ogre;
38
[1410]39    int RadarObject::count = 0;         // initialize static variable
[1346]40
[1450]41    RadarObject::RadarObject(OverlayContainer* container, SceneNode* node, int colour){
[1410]42        container_ = container;
[1450]43        node_ = node;
44        colour_ = colour;
[1410]45        om = &OverlayManager::getSingleton();
46        panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",
[1450]47            "Object"+StringConverter::toString(count)));
48        setColour(colour_);
[1410]49        panel_->setDimensions(3,3);
[1346]50        panel_->setMetricsMode(Ogre::GMM_PIXELS);
51        panel_->show();
52        index_ = count;
53        count++;
54        container_->addChild(panel_);
[1410]55    }
[1450]56
57    RadarObject::~RadarObject(){
[1456]58        delete panel_;
[1450]59    }
60
61    void RadarObject::setColour(int colour){
62        switch(colour){
63        case RED: panel_->setMaterialName("Orxonox/RedDot"); break;
64        case YELLOW: panel_->setMaterialName("Orxonox/YellowDot"); break;
65        case GREEN: panel_->setMaterialName("Orxonox/GreenDot"); break;
66        case BLUE: panel_->setMaterialName("Orxonox/BlueDot"); break;
67        case WHITE: panel_->setMaterialName("Orxonox/WhiteDot"); break;
68        default: panel_->setMaterialName("Orxonox/RedDot"); break;
69        }
70    }
71
72    void RadarObject::resetColour(){
73        setColour(colour_);
74    }
75
76    Vector3 RadarObject::getPosition(){
77        return node_->getPosition();
78    }
[1456]79
80    SceneNode* RadarObject::getNode(){
81        return node_;
82    }
[1346]83}
[1450]84
Note: See TracBrowser for help on using the repository browser.