Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2008, 5:46:52 AM (16 years ago)
Author:
landauf
Message:
  • several small changes in most of the HUD classes (code cleanup): removed obsolete variables, privatized all member variables, removed resizing functioncalls from tick, destroying overlayelements, added some const qualifiers.
  • moved calculation functions for RadarObject-position to Math.h and changed the phi/right/radius format to Vector2. the functions are used too by SpaceShipAI.
  • cycleNavigationFocus takes the nearest object if focus was NULL
  • BarOverlayElement works in both directions (left to right and right to left)
  • fixed bug causing SpaceShipAI to not stop shooting when losing target - this also speeds up orxonox a lot, because there are less projectiles

####################################

!! UPDATE YOUR MEDIA REPOSITORY !!

####################################
…or the BarOverlayElement will look strange

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/hud/RadarObject.cc

    r1563 r1564  
    2323 *      Felix Schulthess
    2424 *   Co-authors:
    25  *      ...
     25 *      Fabian 'x3n' Landau
    2626 *
    2727 */
     
    3535
    3636#include "GraphicsEngine.h"
     37#include "objects/WorldEntity.h"
    3738#include "util/Convert.h"
    3839
     
    4344    {
    4445        public:
    45             bool operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y)
     46            bool operator()(const orxonox::ColourValue& __x, const orxonox::ColourValue& __y) const
    4647            {
    4748                if (__x.r == __y.r)
     
    6869    std::map<std::string, std::map<ColourValue, std::string> > RadarObject::materials_s;
    6970
    70     RadarObject::RadarObject(Ogre::OverlayContainer* container, Ogre::SceneNode* node, const ColourValue& colour, const std::string& texturename)
     71    RadarObject::RadarObject(Ogre::OverlayContainer* container, WorldEntity* object, const ColourValue& colour, const std::string& texturename)
    7172    {
    7273        this->colour_ = colour;
    7374        this->texturename_ = texturename;
    7475
    75         this->container_ = container;
    76         this->node_ = node;
     76        this->object_ = object;
    7777
    78         this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarObject" + getConvertedValue<unsigned int, std::string>(RadarObject::count_s)));
     78        this->panel_ = static_cast<Ogre::PanelOverlayElement*>(Ogre::OverlayManager::getSingleton().createOverlayElement("Panel", "RadarObject" + getConvertedValue<unsigned int, std::string>(RadarObject::count_s++)));
    7979        this->setMaterial(colour, texturename);
    8080
    81         this->panel_->setDimensions(3,3);
     81        this->panel_->setDimensions(3, 3);
    8282        this->panel_->setMetricsMode(Ogre::GMM_PIXELS);
    8383        this->panel_->show();
    8484
    85         this->index_ = count_s++;
    86         this->container_->addChild(panel_);
     85        container->addChild(panel_);
    8786    }
    8887
    8988    RadarObject::~RadarObject()
    9089    {
    91         delete panel_;
     90        Ogre::OverlayManager::getSingleton().destroyOverlayElement(this->panel_);
    9291    }
    9392
     
    116115    }
    117116
    118     Vector3 RadarObject::getPosition()
     117    const Vector3& RadarObject::getPosition() const
    119118    {
    120         return node_->getPosition();
     119        return this->object_->getPosition();
    121120    }
    122121
    123     Ogre::SceneNode* RadarObject::getNode()
     122    const Vector3& RadarObject::getVelocity() const
    124123    {
    125         return node_;
     124        return this->object_->getVelocity();
    126125    }
    127126}
Note: See TracChangeset for help on using the changeset viewer.