Changeset 8991 in orxonox.OLD for trunk/src/world_entities/elements/glgui_radar.cc
- Timestamp:
- Jul 1, 2006, 8:16:09 PM (18 years ago)
- File:
-
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.