Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jun 22, 2008, 11:47:09 PM (16 years ago)
Author:
rgrieder
Message:
  • moved colours of the SpeedBar to XML file
  • enabled render window updating in inactive mode (under windows the render window didn't show anything if inactive)
  • added row/column to ticpp error description (there are a lot more to do this, may modify the macro..)
Location:
code/branches/hud/src/orxonox
Files:
1 added
5 edited
4 moved

Legend:

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

    r1590 r1618  
    7777            void setAverageRTR(float rtr) { this->renderTimeRatio_ = rtr; }
    7878
     79            void setWindowActivity(bool activity)
     80            { if (this->renderWindow_) this->renderWindow_->setActive(activity); }
     81
    7982            void windowMoved       (Ogre::RenderWindow* rw);
    8083            void windowResized     (Ogre::RenderWindow* rw);
  • code/branches/hud/src/orxonox/Orxonox.cc

    r1613 r1618  
    501501        // This calls the WindowEventListener objects.
    502502        Ogre::WindowEventUtilities::messagePump();
     503        GraphicsEngine::getSingleton().setWindowActivity(true);
    503504
    504505        // render
  • code/branches/hud/src/orxonox/overlays/OrxonoxOverlay.cc

    r1617 r1618  
    111111                this->overlay_->hide();
    112112
     113            this->sizeCorrectionChanged();
    113114            this->sizeChanged();
    114115            this->positionChanged();
     
    160161        {
    161162            float angle = this->angle_.valueDegrees();
     163            if (angle < 0.0)
     164                angle = -angle;
     165            angle -= 180.0 * (int)(angle / 180.0);
     166
    162167            float tempAspect;
    163             if (angle > 89.0 && angle < 91.0 || angle > 269 && angle < 271)
     168            if (angle > 89.0 && angle < 91.0)
    164169                tempAspect = 1.0 / this->windowAspectRatio_;
    165             else if (angle > 359 && angle < 1 || angle > 179 && angle < 181)
     170            else if (angle > 179 || angle < 1)
    166171                tempAspect = this->windowAspectRatio_;
    167172            else
  • code/branches/hud/src/orxonox/overlays/hud/HUDBar.cc

    r1616 r1618  
    4343namespace orxonox
    4444{
     45    CreateFactory(BarColour);
     46
     47    BarColour::BarColour()
     48        : position_(0.0)
     49    {
     50        RegisterObject(BarColour);
     51    }
     52
     53    void BarColour::XMLPort(Element& xmlElement, XMLPort::Mode mode)
     54    {
     55        BaseObject::XMLPort(xmlElement, mode);
     56
     57        XMLPortParam(BarColour, "colour", setColour, getColour, xmlElement, mode);
     58        XMLPortParam(BarColour, "position", setPosition, getPosition, xmlElement, mode);
     59    }
     60
     61
    4562    unsigned int HUDBar::materialcount_s = 0;
    4663
     
    87104            this->autoColour_ = true;
    88105            this->right2Left_ = false; // default is left to right progress
    89 
    90             this->addColour(0.7, ColourValue(0.2, 0.7, 0.2));
    91             this->addColour(0.4, ColourValue(0.7, 0.5, 0.2));
    92             this->addColour(0.1, ColourValue(0.7, 0.2, 0.2));
    93106        }
    94107
    95108        XMLPortParamLoadOnly(HUDBar, "value", setValue, xmlElement, mode);
     109        XMLPortParam(HUDBar, "right2left", setRightToLeft, getRightToLeft, xmlElement, mode);
     110        XMLPortObject(HUDBar, BarColour, "", addColour, getColour, xmlElement, mode, false, true);
    96111    }
    97112
     
    154169    }
    155170
    156     void HUDBar::addColour(float value, const ColourValue& colour)
     171    void HUDBar::addColour(BarColour* colour)
    157172    {
    158         value = clamp<float>(value, 0, 1);
    159         this->colours_[value] = colour;
     173        float value = clamp<float>(colour->getPosition(), 0.0, 1.0);
     174        this->colours_[value] = colour->getColour();
     175
     176        this->barColours_.push_back(colour);
     177    }
     178
     179    BarColour* HUDBar::getColour(unsigned int index)
     180    {
     181        if (index < this->barColours_.size())
     182            return barColours_[index];
     183        else
     184            return 0;
    160185    }
    161186
  • code/branches/hud/src/orxonox/overlays/hud/HUDBar.h

    r1615 r1618  
    4141namespace orxonox
    4242{
     43    class _OrxonoxExport BarColour : public BaseObject
     44    {
     45    public:
     46        BarColour();
     47        ~BarColour() { }
     48
     49        void XMLPort(Element& xmlElement, XMLPort::Mode mode);
     50
     51        void setColour(const ColourValue& colour) { this->colour_ = colour; }
     52        const ColourValue& getColour() const { return this->colour_; }
     53
     54        void setPosition(float pos) { this->position_ = pos; }
     55        float getPosition() const    { return this->position_; }
     56
     57    private:
     58        ColourValue colour_;
     59        float position_;
     60    };
     61
    4362    class _OrxonoxExport HUDBar : public OrxonoxOverlay
    4463    {
     
    5069
    5170        virtual void setValue(float value);
    52         void addColour(float value, const ColourValue& colour);
    5371        void clearColours();
    5472
     
    6179
    6280    private:
     81        void addColour(BarColour* colour);
     82        BarColour* getColour(unsigned int index);
     83
    6384        bool right2Left_;
    6485        bool autoColour_;                   //!< whether bar changes colour automatically
     
    6889        Ogre::TextureUnitState* textureUnitState_;
    6990        std::map<float, ColourValue> colours_;
     91        std::vector<BarColour*> barColours_;
    7092
    7193        float barWidth_s;
Note: See TracChangeset for help on using the changeset viewer.