Changeset 8435 in orxonox.OLD for branches/gui/src/lib
- Timestamp:
- Jun 15, 2006, 1:16:13 AM (18 years ago)
- Location:
- branches/gui/src/lib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl/glgui_button.cc
r8419 r8435 72 72 { 73 73 this->_label.setColor(this->frontColor()); 74 printf("TEST Color is "); this->frontColor().debug();75 74 } 76 75 -
branches/gui/src/lib/gui/gl/glgui_inputline.cc
r8425 r8435 191 191 void GLGuiInputLine::tick(float dt) 192 192 { 193 GLGuiWidget::tick(dt); 193 194 if (this->delayNext > 0.0) 194 195 this->delayNext -= dt; -
branches/gui/src/lib/gui/gl/glgui_widget.cc
r8425 r8435 45 45 if (this == GLGuiWidget::_focused) 46 46 GLGuiWidget::_focused = NULL; 47 48 if (this->_toFrontColor) 49 delete this->_toFrontColor; 47 50 } 48 51 … … 69 72 this->_backMat.setDiffuseMap("gui_element_background.png"); 70 73 this->_frontColor.setColor(1.0, 0.0, 0.0); 74 _toFrontColor = NULL; 75 71 76 72 77 this->_borderLeft = 15.0; … … 116 121 } 117 122 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 118 133 119 134 void GLGuiWidget::setBorderSize(float borderSize) … … 243 258 } 244 259 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 245 274 246 275 /** -
branches/gui/src/lib/gui/gl/glgui_widget.h
r8419 r8435 92 92 const Rect2D& backRect() const { return this->_backRect; }; 93 93 94 void setFrontColor(const Color& frontColor) { this->_frontColor = frontColor; this->updateFrontColor(); };94 void setFrontColor(const Color& frontColor); 95 95 const Color& frontColor() const { return this->_frontColor; }; 96 96 … … 126 126 127 127 virtual void update() {}; 128 virtual void tick(float dt); 128 129 virtual void draw() const; 129 130 … … 163 164 164 165 Color _frontColor; 166 Color* _toFrontColor; 165 167 166 168 float _borderLeft; -
branches/gui/src/lib/util/color.h
r8431 r8435 38 38 39 39 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(); }; 40 41 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()))); } 41 43 /// Maths 42 44 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.