Changeset 1614 for code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.h
- Timestamp:
- Jun 21, 2008, 2:35:24 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.h
r1604 r1614 39 39 namespace orxonox 40 40 { 41 class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener42 {41 class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener 42 { 43 43 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(); 47 47 48 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode);48 virtual void XMLPort(Element& xmlElement, XMLPort::Mode mode); 49 49 50 void setAspectCorrection(bool val);51 bool getAspectCorrection() { return this->bCorrectAspect_; }50 void show() { this->setVisibility(true); } 51 void hide() { this->setVisibility(false); } 52 52 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_; } 55 55 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(); } 58 58 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_; } 61 61 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(); } 64 64 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(); } 67 67 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_; } 70 70 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(); } 73 73 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_; } 76 76 77 /** Sets the size ofthis 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(); } 79 79 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(); } 82 82 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_; } 85 85 86 /** Gets the current size correction*/87 Vector2 getSizeCorrection() const { returnthis->sizeCorrection_; }86 /** Gets the current size (corrected) */ 87 Vector2 getSize() const { return this->size_ * this->sizeCorrection_; } 88 88 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(); } 91 94 92 95 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_; } 98 101 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_; 100 107 101 108 private: 102 void windowResized(int newWidth, int newHeight);109 void windowResized(int newWidth, int newHeight); 103 110 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_; 111 118 112 static unsigned int hudOverlayCounter_s;119 static unsigned int hudOverlayCounter_s; 113 120 }; 114 121 }
Note: See TracChangeset
for help on using the changeset viewer.