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..)
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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
Note: See TracChangeset for help on using the changeset viewer.