Changeset 8448 in orxonox.OLD for trunk/src/lib/gui/gl/glgui_widget.cc
- Timestamp:
- Jun 15, 2006, 12:48:26 PM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl/glgui_widget.cc
r8335 r8448 45 45 if (this == GLGuiWidget::_focused) 46 46 GLGuiWidget::_focused = NULL; 47 48 if (this->_toFrontColor) 49 delete this->_toFrontColor; 47 50 } 48 51 … … 66 69 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE); 67 70 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; 72 78 this->_borderRight = 1.0; 73 79 this->_borderTop = 1.0; … … 115 121 } 116 122 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 117 142 118 143 void GLGuiWidget::setBorderSize(float borderSize) … … 176 201 void GLGuiWidget::clicking(const Vector2D& pos) 177 202 { 178 this-> frontMaterial().setDiffuse(0, 0, 1);203 this->setFrontColor(Color(0, 0, 1)); 179 204 180 205 } … … 182 207 void GLGuiWidget::releasing(const Vector2D& pos) 183 208 { 184 this-> frontMaterial().setDiffuse(0,1,0);209 this->setFrontColor(Color(0,1,0)); 185 210 186 211 } … … 188 213 void GLGuiWidget::receivedFocus() 189 214 { 190 this-> frontMaterial().setDiffuse(0, 1, 0);215 this->setFrontColor(Color(0, 1, 0)); 191 216 } 192 217 193 218 void GLGuiWidget::removedFocus() 194 219 { 195 this-> frontMaterial().setDiffuse(1, 0, 0);220 this->setFrontColor(Color(1, 0, 0)); 196 221 197 222 } … … 201 226 ; 202 227 228 203 229 void GLGuiWidget::setWidgetSize(const Vector2D& size) 204 230 { … … 239 265 this->setVisibility(false); 240 266 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 } 241 281 } 242 282 … … 249 289 this->backMaterial().select(); 250 290 this->drawRect(this->backRect()); 291 this->backMaterial().unselect(); 251 292 } 252 293
Note: See TracChangeset
for help on using the changeset viewer.