Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/shader/src/orxonox/hud/RadarObject.cc @ 2274

Last change on this file since 2274 was 1505, checked in by rgrieder, 17 years ago

f* svn: It doesn't even inform you if you attempt to set a non existing property. It is svn:eol-style and not eol-style when using the command by the way…

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