Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 14, 2008, 4:19:42 PM (16 years ago)
Author:
rgrieder
Message:

scale, position, alignment and rotation work with overlays
Simply override virtual void size|position|angleChanged() method to have custom behavior

File:
1 edited

Legend:

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

    r1595 r1598  
    5050      bool getAspectCorrection() { return this->bCorrectAspect_; }
    5151
    52       /** Sets the scrolling factor of this overlay. */
    53       void setScroll(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(); }
    5454
    55       /** Gets the current scroll value */
    56       Vector2 getScroll() const { return Vector2(overlay_->getScrollX(), overlay_->getScrollY()); }
     55      /** Gets the current position. */
     56      Vector2 getPosition() const { return this->position_; }
    5757
    5858      /** 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_; }
    6066
    6167      /** 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(); }
    6369
    6470      /** 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_; }
    6672
    6773      /** 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(); }
    6975
    7076      /** Sets the scaling factor of this overlay. */
     
    8692      virtual void changedVisibility();
    8793      virtual void sizeChanged();
     94      virtual void angleChanged();
     95      virtual void positionChanged();
    8896      float getWindowAspectRatio() { return windowAspectRatio_; }
    8997
     
    97105      Vector2 size_;
    98106      Vector2 sizeCorrection_;
     107      Radian angle_;
     108      Vector2 position_;
     109      Vector2 origin_;
    99110
    100111      static unsigned int hudOverlayCounter_s;
Note: See TracChangeset for help on using the changeset viewer.