Changeset 8583 in orxonox.OLD for branches/gui/src
- Timestamp:
- Jun 19, 2006, 1:20:42 PM (18 years ago)
- Location:
- branches/gui/src
- Files:
-
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/graphics/importer/material.cc
r8572 r8583 49 49 this->setName(mtlName); 50 50 } 51 52 Material& Material::operator=(const Material& material) 53 { 54 this->setIllum(material.illumModel); 55 this->setDiffuseColor(material.diffuseColor()); 56 this->specular = material.specular; 57 this->ambient = material.ambient; 58 this->setShininess(material.shininess); 59 60 this->textures = material.textures; 61 this->sFactor = material.sFactor; 62 this->tFactor = material.tFactor; 63 this->setName(material.getName()); 64 65 return *this; 66 } 67 68 51 69 52 70 void Material::loadParams(const TiXmlElement* root) -
branches/gui/src/lib/graphics/importer/material.h
r8575 r8583 48 48 void setBlendFuncS(const std::string& sFactor, const std::string& tFactor); 49 49 50 Color& diffuseColor() { return diffuse; }; 50 51 const Color& diffuseColor() const { return diffuse; }; 51 52 -
branches/gui/src/lib/gui/gl/glgui_button.cc
r8448 r8583 55 55 56 56 this->_label.setFont("fonts/final_frontier.ttf", 20); 57 this->_label.setColor(this->f rontColor());57 this->_label.setColor(this->foregroundColor() ); 58 58 59 59 this->_label.setParent2D(this); … … 71 71 void GLGuiButton::updateFrontColor() 72 72 { 73 this->_label.setColor(this->f rontColor());73 this->_label.setColor(this->foregroundColor()); 74 74 } 75 75 -
branches/gui/src/lib/gui/gl/glgui_checkbutton.cc
r8448 r8583 99 99 if (this->bActive) 100 100 { 101 glColor3fv( &this->f rontColor()[0]);101 glColor3fv( &this->foregroundColor()[0]); 102 102 this->drawRect(this->_checkBox); 103 103 … … 124 124 else 125 125 { 126 glColor3fv( &this->f rontColor()[0]);126 glColor3fv( &this->foregroundColor()[0]); 127 127 this->drawRect(this->_checkBox); 128 128 } -
branches/gui/src/lib/gui/gl/glgui_cursor.cc
r8528 r8583 57 57 this->setClassID(CL_GLGUI_CURSOR, "GLGuiCursor"); 58 58 59 this-> backMaterial().setDiffuse(1.0,0.0,0.0);60 this-> backMaterial().setDiffuseMap("cursor.png");61 this-> backMaterial().setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);59 this->style().background().setDiffuse(1.0,0.0,0.0); 60 this->style().background().setDiffuseMap("cursor.png"); 61 this->style().background().setBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 62 62 this->setSize2D(50, 50); 63 63 this->setAbsCoor2D(100, 100); … … 80 80 bool GLGuiCursor::loadTextureSequence(const std::string& imageNameSubstitue, unsigned int from, unsigned int to) 81 81 { 82 this-> backMaterial().setDiffuse(1.0, 1.0, 1.0);82 this->style().background().setDiffuse(1.0, 1.0, 1.0); 83 83 return this->seq.loadImageSeries(imageNameSubstitue, from, to); 84 84 } … … 98 98 this->color -= 360.0; 99 99 Vector color = Color::HSVtoRGB(Vector(this->color, 1.0, 1.0)); 100 this-> backMaterial().setDiffuse(color.x, color.y, color.z);100 this->style().background().setDiffuse(color.x, color.y, color.z); 101 101 } 102 102 //if (this->movement != Vector2D()) … … 126 126 this->beginDraw(); 127 127 128 this->back Material().select();128 this->background().select(); 129 129 if (!this->seq.empty()) 130 130 glBindTexture(GL_TEXTURE_2D, this->seq.getFrameTexture((int)frameNumber)); -
branches/gui/src/lib/gui/gl/glgui_image.cc
r8448 r8583 76 76 void GLGuiImage::updateFrontColor() 77 77 { 78 this->_imageMaterial.setDiffuseColor(this->f rontColor());78 this->_imageMaterial.setDiffuseColor(this->foregroundColor()); 79 79 } 80 80 -
branches/gui/src/lib/gui/gl/glgui_inputline.cc
r8543 r8583 54 54 this->_text.setLineWidth(400); 55 55 this->_text.setDotsPosition(LimitedWidthText::Begin); 56 this->_text.setColor(this->f rontColor());56 this->_text.setColor(this->foregroundColor()); 57 57 this->_text.setVisibility(false); 58 58 this->resize(); … … 212 212 void GLGuiInputLine::updateFrontColor() 213 213 { 214 this->_text.setColor(this->f rontColor());214 this->_text.setColor(this->foregroundColor()); 215 215 } 216 216 -
branches/gui/src/lib/gui/gl/glgui_slider.cc
r8448 r8583 239 239 GLGuiWidget::draw(); 240 240 241 glColor4fv(&this->f rontColor()[0]);241 glColor4fv(&this->foregroundColor()[0]); 242 242 this->drawRect(this->_slider); 243 243 this->drawRect(this->_handle); -
branches/gui/src/lib/gui/gl/glgui_style.h
r8582 r8583 26 26 27 27 28 /// Retrieve 28 /// Retrieve (ALL THESE FUNCTIONS ARE AGAIN IN THE GLGUI-WIDGET FOR EASY RETRIEVAL) 29 29 /** @returns left borderWidth @param state the State to retrieve from */ 30 30 inline float borderLeft(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._borderLeft; } … … 40 40 /** @returns the Background Color @param state the State to retrieve from */ 41 41 inline const Color& backgroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._background.diffuseColor(); } 42 /** @returns the Background Material. @param state the state to retrieve from */ 43 inline const Material& background(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._background; } 42 44 /** @returns background Texture. @param state the State to retrieve from */ 43 inline const Texture& backgro rundTexture(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._background.diffuseTexture(); }45 inline const Texture& backgroundTexture(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._background.diffuseTexture(); } 44 46 /** @returns the foreground Color @param state the State to retrieve from */ 45 47 inline const Color& foregroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) const { return _style[state]._foreground.diffuseColor(); } 48 /** @returns the ForeGroung Material. @param state the state to retrieve from */ 49 inline const Material& foreground(OrxGui::State state = GLGUI_DEFAULT_STYLE) const { return _style[state]._foreground; } 46 50 47 51 /** @returns FeaturePosition */ … … 91 95 void setForegroundColor(const Color& color, OrxGui::State state); 92 96 void setForegroundColorS(float r, float g, float b, float a, const std::string& stateName); 97 98 inline Color& foregroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) { return _style[state]._foreground.diffuseColor(); } 99 inline Color& backgroundColor(OrxGui::State state= GLGUI_DEFAULT_STYLE) { return _style[state]._background.diffuseColor(); } 100 inline Material& background(OrxGui::State state = GLGUI_DEFAULT_STYLE) { return _style[state]._background; } 101 inline Material& foreground(OrxGui::State state = GLGUI_DEFAULT_STYLE) { return _style[state]._foreground; } 93 102 94 103 void loadBackgroundMaterial(const Material& material); -
branches/gui/src/lib/gui/gl/glgui_widget.cc
r8448 r8583 66 66 this->_clickable = false; 67 67 this->_pushed = false; 68 this->_state = OrxGui::Normal; 68 69 69 70 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE); 70 71 71 this->_backMat.setDiffuseColor(Color(1.0, 0.5, 0.4, 1.0));72 /* this->_backMat.setDiffuseColor(Color(1.0, 0.5, 0.4, 1.0)); 72 73 this->_backMat.setDiffuseMap("gui_element_background.png"); 73 this->_frontColor = Color(1.0, 0.0, 0.0); 74 this->_frontColor = Color(1.0, 0.0, 0.0);*/ 74 75 this->_toFrontColor = NULL; 75 76 77 this->_borderLeft = 15.0;78 this->_borderRight = 1.0;79 this->_borderTop = 1.0;80 this->_borderBottom = 1.0;81 76 } 82 77 … … 125 120 if (instantaniously) 126 121 { 127 this-> _frontColor = frontColor;122 this->style().setForegroundColor(frontColor); 128 123 if (this->_toFrontColor != NULL) 129 124 { … … 141 136 142 137 143 void GLGuiWidget::setBorderSize(float borderSize)144 {145 this->_borderLeft = borderSize;146 this->_borderRight = borderSize;147 this->_borderTop = borderSize;148 this->_borderBottom = borderSize;149 this->resize();150 }151 152 void GLGuiWidget::setBorderLeft(float borderLeft)153 {154 this->_borderLeft = borderLeft;155 this->resize();156 }157 void GLGuiWidget::setBorderRight(float borderRight)158 {159 this->_borderRight = borderRight;160 this->resize();161 }162 void GLGuiWidget::setBorderTop(float borderTop)163 {164 this->_borderTop = borderTop;165 this->resize();166 }167 void GLGuiWidget::setBorderBottom(float borderBottom)168 {169 this->_borderBottom = borderBottom;170 this->resize();171 }172 173 174 175 138 void GLGuiWidget::resize() 176 139 { … … 271 234 if (this->_toFrontColor) 272 235 { 273 this->_ frontColor.slerp(*_toFrontColor, dt*3.0);236 this->_style.foregroundColor(_state).slerp(*_toFrontColor, dt*3.0); 274 237 this->updateFrontColor(); 275 if (this-> _frontColor.dist(*_toFrontColor) < .1)238 if (this->style().foregroundColor(_state).dist(*_toFrontColor) < .1) 276 239 { 277 240 delete _toFrontColor; … … 287 250 void GLGuiWidget::draw() const 288 251 { 289 this->back Material().select();252 this->background().select(); 290 253 this->drawRect(this->backRect()); 291 this->back Material().unselect();254 this->background().unselect(); 292 255 } 293 256 -
branches/gui/src/lib/gui/gl/glgui_widget.h
r8518 r8583 66 66 void disconnect(GLGuiWidget* sender, Signal& signal, BaseObject* receiver); 67 67 68 OrxGui::State state() const { return this->_state; }; 68 69 69 70 GLGuiStyle& style() { return this->_style; }; 70 71 const GLGuiStyle style() const { return this->_style; }; 71 72 72 /// MATERIAL (looks) 73 Material& backMaterial() { return this->_backMat; }; 74 const Material& backMaterial() const { return this->_backMat; }; 73 74 /// STYLE-CONNECTION 75 /** @returns left borderWidth */ 76 inline float borderLeft() const { return _style.borderLeft(_state); } 77 /** @returns right borderWidth */ 78 inline float borderRight() const { return _style.borderRight(_state); } 79 /** @returns top borderWidth */ 80 inline float borderTop() const { return _style.borderTop(_state); } 81 /** @returns bottom borderWidth */ 82 inline float borderBottom() const { return _style.borderBottom(_state); } 83 84 /** @returns textSize */ 85 inline float textSize() const { return _style.textSize(_state); } 86 /** @returns the Background Color */ 87 inline const Color& backgroundColor() const { return _style.backgroundColor(_state); } 88 /** @returns background Texture. */ 89 inline const Texture& backgroundTexture() const { return _style.backgroundTexture(_state); }; 90 /** @returns the Background Material. */ 91 inline const Material& background() const { return _style.background(_state); } 92 /** @returns the foreground Color */ 93 inline const Color& foregroundColor() const { return _style.foregroundColor(_state); } 94 /** @returns the ForeGroung Material. */ 95 inline const Material& foreground() const { return _style.foreground(_state); } 96 97 /** @returns FeaturePosition */ 98 inline FeaturePosition featurePosition() const { return _style.featurePosition(); } 99 /** @returns the font */ 100 inline const Font* const font() const { return _style.font(); } 101 /** @returns true if the Element is Animated */ 102 inline bool animated() const { return _style.animated(); } 103 /** @returns true if State-Changes are animated */ 104 inline bool animatedStateChanges() const { return _style.animatedStateChanges(); } 105 106 107 75 108 Rect2D& backRect() { return this->_backRect; }; 76 109 const Rect2D& backRect() const { return this->_backRect; }; 77 110 78 111 void setFrontColor(const Color& frontColor, bool instantaniously = false); 79 const Color& frontColor() const { return this->_frontColor; };80 81 /** @brief sets all borders to the same value. */82 void setBorderSize(float borderSize);83 void setBorderLeft(float borderLeft);84 void setBorderRight(float borderRight);85 void setBorderTop(float borderTop);86 void setBorderBottom(float borderBottom);87 88 float borderLeft() const { return this->_borderLeft; };89 float borderRight() const { return this->_borderRight; };90 float borderTop() const { return this->_borderTop; };91 float borderBottom() const { return this->_borderBottom; };92 93 112 94 113 void setWidgetSize(const Vector2D& size); 95 114 void setWidgetSize(float x, float y); 96 115 97 98 void setBackgroundColor(float x, float y, float z) { this->backMaterial().setDiffuse(x,y,z); };99 116 100 117 inline void drawRect(const Rect2D& rect) const … … 144 161 145 162 /// LOOKS 146 Material _backMat;163 GLGuiStyle _style; 147 164 Rect2D _backRect; 148 165 149 Color _frontColor;150 166 Color* _toFrontColor; 151 152 float _borderLeft;153 float _borderRight;154 float _borderTop;155 float _borderBottom;156 167 157 168 Vector2D _minSize; 158 169 159 GLGuiStyle _style;160 170 161 171 /// EVENTS 172 OrxGui::State _state; 173 162 174 bool _focusable; //!< If this widget can receive focus. 163 175 bool _clickable; //!< if this widget can be clicked upon. -
branches/gui/src/lib/gui/gl/specials/glgui_notifier.cc
r8530 r8583 200 200 this->beginDraw(); 201 201 202 this->back Material().select();202 this->background().select(); 203 203 this->drawRect(this->backRect()); 204 204 this->endDraw(); -
branches/gui/src/story_entities/simple_game_menu.cc
r8518 r8583 120 120 OrxGui::GLGuiSlider* slider = new OrxGui::GLGuiSlider(); 121 121 slider->connect(SIGNAL(slider, valueChanged), this, SLOT(SimpleGameMenu, TEST)); 122 slider->connect(SIGNAL(slider, valueChanged), box, SLOT(OrxGui::GLGuiWidget, setBackgroundColor));123 122 slider->setRange(0, 1); 124 123 slider->setValue(slider->min()); -
branches/gui/src/util/hud.cc
r8518 r8583 89 89 { 90 90 this->energyWidget->show(); 91 this->energyWidget-> backMaterial().setDiffuseMap("hud_energy_background.png");92 this->energyWidget-> backMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);91 this->energyWidget->style().background().setDiffuseMap("hud_energy_background.png"); 92 this->energyWidget->style().background().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); 93 93 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 94 94 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 143 143 { 144 144 weapon->getEnergyWidget()->show(); 145 weapon->getEnergyWidget()-> backMaterial().setDiffuse( .8,.2,.11);146 weapon->getEnergyWidget()-> backMaterial().setTransparency(.1);145 weapon->getEnergyWidget()->style().background().setDiffuse( .8,.2,.11); 146 weapon->getEnergyWidget()->style().background().setTransparency(.1); 147 147 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); 148 148 // weapon->getEnergyWidget()->frontMaterial().setTransparency(.6);
Note: See TracChangeset
for help on using the changeset viewer.