Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8435 in orxonox.OLD


Ignore:
Timestamp:
Jun 15, 2006, 1:16:13 AM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: fade to colors
now the gui can be looked at :)
at least a bit

Location:
branches/gui/src/lib
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • branches/gui/src/lib/gui/gl/glgui_button.cc

    r8419 r8435  
    7272  {
    7373    this->_label.setColor(this->frontColor());
    74     printf("TEST Color is "); this->frontColor().debug();
    7574  }
    7675
  • branches/gui/src/lib/gui/gl/glgui_inputline.cc

    r8425 r8435  
    191191  void GLGuiInputLine::tick(float dt)
    192192  {
     193    GLGuiWidget::tick(dt);
    193194    if (this->delayNext > 0.0)
    194195      this->delayNext -= dt;
  • branches/gui/src/lib/gui/gl/glgui_widget.cc

    r8425 r8435  
    4545    if (this == GLGuiWidget::_focused)
    4646      GLGuiWidget::_focused = NULL;
     47
     48    if (this->_toFrontColor)
     49      delete this->_toFrontColor;
    4750  }
    4851
     
    6972    this->_backMat.setDiffuseMap("gui_element_background.png");
    7073    this->_frontColor.setColor(1.0, 0.0, 0.0);
     74    _toFrontColor = NULL;
     75
    7176
    7277    this->_borderLeft = 15.0;
     
    116121  }
    117122
     123  void GLGuiWidget::setFrontColor(const Color& frontColor)
     124  {
     125    if (!this->_toFrontColor)
     126      this->_toFrontColor = new Color(frontColor);
     127    else
     128      *this->_toFrontColor = frontColor;
     129    //this->_frontColor = frontColor;
     130    //this->updateFrontColor();
     131  };
     132
    118133
    119134  void GLGuiWidget::setBorderSize(float borderSize)
     
    243258  }
    244259
     260  void GLGuiWidget::tick(float dt)
     261  {
     262    if (this->_toFrontColor)
     263    {
     264      this->_frontColor.slerp(*_toFrontColor, dt*3.0);
     265      this->updateFrontColor();
     266      if (this->_frontColor.dist(*_toFrontColor) < .1)
     267      {
     268        delete _toFrontColor;
     269        _toFrontColor = NULL;
     270      }
     271    }
     272  }
     273
    245274
    246275  /**
  • branches/gui/src/lib/gui/gl/glgui_widget.h

    r8419 r8435  
    9292    const Rect2D& backRect() const { return this->_backRect; };
    9393
    94     void setFrontColor(const Color& frontColor) { this->_frontColor = frontColor; this->updateFrontColor(); };
     94    void setFrontColor(const Color& frontColor);
    9595    const Color& frontColor() const { return this->_frontColor; };
    9696
     
    126126
    127127    virtual void update() {};
     128    virtual void tick(float dt);
    128129    virtual void draw() const;
    129130
     
    163164
    164165    Color                          _frontColor;
     166    Color*                         _toFrontColor;
    165167
    166168    float                          _borderLeft;
  • branches/gui/src/lib/util/color.h

    r8431 r8435  
    3838
    3939  void setColor(float r = 0.0f, float g = 0.0f, float b = 0.0f, float a = 1.0f) { _rgba[0] = r; _rgba[1] = g; _rgba[2] = b; _rgba[3] = a; };
     40  void setColor(const Color& c) { r() = c.r();  g()= c.g(); b() = c.b(); a() = c.a(); };
    4041
     42  inline float dist(const Color& c) const { return (sqrt((r()-c.r())*(r()-c.r()) + (g()-c.g())*(g()-c.g()) + (b()-c.b())*(b()-c.b()) + (a()-c.a())*(a()-c.a()))); }
    4143  /// Maths
    4244  inline const Color& operator+=(const Color& c) { r()+=c.r(); g()+=c.g(); b()+=c.b(); a()+=c.a(); return *this; };
Note: See TracChangeset for help on using the changeset viewer.