- Timestamp:
- Jul 1, 2006, 8:16:09 PM (18 years ago)
- Location:
- trunk/src
- Files:
-
- 6 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl/glgui_bar.cc
r8984 r8991 46 46 this->setClassID(CL_GLGUI_BAR, "GLGuiBar"); 47 47 48 this->setFrontColor( Color(1,1,1));48 this->setFrontColor(_changedValueColor, true); 49 49 50 50 this->setSize2D(50, 10); … … 87 87 } 88 88 89 void GLGuiBar::setChangedValueColor(const Color& color) 90 { 91 this->_changedValueColor = color; 92 } 93 94 89 95 void GLGuiBar::resize() 90 96 { -
trunk/src/lib/gui/gl/glgui_bar.h
r8986 r8991 31 31 void setRange(float minimum, float maximum); 32 32 33 void setChangedValueColor(const Color& color); 34 33 35 float value() const { return this->_value; }; 34 36 float minimum() const { return this->_minimum; }; … … 51 53 float _minimum; 52 54 float _maximum; 55 56 Color _changedValueColor; 53 57 }; 54 58 } -
trunk/src/lib/gui/gl/glgui_text.cc
r8980 r8991 52 52 this->_text.setColor(foregroundColor()); 53 53 this->_text.setVisibility(false); 54 this->_changedTextColor = Color::white; 54 55 this->resize(); 55 56 } … … 111 112 { 112 113 this->resize(); 113 this->setFrontColor( Color(1,1,1,1), true);114 this->setFrontColor(_changedTextColor, true); 114 115 emit(this->textChanged(this->_text.text())); 115 116 } 116 117 117 118 void GLGuiText::setChangedTextColor(const Color& color) 119 { 120 this->_changedTextColor = color; 121 } 118 122 119 123 /** -
trunk/src/lib/gui/gl/glgui_text.h
r8980 r8991 31 31 void clear(); 32 32 33 void setChangedTextColor(const Color& color); 34 33 35 void setDotsPosition(LimitedWidthText::DotsPosition dotsPosition) { this->_text.setDotsPosition(dotsPosition); }; 34 36 … … 53 55 private: 54 56 LimitedWidthText _text; 57 58 Color _changedTextColor; 55 59 }; 56 60 } -
trunk/src/world_entities/Makefile.am
r8972 r8991 32 32 \ 33 33 \ 34 elements/glgui_energywidget.cc 34 elements/glgui_energywidget.cc \ 35 elements/glgui_radar.cc 35 36 36 37 … … 65 66 \ 66 67 elements/glgui_energywidget.h \ 68 elements/glgui_radar.h \ 69 \ 70 \ 67 71 $(WorldEntities_HEADERS_) 68 72 -
trunk/src/world_entities/elements/glgui_energywidget.cc
r8990 r8991 32 32 this->_bar.setParent2D(&this->_valueText); 33 33 34 this->setBackgroundTexture("maps/gui_element_background_2.png"); 34 this->_name.setForegroundColor(Color(1,1,1,.8)); 35 this->_valueText.setChangedTextColor(Color::white); 36 37 //this->setBackgroundTexture("maps/gui_element_background_2.png"); 35 38 this->setBackgroundColor(Color(.5,.5,.5,1)); 36 39 37 this->_name.setBackgroundTexture(Texture());38 this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");40 //this->_name.setBackgroundTexture(Texture()); 41 //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png"); 39 42 this->_bar.setBackgroundTexture(Texture()); 40 43 this->_bar.setBackgroundColor(Color(0,0,0,0)); 41 44 this->_bar.setForegroundTexture("maps/gui_element_background_faded.png"); 42 45 this->_bar.setForegroundColor(Color(.5, .5, .5, 1)); 46 this->_bar.setChangedValueColor(Color::black); 43 47 } 44 48 -
trunk/src/world_entities/elements/glgui_radar.cc
r8990 r8991 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ … … 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include "glgui_ energywidget.h"18 #include "glgui_radar.h" 19 19 20 20 namespace OrxGui … … 23 23 * @brief standard constructor 24 24 */ 25 GLGui EnergyWidget::GLGuiEnergyWidget()25 GLGuiRadar::GLGuiRadar () 26 26 { 27 // this->setClassID(CL_PROTO_ID, "GLGuiEnergyWidget");28 29 this->_bar.setSize2D(100, 30);30 this->pack(&this->_name);31 this->pack(&this->_valueText);32 this->_bar.setParent2D(&this->_valueText);33 34 this->setBackgroundTexture("maps/gui_element_background_2.png");35 this->setBackgroundColor(Color(.5,.5,.5,1));36 37 this->_name.setBackgroundTexture(Texture());38 this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");39 this->_bar.setBackgroundTexture(Texture());40 this->_bar.setBackgroundColor(Color(0,0,0,0));41 this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");42 this->_bar.setForegroundColor(Color(.5, .5, .5, 1));43 27 } 44 28 … … 47 31 * @brief standard deconstructor 48 32 */ 49 GLGui EnergyWidget::~GLGuiEnergyWidget()33 GLGuiRadar::~GLGuiRadar () 50 34 { 51 35 } 52 36 53 37 54 void GLGui EnergyWidget::setDisplayedName(const std::string& name)38 void GLGuiRadar::resize() 55 39 { 56 this->_name.setText(name); 57 this->_bar.setWidgetSize(this->_name.getSize2D()); 58 } 59 60 void GLGuiEnergyWidget::setMaximum(float max) 61 { 62 this->_bar.setMaximum(max); 63 } 64 65 void GLGuiEnergyWidget::setValue(float value) 66 { 67 MultiType val(value); 68 val.setType(MT_INT); 69 70 71 this->_bar.setValue(value); 72 this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum())); 73 this->_bar.setFrontColor(Color(1,1,1,1), true); 74 this->_valueText.setText(val.getString()); 75 } 76 77 void GLGuiEnergyWidget::resize() 78 { 79 GLGuiBox::resize(); 40 GLGuiWidget::resize(); 80 41 } 81 42 82 43 83 void GLGui EnergyWidget::showing()44 void GLGuiRadar::showing() 84 45 { 85 this->_name.show();86 this->_valueText.show();87 this->_bar.show();88 46 } 89 47 90 void GLGui EnergyWidget::hiding()48 void GLGuiRadar::hiding() 91 49 { 92 this->_name.hide();93 this->_valueText.hide();94 this->_bar.hide();95 50 } 96 51 } -
trunk/src/world_entities/elements/glgui_radar.h
r8988 r8991 1 1 /*! 2 * @file glgui_ energywidget.h3 * @brief Definition of an EnergyWidget, that displays a bar and a Text2 * @file glgui_radar.h 3 * @brief Definition of an Radar, that displays a bar and a Text 4 4 */ 5 5 6 #ifndef _GLGUI_ ENERGY_WIDGET_H7 #define _GLGUI_ ENERGY_WIDGET_H6 #ifndef _GLGUI_RADAR_H 7 #define _GLGUI_RADAR_H 8 8 9 #include "glgui_ box.h"10 #include "glgui_bar.h" 11 #include "glgui_text.h" 9 #include "glgui_widget.h" 10 11 class WorldEntity; 12 12 13 13 namespace OrxGui … … 15 15 16 16 //! A class for ... 17 class GLGui EnergyWidget : public GLGuiBox17 class GLGuiRadar : public GLGuiWidget 18 18 { 19 19 20 20 public: 21 GLGui EnergyWidget();22 virtual ~GLGui EnergyWidget();21 GLGuiRadar(); 22 virtual ~GLGuiRadar(); 23 23 24 void setDisplayedName(const std::string& name); 25 void setMaximum(float max); 26 void setValue(float value); 24 void setRange(float range); 25 float range() const { return this->_range; } 27 26 28 27 protected: … … 32 31 33 32 private: 34 GLGuiText _name; 35 GLGuiText _valueText; 36 GLGuiBar _bar; 33 typedef struct 34 { 35 36 Color dotColor; 37 std::list<WorldEntity*>& entityList; 38 std::vector<Vector2D> position; 39 } DotList; 40 41 std::vector<DotList> _dotLists; 42 43 float _range; 37 44 38 45 }; 39 46 } 40 #endif /* _GLGUI_ ENERGY_WIDGET_H */47 #endif /* _GLGUI_RADAR_H */
Note: See TracChangeset
for help on using the changeset viewer.