Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 1480 was 1480, checked in by rgrieder, 16 years ago
  • updated msvc files and OrxonoxStableHeaders.h
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
[1480]29#include "OrxonoxStableHeaders.h"
30#include "RadarObject.h"
31
[1450]32#include <OgreOverlayManager.h>
33#include <OgreStringConverter.h>
34#include "GraphicsEngine.h"
[1346]35
36namespace orxonox
37{
38    using namespace Ogre;
39
[1410]40    int RadarObject::count = 0;         // initialize static variable
[1346]41
[1450]42    RadarObject::RadarObject(OverlayContainer* container, SceneNode* node, int colour){
[1410]43        container_ = container;
[1450]44        node_ = node;
45        colour_ = colour;
[1410]46        om = &OverlayManager::getSingleton();
47        panel_ = static_cast<PanelOverlayElement*>(om->createOverlayElement("Panel",
[1450]48            "Object"+StringConverter::toString(count)));
49        setColour(colour_);
[1410]50        panel_->setDimensions(3,3);
[1346]51        panel_->setMetricsMode(Ogre::GMM_PIXELS);
52        panel_->show();
53        index_ = count;
54        count++;
55        container_->addChild(panel_);
[1410]56    }
[1450]57
58    RadarObject::~RadarObject(){
[1456]59        delete panel_;
[1450]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    }
[1456]80
81    SceneNode* RadarObject::getNode(){
82        return node_;
83    }
[1346]84}
[1450]85
Note: See TracBrowser for help on using the repository browser.