Changeset 8983 in orxonox.OLD for trunk/src/lib/gui
- Timestamp:
- Jul 1, 2006, 4:12:44 PM (18 years ago)
- Location:
- trunk/src/lib/gui/gl
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl/glgui_bar.cc
r8974 r8983 18 18 #include "glgui_bar.h" 19 19 20 #include "debug.h" 20 21 21 22 namespace OrxGui … … 36 37 */ 37 38 GLGuiBar::~GLGuiBar() 38 { 39 } 39 {} 40 40 41 41 /** … … 50 50 this->setSize2D(50, 10); 51 51 52 this->value = 0.5f; 53 this->minimum = 0.0f; 54 this->maximum = 1.0f; 52 this->_minimum = 0.0f; 53 this->_maximum = 1.0f; 54 this->setValue(0.5f); 55 this->resize(); 56 } 57 58 void GLGuiBar::setValue(float value) 59 { 60 if (value > _maximum) 61 { 62 value = _maximum; 63 PRINTF(2)("Oversteped range, set Value to %f\n", _maximum); 64 } 65 if (value < _minimum) 66 { 67 value = _minimum; 68 PRINTF(2)("Oversteped range, set Value to %f\n", _minimum); 69 } 70 71 this->_value = value; 72 73 this->_frontRect.setRight(this->getSizeX2D() * (_value -_minimum)/ (_minimum + _maximum)); 74 } 75 void GLGuiBar::setMinimum(float minimum) 76 { 77 this->_minimum = minimum; 78 } 79 void GLGuiBar::setMaximum(float maximum) 80 { 81 this->_maximum = maximum; 82 } 83 void GLGuiBar::setRange(float minimum, float maximum) 84 { 85 this->setMinimum(minimum); 86 this->setMaximum(maximum); 55 87 } 56 88 … … 59 91 GLGuiWidget::resize(); 60 92 93 this->_frontRect.setTopLeft(borderLeft(), borderTop()); 94 this->_frontRect.setSize((this->getSizeX2D() - borderLeft() - borderRight()) * (_value -_minimum)/ (_minimum + _maximum) 95 ,this->getSizeY2D() - borderTop() - borderBottom()); 61 96 62 97 } 98 99 void GLGuiBar::updateFrontColor() 100 { 101 this->font().setDiffuseColor(Color()); 102 } 103 63 104 64 105 … … 71 112 GLGuiWidget::draw(); 72 113 114 this->font().select(); 115 glDisable(GL_BLEND); 116 this->drawRect(this->_frontRect); 117 73 118 this->endDraw(); 74 119 } -
trunk/src/lib/gui/gl/glgui_bar.h
r8972 r8983 26 26 virtual ~GLGuiBar(); 27 27 28 void setValue(float value) { this->value = value; }; 29 void setMinimum(float minimum) { this->minimum = minimum; }; 30 void setMaximum(float maximum) { this->maximum = maximum; }; 28 void setValue(float value); 29 void setMinimum(float minimum); 30 void setMaximum(float maximum); 31 void setRange(float minimum, float maximum); 31 32 32 float getValue() const { return this-> value; };33 float getMinimum() const { return this-> minimum; };34 float getMaximum() const { return this-> maximum; };33 float getValue() const { return this->_value; }; 34 float getMinimum() const { return this->_minimum; }; 35 float getMaximum() const { return this->_maximum; }; 35 36 36 37 virtual void update() { }; … … 39 40 protected: 40 41 virtual void resize(); 42 virtual void updateFrontColor(); 41 43 42 44 private: … … 44 46 45 47 private: 46 float value;48 float _value; 47 49 48 float minimum; 49 float maximum; 50 Rect2D _frontRect; 51 52 float _minimum; 53 float _maximum; 50 54 }; 51 55 } -
trunk/src/lib/gui/gl/glgui_widget.h
r8769 r8983 119 119 /** @returns FeaturePosition */ 120 120 inline FeaturePosition featurePosition() const { return _featurePosition; } 121 /** @returns the constant font */ 122 inline const Font& font() const { return _font; } 121 123 /** @returns the font */ 122 inline const Font& font() const{ return _font; }124 inline Font& font() { return _font; } 123 125 /** @returns true if the Element is Animated */ 124 126 inline bool animating() const { return _animating; }
Note: See TracChangeset
for help on using the changeset viewer.