Changeset 8991 in orxonox.OLD for trunk/src/world_entities/elements
- Timestamp:
- Jul 1, 2006, 8:16:09 PM (18 years ago)
- Location:
- trunk/src/world_entities/elements
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
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.