Changeset 8605 in orxonox.OLD
- Timestamp:
- Jun 20, 2006, 9:59:53 AM (18 years ago)
- Location:
- branches/gui/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl/glgui_checkbutton.cc
r8598 r8605 96 96 // this->frontMaterial().select(); 97 97 // this->drawRect(this->frontRect()); 98 99 98 if (this->bActive) 100 99 { -
branches/gui/src/lib/gui/gl/glgui_cursor.cc
r8598 r8605 57 57 this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor"); 58 58 59 this->background().setDiffuseColor(Color(1.0,0.0,0.0, 1.0)); 60 this->background().setDiffuseMap("cursor.png"); 61 this->background().setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 59 this->setBackgroundColor(Color(1.0,0.0,0.0, 1.0)); 60 this->setBackgroundTexture("cursor.png"); 62 61 this->setSize2D(50, 50); 63 62 this->setAbsCoor2D(100, 100); … … 98 97 this->color -= 360.0; 99 98 Vector color = Color::HSVtoRGB(Vector(this->color, 1.0, 1.0)); 100 this->background().setDiffuse(color.x, color.y, color.z); 99 //this->setBackgroundColor(color.x, color.y, color.z); 100 /// FIXME 101 101 102 } 102 103 //if (this->movement != Vector2D()) -
branches/gui/src/lib/gui/gl/glgui_widget.cc
r8604 r8605 14 14 */ 15 15 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI16 #define DEBUG_SPECIAL_MODULE 4//DEBUG_MODULE_GUI 17 17 18 18 #include "glgui_widget.h" … … 41 41 42 42 /** 43 * @brief loads Parameters for a Style from XML 44 * @param root the XML-Element to load from. 45 */ 46 void GLGuiWidget::loadParams(const TiXmlElement* root) 47 { 48 49 /// STYLE 50 LoadParam(root, "border-left", this, GLGuiWidget, setBorderLeft); 51 LoadParam(root, "border-right", this, GLGuiWidget, setBorderRight); 52 LoadParam(root, "border-top", this, GLGuiWidget, setBorderTop); 53 LoadParam(root, "border-bottom", this, GLGuiWidget, setBorderBottom); 54 55 LoadParam(root, "text-size", this, GLGuiWidget, setTextSize); 56 LoadParam(root, "background-color", this, GLGuiWidget, setBackgroundColorS); 57 LoadParam(root, "foreground-color", this, GLGuiWidget, setForegroundColorS); 58 59 // LoadParamXML(root, "backmat", this, GLGuiWidget, loadBackgroundMaterial); 60 // LoadParamXML(root, "frontmat", this, GLGuiWidget, loadForegroundMaterial); 61 62 LoadParam(root, "feature-position", this, GLGuiWidget, setFeaturePositionS); 63 LoadParam(root, "Font", this, GLGuiWidget, setFont); 64 65 LoadParam(root, "animated-state-changes", this, GLGuiWidget, setAnimatedStateChanges); 66 } 67 68 69 /** 43 70 * @brief standard deconstructor 44 71 */ … … 47 74 if (this == GLGuiWidget::_focused) 48 75 GLGuiWidget::_focused = NULL; 49 50 if (this->_toFrontColor)51 delete this->_toFrontColor;52 76 } 53 77 … … 69 93 this->_pushed = false; 70 94 this->_state = OrxGui::Normal; 71 this->_toFrontColor = NULL;72 95 73 96 … … 75 98 this->resetStyle(); 76 99 77 this->_animationCycle = -1.0; 100 this->_animating = false; 101 this->_animationCycle = 0.0; 78 102 this->_animationDuration = 1.0; 79 103 80 104 81 105 this->setBackgroundColor(Color(0, 0, 0, 1)); 106 this->_style[0]._background.setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 107 this->_style[1]._background.setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 108 this->_style[2]._background.setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 109 this->_style[3]._background.setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 82 110 83 111 this->setForegroundColor(Color(1, 0, 0, 1), OrxGui::Normal); … … 136 164 void GLGuiWidget::setFrontColor(const Color& frontColor, bool instantaniously) 137 165 { 138 if (instantaniously)166 /* if (instantaniously) 139 167 { 140 168 this->setForegroundColor(frontColor); … … 150 178 *this->_toFrontColor = frontColor; 151 179 //this->_frontColor = frontColor; 152 //this->updateFrontColor(); 180 //this->updateFrontColor();*/ 153 181 }; 154 182 … … 265 293 this->setFont(NULL); 266 294 267 this->setAnimated(true);268 295 this->setAnimatedStateChanges(true); 269 296 } 270 297 271 /**272 * @brief loads Parameters for a Style from XML273 * @param root the XML-Element to load from.274 */275 void GLGuiWidget::loadParams(const TiXmlElement* root)276 {277 LoadParam(root, "border-left", this, GLGuiWidget, setBorderLeft);278 LoadParam(root, "border-right", this, GLGuiWidget, setBorderRight);279 LoadParam(root, "border-top", this, GLGuiWidget, setBorderTop);280 LoadParam(root, "border-bottom", this, GLGuiWidget, setBorderBottom);281 282 LoadParam(root, "text-size", this, GLGuiWidget, setTextSize);283 LoadParam(root, "background-color", this, GLGuiWidget, setBackgroundColorS);284 LoadParam(root, "foreground-color", this, GLGuiWidget, setForegroundColorS);285 286 // LoadParamXML(root, "backmat", this, GLGuiWidget, loadBackgroundMaterial);287 // LoadParamXML(root, "frontmat", this, GLGuiWidget, loadForegroundMaterial);288 289 LoadParam(root, "feature-position", this, GLGuiWidget, setFeaturePositionS);290 LoadParam(root, "Font", this, GLGuiWidget, setFont);291 292 LoadParam(root, "animated", this, GLGuiWidget, setAnimated);293 LoadParam(root, "animated-state-changes", this, GLGuiWidget, setAnimatedStateChanges);294 }295 298 296 299 /** … … 674 677 675 678 /** 676 * @brief if Animation should be turned on.677 * @param animated true if on, false otherwise.678 */679 void GLGuiWidget::setAnimated(bool animated)680 {681 this->_animated = animated;682 }683 684 /**685 679 * @brief sets the AnimatedState. 686 680 * @param animated: it states-changes should animate true, otherwise false. … … 694 688 void GLGuiWidget::switchState(OrxGui::State state) 695 689 { 696 this->_currentStyle = this->_style[state];690 //this->_currentStyle = this->_style[state]; 697 691 this->_state = state; 698 printf("Switching to state %s\n", OrxGui::StateString[state].c_str()); 692 PRINTF(3)("Switching to state %s\n", OrxGui::StateString[state].c_str()); 693 694 this->animateBack(); 699 695 } 700 696 … … 716 712 } 717 713 714 void GLGuiWidget::animateBack() 715 { 716 this->_animating = true; 717 this->_animationCycle = 0.0f; 718 } 719 718 720 719 721 void GLGuiWidget::tick(float dt) 720 722 { 721 if (this->_ toFrontColor)723 if (this->_animating) 722 724 { 723 this->foregroundColor(_state).slerp(*_toFrontColor, dt*3.0); 725 this->foregroundColor(); 726 727 _animationCycle += dt / _animationDuration; 728 if (_animationCycle >= 1.0) 729 { 730 _currentStyle._foreground.diffuseColor() = this->foregroundColor(_state); 731 _animating = false; 732 } 733 else 734 _currentStyle._foreground.diffuseColor().slerp(this->foregroundColor(_state), _animationCycle); 735 724 736 this->updateFrontColor(); 725 if (this->foregroundColor(_state).dist(*_toFrontColor) < .1)726 {727 delete _toFrontColor;728 _toFrontColor = NULL;729 }730 737 } 731 738 } … … 779 786 /// TODO PRINT(0)(""); Font* _font; //!< The Font used in the current Widget. 780 787 781 if (_animated)782 PRINT(0)("- Animated ");783 788 if (_animatedStateChanges) 784 789 PRINT(0)("- AnimatedStateChanges"); … … 786 791 787 792 /* 793 if (_animating) 794 PRINT(0)("- Animated "); 795 796 // 788 797 float _animationCycle; 789 798 float _animationDuration; -
branches/gui/src/lib/gui/gl/glgui_widget.h
r8604 r8605 79 79 void setWidgetSize(float x, float y); 80 80 81 81 void animateBack(); 82 82 83 83 /// STYLE … … 114 114 inline const Font* const font() const { return _font; } 115 115 /** @returns true if the Element is Animated */ 116 inline bool animat ed() const { return _animated; }116 inline bool animating() const { return _animating; } 117 117 /** @returns true if State-Changes are animated */ 118 118 inline bool animatedStateChanges() const { return _animatedStateChanges; } … … 182 182 void setForegroundColorS(float r, float g, float b, float a, const std::string& stateName); 183 183 184 inline Color& foregroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) { return _style[state]._foreground.diffuseColor(); }185 inline Color& backgroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) { return _style[state]._background.diffuseColor(); }186 inline Material& background(OrxGui::State state = GLGUI_DEFAULT_STYLE) { return _style[state]._background; }187 inline Material& foreground(OrxGui::State state = GLGUI_DEFAULT_STYLE) { return _style[state]._foreground; }188 189 184 void loadBackgroundMaterial(const Material& material); 190 185 void loadBackgroundMaterial(const Material& material, OrxGui::State state); … … 204 199 void setFont(const std::string& fontName); 205 200 206 void setAnimated(bool animated);207 201 void setAnimatedStateChanges(bool animated); 208 202 void switchState(OrxGui::State state); … … 261 255 262 256 263 257 /// WIDGET 264 258 GLGuiWidget* _parent; //!< The parent of this Widget. 265 259 266 260 /// LOOKS 267 261 Rect2D _backRect; 268 269 Color* _toFrontColor;270 271 262 Vector2D _minSize; 272 263 … … 306 297 307 298 /// ANIMATION STUFF: 308 bool _animated; //!< If the Widget is animated (Texture might be an AnimatedTexture.)309 299 bool _animatedStateChanges; //!< If the Transitions between States are Animated automatically. 310 300 301 bool _animating; //!< If the Widget is animated at the moment (Texture might be an AnimatedTexture.) 311 302 float _animationCycle; 312 303 float _animationDuration; -
branches/gui/src/util/hud.cc
r8598 r8605 89 89 { 90 90 this->energyWidget->show(); 91 this->energyWidget->background().setDiffuseMap("hud_energy_background.png"); 92 this->energyWidget->background().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 91 this->energyWidget->setBackgroundTexture( "hud_energy_background.png"); 93 92 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 94 93 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 143 142 { 144 143 weapon->getEnergyWidget()->show(); 145 weapon->getEnergyWidget()->background().setDiffuse( .8,.2,.11); 146 weapon->getEnergyWidget()->background().setTransparency(.1); 144 weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); 147 145 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 148 146 // weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
Note: See TracChangeset
for help on using the changeset viewer.