Changeset 1598 for code/branches/hud/src/orxonox
- Timestamp:
- Jun 14, 2008, 4:19:42 PM (16 years ago)
- Location:
- code/branches/hud/src/orxonox/hud
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/hud/src/orxonox/hud/HUDBar.cc
r1590 r1598 53 53 54 54 barWidth_s = 0.88f; 55 barHeight_s = 0.3f;55 barHeight_s = 1.0f; 56 56 barOffsetLeft_s = 0.06f; 57 57 barOffsetTop_s = 0.0f; … … 82 82 this->background_->setMaterialName("Orxonox/BarBackground"); 83 83 this->background_->setMetricsMode(GMM_RELATIVE); 84 this->background_->setDimensions(1.0f, 0.3f);84 this->background_->setDimensions(1.0f, 1.0f); 85 85 this->background_->setPosition(0.0f, 0.0f); 86 86 this->overlay_->add2D(this->background_); -
code/branches/hud/src/orxonox/hud/HUDOverlay.cc
r1595 r1598 43 43 , windowAspectRatio_(1.0f) 44 44 , bCorrectAspect_(false) 45 , size_(1.0f) 46 , sizeCorrection_(1.0f) 45 , size_(1.0f, 1.0f) 46 , sizeCorrection_(1.0f, 1.0f) 47 , angle_(0.0f) 48 , position_(0.0f, 0.0f) 49 , origin_(0.5f, 0.5f) 47 50 { 48 51 RegisterObject(HUDOverlay); … … 62 65 } 63 66 67 XMLPortParam(HUDOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode); 64 68 XMLPortParam(HUDOverlay, "size", setSize, getSize, xmlElement, mode); 65 XMLPortParam(HUDOverlay, "correctAspect", setAspectCorrection, getAspectCorrection, xmlElement, mode);66 XMLPortParam(HUDOverlay, "scroll", setScroll, getScroll, xmlElement, mode);67 69 XMLPortParam(HUDOverlay, "rotation", setRotation, getRotation, xmlElement, mode); 70 XMLPortParam(HUDOverlay, "origin", setOrigin, getOrigin, xmlElement, mode); 71 XMLPortParam(HUDOverlay, "position", setPosition, getPosition, xmlElement, mode); 68 72 69 73 if (mode == XMLPort::LoadObject) … … 124 128 void HUDOverlay::sizeChanged() 125 129 { 126 this->overlay_->setScale(size_.x * sizeCorrection_.x, size_. x* sizeCorrection_.y);130 this->overlay_->setScale(size_.x * sizeCorrection_.x, size_.y * sizeCorrection_.y); 127 131 } 128 132 133 /** 134 @remarks 135 This function can be overriden by any derivative. 136 */ 137 void HUDOverlay::angleChanged() 138 { 139 this->overlay_->setRotate(this->angle_); 140 } 141 142 /** 143 @remarks 144 This function can be overriden by any derivative. 145 */ 146 void HUDOverlay::positionChanged() 147 { 148 Vector2 scroll = (position_ - 0.5 - size_ * (origin_ - 0.5)) * 2.0; 149 this->overlay_->setScroll(scroll.x, -scroll.y); 150 } 129 151 } -
code/branches/hud/src/orxonox/hud/HUDOverlay.h
r1595 r1598 50 50 bool getAspectCorrection() { return this->bCorrectAspect_; } 51 51 52 /** Sets the scrolling factorof this overlay. */53 void set Scroll(Vector2 scroll) { overlay_->setScroll(scroll.x, scroll.y); }52 /** Sets the position of this overlay. */ 53 void setPosition(Vector2 pos) { this->position_ = pos; this->positionChanged(); } 54 54 55 /** Gets the current scroll value*/56 Vector2 get Scroll() const { return Vector2(overlay_->getScrollX(), overlay_->getScrollY()); }55 /** Gets the current position. */ 56 Vector2 getPosition() const { return this->position_; } 57 57 58 58 /** Scrolls the overlay by the offsets provided. */ 59 void scroll(Vector2 scroll) { overlay_->scroll(scroll.x, scroll.y); } 59 void scroll(Vector2 scroll) { this->position_ += scroll; this->positionChanged(); } 60 61 /** Sets the origin point of this overlay. */ 62 void setOrigin(Vector2 pos) { this->origin_ = pos; this->positionChanged(); } 63 64 /** Gets the origin point of this overlay */ 65 Vector2 getOrigin() const { return this->origin_; } 60 66 61 67 /** Sets the rotation applied to this overlay.*/ 62 void setRotation(const Ogre::Radian& angle) { overlay_->setRotate(angle); }68 void setRotation(const Ogre::Radian& angle) { this->angle_ = angle; this->angleChanged(); } 63 69 64 70 /** Gets the rotation applied to this overlay, in degrees.*/ 65 const Radian& getRotation() const { return overlay_->getRotate(); }71 const Radian& getRotation() const { return this->angle_; } 66 72 67 73 /** Adds the passed in angle to the rotation applied to this overlay. */ 68 void rotate(const Radian& angle) { overlay_->rotate(angle); }74 void rotate(const Radian& angle) { this->angle_ += angle; this->angleChanged(); } 69 75 70 76 /** Sets the scaling factor of this overlay. */ … … 86 92 virtual void changedVisibility(); 87 93 virtual void sizeChanged(); 94 virtual void angleChanged(); 95 virtual void positionChanged(); 88 96 float getWindowAspectRatio() { return windowAspectRatio_; } 89 97 … … 97 105 Vector2 size_; 98 106 Vector2 sizeCorrection_; 107 Radian angle_; 108 Vector2 position_; 109 Vector2 origin_; 99 110 100 111 static unsigned int hudOverlayCounter_s; -
code/branches/hud/src/orxonox/hud/Navigation.h
r1595 r1598 59 59 protected: 60 60 virtual void sizeChanged(); 61 virtual void angleChanged() { } 62 virtual void positionChanged() { } 61 63 62 64 private:
Note: See TracChangeset
for help on using the changeset viewer.