Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8448 in orxonox.OLD for trunk/src/lib/gui/gl/glgui_widget.cc


Ignore:
Timestamp:
Jun 15, 2006, 12:48:26 PM (18 years ago)
Author:
bensch
Message:

merged gui back to the trunk
merged with command
merge -r8377:HEAD https://svn.orxonox.net/orxonox/branches/gui .

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl/glgui_widget.cc

    r8335 r8448  
    4545    if (this == GLGuiWidget::_focused)
    4646      GLGuiWidget::_focused = NULL;
     47
     48    if (this->_toFrontColor)
     49      delete this->_toFrontColor;
    4750  }
    4851
     
    6669    this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE);
    6770
    68     this->_backMat.setDiffuse(1.0, 1.0, 1.0);
    69     this->_frontMat.setDiffuse(1.0, 0.0, 0.0);
    70 
    71     this->_borderLeft = 1.0;
     71    this->_backMat.setDiffuseColor(Color(1.0, 0.5, 0.4, 1.0));
     72    this->_backMat.setDiffuseMap("gui_element_background.png");
     73    this->_frontColor = Color(1.0, 0.0, 0.0);
     74    this->_toFrontColor = NULL;
     75
     76
     77    this->_borderLeft = 15.0;
    7278    this->_borderRight = 1.0;
    7379    this->_borderTop = 1.0;
     
    115121  }
    116122
     123  void GLGuiWidget::setFrontColor(const Color& frontColor, bool instantaniously)
     124  {
     125    if (instantaniously)
     126    {
     127      this->_frontColor = frontColor;
     128      if (this->_toFrontColor != NULL)
     129      {
     130        delete this->_toFrontColor;
     131        this->_toFrontColor = NULL;
     132      }
     133    }
     134    else if (!this->_toFrontColor)
     135      this->_toFrontColor = new Color(frontColor);
     136    else
     137      *this->_toFrontColor = frontColor;
     138    //this->_frontColor = frontColor;
     139    //this->updateFrontColor();
     140  };
     141
    117142
    118143  void GLGuiWidget::setBorderSize(float borderSize)
     
    176201  void GLGuiWidget::clicking(const Vector2D& pos)
    177202  {
    178     this->frontMaterial().setDiffuse(0, 0, 1);
     203    this->setFrontColor(Color(0, 0, 1));
    179204
    180205  }
     
    182207  void GLGuiWidget::releasing(const Vector2D& pos)
    183208  {
    184     this->frontMaterial().setDiffuse(0,1,0);
     209    this->setFrontColor(Color(0,1,0));
    185210
    186211  }
     
    188213  void GLGuiWidget::receivedFocus()
    189214  {
    190     this->frontMaterial().setDiffuse(0, 1, 0);
     215    this->setFrontColor(Color(0, 1, 0));
    191216  }
    192217
    193218  void GLGuiWidget::removedFocus()
    194219  {
    195     this->frontMaterial().setDiffuse(1, 0, 0);
     220    this->setFrontColor(Color(1, 0, 0));
    196221
    197222  }
     
    201226  ;
    202227
     228
    203229  void GLGuiWidget::setWidgetSize(const Vector2D& size)
    204230  {
     
    239265    this->setVisibility(false);
    240266    this->hiding();
     267  }
     268
     269  void GLGuiWidget::tick(float dt)
     270  {
     271    if (this->_toFrontColor)
     272    {
     273      this->_frontColor.slerp(*_toFrontColor, dt*3.0);
     274      this->updateFrontColor();
     275      if (this->_frontColor.dist(*_toFrontColor) < .1)
     276      {
     277        delete _toFrontColor;
     278        _toFrontColor = NULL;
     279      }
     280    }
    241281  }
    242282
     
    249289    this->backMaterial().select();
    250290    this->drawRect(this->backRect());
     291    this->backMaterial().unselect();
    251292  }
    252293
Note: See TracChangeset for help on using the changeset viewer.