Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 8, 2008, 5:46:52 AM (17 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/HUD.h

    r1562 r1564  
    3535#include <OgrePrerequisites.h>
    3636#include <OgreTextAreaOverlayElement.h>
    37 #include <OgreSceneNode.h>
    3837#include "objects/Tickable.h"
    3938#include "util/Math.h"
     
    4342    class _OrxonoxExport HUD : public TickableReal
    4443    {
    45       private:
    46         HUD();
    47         HUD(HUD& instance);
    48         ~HUD();
    49         Ogre::OverlayManager* om;
    50         Ogre::SceneManager* sm;
    51         Ogre::Overlay* orxonoxHUD;
    52         Ogre::OverlayContainer* container;
    53         Ogre::TextAreaOverlayElement* fpsText;
    54         Ogre::TextAreaOverlayElement* rTRText;
    55         BarOverlayElement* energyBar;
    56         BarOverlayElement* speedoBar;
    57         RadarOverlayElement* radar;
    58         Navigation* nav;
     44      public:
     45        static HUD& getSingleton();
     46        virtual void tick(float);
    5947
    60         bool showFPS;
    61         bool showRenderTime;
    62 
    63       public:
    64         virtual void tick(float);
    65         void addRadarObject(Ogre::SceneNode* node, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
    66         void removeRadarObject(Ogre::SceneNode* node);
     48        void resize();
     49        void addRadarObject(WorldEntity* object, const ColourValue& colour = ColourValue(0.5, 0.5, 0.5, 1));
     50        void removeRadarObject(WorldEntity* object);
    6751        void setRenderTimeRatio(float ratio);
    6852        void setFPS();
    6953
    70         std::set<RadarObject*> roSet;
     54        inline std::list<RadarObject*>& getRadarObjects()
     55            { return this->roSet_; }
     56
     57        static void setEnergy(float value);
     58        static void cycleNavigationFocus();
     59        static void releaseNavigationFocus();
     60        static void toggleFPS();
     61        static void toggleRenderTime();
     62
     63      private:
     64        HUD();
     65        HUD(const HUD& instance);
     66        ~HUD();
    7167
    7268        static HUD* instance_s;
    73         static HUD& getSingleton();
    74         static void setEnergy(float value);
    75         static void cycleNavigationFocus();
    76         static void toggleFPS();
    77         static void toggleRenderTime();
     69
     70        std::list<RadarObject*> roSet_;
     71        Ogre::Overlay* orxonoxHUD_;
     72        Ogre::OverlayContainer* container_;
     73        BarOverlayElementFactory* barOverlayElementFactory_;
     74        RadarOverlayElementFactory* radarOverlayElementFactory_;
     75        Ogre::TextAreaOverlayElement* fpsText_;
     76        Ogre::TextAreaOverlayElement* rTRText_;
     77        BarOverlayElement* energyBar_;
     78        BarOverlayElement* speedoBar_;
     79        RadarOverlayElement* radar_;
     80        Navigation* nav_;
     81
     82        bool showFPS_;
     83        bool showRenderTime_;
    7884    };
    7985}
Note: See TracChangeset for help on using the changeset viewer.