Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 21, 2008, 2:35:24 PM (16 years ago)
Author:
rgrieder
Message:
  • Dots on the Radar actually disappear now when a Ship gets destroyed…
  • svn save to keep History of HUDText when renaming AND moving
File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/hud/src/orxonox/overlays/hud/HUDRadar.h

    r1613 r1614  
    2222 *   Author:
    2323 *      Yuning Chai
     24 *      Felix Schulthess
    2425 *   Co-authors:
    25  *      Felix Schulthess
     26 *      Reto Grieder
    2627 *
    2728 */
     
    3233#include "OrxonoxPrereqs.h"
    3334
     35#include <vector>
     36#include <map>
    3437#include <OgrePrerequisites.h>
    35 #include <OgrePanelOverlayElement.h>
    3638#include "overlays/OrxonoxOverlay.h"
    37 #include "objects/Tickable.h"
    38 #include "core/BaseObject.h"
    39 #include "util/Math.h"
    40 #include "core/Debug.h"
    41 #include "Radar.h"
     39#include "RadarListener.h"
     40#include "RadarViewable.h"
    4241
    4342namespace orxonox
    4443{
    45     template <class T, int Dummy>
    46     class _OrxonoxExport RadarAttribute : public BaseObject
    47     {
    48       public:
    49         RadarAttribute();
    50         ~RadarAttribute() { }
    51 
    52         void XMLPort(Element& xmlElement, XMLPort::Mode mode);
    53         void loadAttribute(Element& xmlElement, XMLPort::Mode mode);
    54 
    55         void setAttribute(const T& attribute) { this->attribute_ = attribute; }
    56         const T& getAttribute() const { return this->attribute_; }
    57 
    58         void setIndex(unsigned int index);
    59         unsigned int getIndex() { return this->index_; }
    60 
    61       private:
    62         unsigned int index_;
    63         T attribute_;
    64     };
    65 
    66     template <class T, int Dummy>
    67     void RadarAttribute<T, Dummy>::setIndex(unsigned int index)
    68     {
    69         if (index > 0xFF)
    70         {
    71             COUT(1) << "Shape index was larger than 255 while parsing a RadarAttribute. "
    72               << "Using random number!!!" << std::endl;
    73             this->index_ = rand() & 0xFF;
    74         }
    75         else
    76             this->index_ = index;
    77     }
    78 
    79     typedef RadarAttribute<std::string, 1> RadarShape;
    80 
    81     template <>
    82     RadarShape::RadarAttribute() : index_(0)
    83         { RegisterObject(RadarShape); }
    84 
    85     template <>
    86     void RadarShape::XMLPort(Element& xmlElement, XMLPort::Mode mode)
    87     {
    88         BaseObject::XMLPort(xmlElement, mode);
    89         XMLPortParam(RadarShape, "shape", setAttribute, getAttribute, xmlElement, mode);
    90         XMLPortParam(RadarShape, "index", setIndex, getIndex, xmlElement, mode);
    91     }
    92 
    93 
    94     class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public RadarListener//, public Tickable
     44    class _OrxonoxExport HUDRadar : public OrxonoxOverlay, public RadarListener
    9545    {
    9646      public:
     
    9949
    10050        void XMLPort(Element& xmlElement, XMLPort::Mode mode);
    101 
    102         /*void addShape(RadarShape* shape);
    103         RadarShape* getShape(unsigned int index) const;*/
    10451
    10552        float getRadarSensitivity() const { return this->sensitivity_; }
     
    11259        void setMaximumDotSize(float size) { this->maximumDotSize_ = size; }
    11360
    114         //void tick(float dt);
    115 
    116         //void listObjects();
    117 
    11861      private:
    11962        void displayObject(RadarViewable* viewable, bool bIsMarked);
    120         void hideMarker() { this->marker_->hide(); }
    12163        float getRadarSensitivity() { return 1.0f; }
    12264        void radarTick(float dt);
     
    12466        std::map<RadarViewable::Shape, std::string> shapeMaterials_;
    12567
    126         Ogre::PanelOverlayElement* background_;
    127         std::map<RadarViewable*, Ogre::PanelOverlayElement*> radarDots_;
     68        std::vector<Ogre::PanelOverlayElement*> radarDots_;
     69        std::vector<Ogre::PanelOverlayElement*>::iterator itRadarDots_;
    12870        Ogre::PanelOverlayElement* marker_;
    12971
Note: See TracChangeset for help on using the changeset viewer.