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/OrxonoxOverlay.h

    r1604 r1614  
    3939namespace orxonox
    4040{
    41   class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener
    42   {
     41    class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener
     42    {
    4343    public:
    44       Ogre::Overlay* getOverlay() { return this->overlay_; }
    45       OrxonoxOverlay();
    46       virtual ~OrxonoxOverlay();
     44        Ogre::Overlay* getOverlay() { return this->overlay_; }
     45        OrxonoxOverlay();
     46        virtual ~OrxonoxOverlay();
    4747
    48       virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
     48        virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);
    4949
    50       void setAspectCorrection(bool val);
    51       bool getAspectCorrection() { return this->bCorrectAspect_; }
     50        void show() { this->setVisibility(true); }
     51        void hide() { this->setVisibility(false); }
    5252
    53       /** Sets the position of this overlay. */
    54       void setPosition(Vector2 pos) { this->position_ = pos; this->positionChanged(); }
     53        void setAspectCorrection(bool val);
     54        bool getAspectCorrection() { return this->bCorrectAspect_; }
    5555
    56       /** Gets the current position. */
    57       Vector2 getPosition() const { return this->position_; }
     56        /** Sets the position of this overlay. */
     57        void setPosition(Vector2 pos) { this->position_ = pos; this->positionChanged(); }
    5858
    59       /** Scrolls the overlay by the offsets provided. */
    60       void scroll(Vector2 scroll) { this->position_ += scroll; this->positionChanged(); }
     59        /** Gets the current position. */
     60        Vector2 getPosition() const { return this->position_; }
    6161
    62       /** Sets the origin point of this overlay. */
    63       void setOrigin(Vector2 pos) { this->origin_ = pos; this->positionChanged(); }
     62        /** Scrolls the overlay by the offsets provided. */
     63        void scroll(Vector2 scroll) { this->position_ += scroll; this->positionChanged(); }
    6464
    65       /** Gets the origin point of this overlay */
    66       Vector2 getOrigin() const { return this->origin_; }
     65        /** Sets the origin point of this overlay. */
     66        void setOrigin(Vector2 pos) { this->origin_ = pos; this->positionChanged(); }
    6767
    68       /** Sets the rotation applied to this overlay.*/
    69       void setRotation(const Ogre::Radian& angle) { this->angle_ = angle; this->angleChanged(); }
     68        /** Gets the origin point of this overlay */
     69        Vector2 getOrigin() const { return this->origin_; }
    7070
    71       /** Gets the rotation applied to this overlay, in degrees.*/
    72       const Radian& getRotation() const { return this->angle_; }
     71        /** Sets the rotation applied to this overlay.*/
     72        void setRotation(const Ogre::Radian& angle) { this->angle_ = angle; this->angleChanged(); }
    7373
    74       /** Adds the passed in angle to the rotation applied to this overlay. */
    75       void rotate(const Radian& angle) { this->angle_ += angle; this->angleChanged(); }
     74        /** Gets the rotation applied to this overlay, in degrees.*/
     75        const Radian& getRotation() const { return this->angle_; }
    7676
    77       /** Sets the size of this overlay. */
    78       void setSize(const Vector2& size) { this->size_ = size; this->sizeChanged(); }
     77        /** Adds the passed in angle to the rotation applied to this overlay. */
     78        void rotate(const Radian& angle) { this->angle_ += angle; this->angleChanged(); }
    7979
    80       /** Gets the current size (not corrected) */
    81       Vector2 getUncorrectedSize() const { return this->size_; }
     80        /** Sets the size of this overlay. */
     81        void setSize(const Vector2& size) { this->size_ = size; this->sizeChanged(); }
    8282
    83       /** Gets the current size (corrected) */
    84       Vector2 getSize() const { return this->size_ * this->sizeCorrection_; }
     83        /** Gets the current size (not corrected) */
     84        Vector2 getUncorrectedSize() const { return this->size_; }
    8585
    86       /** Gets the current size correction */
    87       Vector2 getSizeCorrection() const { return this->sizeCorrection_; }
     86        /** Gets the current size (corrected) */
     87        Vector2 getSize() const { return this->size_ * this->sizeCorrection_; }
    8888
    89       /** Scales the overlay */
    90       void scale(Vector2 scale) { this->size_ *= scale; this->sizeChanged(); }
     89        /** Gets the current size correction */
     90        Vector2 getSizeCorrection() const { return this->sizeCorrection_; }
     91
     92        /** Scales the overlay */
     93        void scale(Vector2 scale) { this->size_ *= scale; this->sizeChanged(); }
    9194
    9295    protected:
    93       virtual void changedVisibility();
    94       virtual void sizeChanged();
    95       virtual void angleChanged();
    96       virtual void positionChanged();
    97       float getWindowAspectRatio() { return windowAspectRatio_; }
     96        virtual void changedVisibility();
     97        virtual void sizeChanged();
     98        virtual void angleChanged();
     99        virtual void positionChanged();
     100        float getWindowAspectRatio() { return windowAspectRatio_; }
    98101
    99       Ogre::Overlay* overlay_;
     102        void setBackgroundMaterial(const std::string& material);
     103        std::string getBackgroundMaterial() const;
     104
     105        Ogre::Overlay* overlay_;
     106        Ogre::PanelOverlayElement* background_;
    100107
    101108    private:
    102       void windowResized(int newWidth, int newHeight);
     109        void windowResized(int newWidth, int newHeight);
    103110
    104       float windowAspectRatio_;
    105       bool bCorrectAspect_;
    106       Vector2 size_;
    107       Vector2 sizeCorrection_;
    108       Radian angle_;
    109       Vector2 position_;
    110       Vector2 origin_;
     111        float windowAspectRatio_;
     112        bool bCorrectAspect_;
     113        Vector2 size_;
     114        Vector2 sizeCorrection_;
     115        Radian angle_;
     116        Vector2 position_;
     117        Vector2 origin_;
    111118
    112       static unsigned int hudOverlayCounter_s;
     119        static unsigned int hudOverlayCounter_s;
    113120  };
    114121}
Note: See TracChangeset for help on using the changeset viewer.