Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 1632 for code/trunk


Ignore:
Timestamp:
Jun 29, 2008, 5:37:26 PM (16 years ago)
Author:
rgrieder
Message:

fixed a bug in OverlayText (no text was seen)
adjusted OverlayText in conjunction with aspect ratio

Location:
code/trunk/src/orxonox/overlays
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.cc

    r1628 r1632  
    207207            float tempAspect;
    208208            if (angle > 89.0 && angle < 91.0)
     209            {
    209210                tempAspect = 1.0 / this->windowAspectRatio_;
     211                rotState_ = Vertical;
     212            }
    210213            else if (angle > 179 || angle < 1)
     214            {
    211215                tempAspect = this->windowAspectRatio_;
     216                rotState_ = Horizontal;
     217            }
    212218            else
     219            {
    213220                tempAspect = 1.0;
     221                rotState_ = Inbetween;
     222            }
    214223
    215224            // note: this is only an approximation that is mostly valid when the
  • code/trunk/src/orxonox/overlays/OrxonoxOverlay.h

    r1625 r1632  
    6969    class _OrxonoxExport OrxonoxOverlay : public BaseObject, public WindowEventListener
    7070    {
     71    public:
     72        /**
     73        @brief
     74            Describes the rotational state of a an overlay.
     75            Horizontal means 0/180 degrees, Vertical is 90/270 degrees
     76            and Inbetween is everything else.
     77        */
     78        enum RotationState
     79        {
     80            Horizontal,
     81            Vertical,
     82            Inbetween
     83        };
     84
    7185    public:
    7286        OrxonoxOverlay();
     
    156170        Vector2 pickPoint_;                        //!< Point on the overlay to pick when translating
    157171        Radian angle_;                             //!< Rotation angle of the overlay
     172        RotationState rotState_;             //!< horizontal, vertical or inbetween
    158173
    159174    private:
  • code/trunk/src/orxonox/overlays/OverlayText.cc

    r1628 r1632  
    6363            this->text_ = static_cast<Ogre::TextAreaOverlayElement*>(Ogre::OverlayManager::getSingleton()
    6464                .createOverlayElement("TextArea", "OverlayText_text_" + getUniqueNumberStr()));
     65            this->text_->setCharHeight(1.0);
    6566
    6667            this->background_->addChild(this->text_);
     
    9192            return;
    9293
    93         this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y);
     94        if (this->rotState_ == Horizontal)
     95            this->overlay_->setScale(size_.y * sizeCorrection_.y, size_.y * sizeCorrection_.y);
     96        else if (this->rotState_ == Vertical)
     97            this->overlay_->setScale(size_.y / (sizeCorrection_.y * sizeCorrection_.y), size_.y * sizeCorrection_.y);
     98        else
     99            this->overlay_->setScale(size_.y, size_.y);
     100
    94101        positionChanged();
    95102    }
Note: See TracChangeset for help on using the changeset viewer.