Changeset 10194 in orxonox.OLD for branches/playability/src/world_entities
- Timestamp:
- Jan 8, 2007, 9:19:39 PM (18 years ago)
- Location:
- branches/playability/src/world_entities
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
r10139 r10194 19 19 20 20 #include "multi_type.h" 21 #include <iostream> 22 #include "math.h" 21 23 22 24 namespace OrxGui … … 33 35 //this->_name.setRelCoor2D(20,0); 34 36 //this->_valueText.setRelCoor2D(,0); 35 this->shiftDir2D(270); 36 this->setOrientation(OrxGui::Horizontal); 37 this->pack(&this->_name); 38 this->pack(&this->_valueText); 39 this->_bar.setParent2D(&this->_valueText); 37 this->setAbsDir2D(270); 38 //std::cout << "absAngle: " << int(this->getAbsDir2D()) << ", relAngle: " << int(this->getRelDir2D()) << '\n'; 39 //this->setOrientation(OrxGui::Vertical); 40 40 41 this->_name.setForegroundColor(Color(1,1,1,.8)); 41 //this->pack(&this->_name); 42 //this->pack(&this->_valueText); 43 44 this->_image.setParent2D(this); 45 this->_image.setSize2D(20,20); 46 this->_image.setBackgroundColor(Color(1,1,1,.8)); 47 this->_image.setBackgroundTexture("maps/TE2.png"); 48 this->_image.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 49 50 this->_valueText.setParent2D(this); 51 this->_valueText.setSize2D(100,20); 52 this->_valueText.setRelCoor2D(borderLeft(), borderTop() + this->_bar.getSizeX2D()); 42 53 this->_valueText.setChangedTextColor(Color::white); 43 this->_bar.setBackgroundTexture(Texture());44 54 45 55 this->setBackgroundTexture(Texture()); 46 this->setBackgroundColor(Color(.5,.5,.5,0.5)); 56 this->setBackgroundColor(Color(.5,.5,.5,0)); 57 this->setSize2D(120,20); 47 58 48 59 //this->_name.setBackgroundTexture(Texture()); 49 60 //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png"); 61 62 this->_bar.setParent2D(&this->_valueText); 50 63 this->_bar.setBackgroundTexture(Texture()); 51 64 this->_bar.setBackgroundColor(Color(0,0,0,0)); … … 53 66 this->_bar.setForegroundColor(Color(.5, .5, .5, 1)); 54 67 this->_bar.setChangedValueColor(Color::black); 68 this->_bar.setSize2D(100,20); 69 this->_bar.setRelCoor2D(borderLeft(), 0); 55 70 } 56 71 … … 61 76 GLGuiEnergyWidgetVertical::~GLGuiEnergyWidgetVertical () 62 77 { 63 }64 65 66 void GLGuiEnergyWidgetVertical::setDisplayedName(const std::string& name)67 {68 this->_name.setText(name);69 this->_bar.setWidgetSize(this->_name.getSize2D());70 78 } 71 79 … … 85 93 this->_bar.setFrontColor(Color(1,1,1,1), true); 86 94 this->_valueText.setText(val.getString()); 95 //this->_valueText.setText("asdfas"); 87 96 } 88 97 89 98 void GLGuiEnergyWidgetVertical::resize() 90 99 { 91 GLGuiBox::resize();100 //GLGuiBox::resize(); 92 101 } 93 102 … … 95 104 void GLGuiEnergyWidgetVertical::showing() 96 105 { 97 this->_ name.show();106 this->_image.show(); 98 107 this->_valueText.show(); 99 108 this->_bar.show(); … … 102 111 void GLGuiEnergyWidgetVertical::hiding() 103 112 { 104 this->_ name.hide();113 this->_image.hide(); 105 114 this->_valueText.hide(); 106 115 this->_bar.hide(); -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.h
r10107 r10194 10 10 #include "glgui_bar.h" 11 11 #include "glgui_text.h" 12 #include "glgui_widget.h" 12 13 13 14 namespace OrxGui … … 15 16 16 17 //! A class for ... 17 class GLGuiEnergyWidgetVertical : public GLGui Box18 class GLGuiEnergyWidgetVertical : public GLGuiWidget 18 19 { 19 20 … … 22 23 virtual ~GLGuiEnergyWidgetVertical(); 23 24 24 void setDisplayedName(const std::string& name);25 25 void setMaximum(float max); 26 26 void setValue(float value); 27 27 28 inline GLGuiWidget* get NameWidget() {return &this->_name;};28 inline GLGuiWidget* getImageWidget() {return &this->_image;}; 29 29 inline GLGuiWidget* getValueWidget() {return &this->_valueText;}; 30 30 inline GLGuiWidget* getBarWidget() {return &this->_bar;}; … … 36 36 37 37 private: 38 GLGui Text _name;38 GLGuiWidget _image; 39 39 GLGuiText _valueText; 40 40 GLGuiBar _bar; -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10188 r10194 416 416 this->secWeaponMan.showCrosshair(); 417 417 this->toList( OM_GROUP_01 ); 418 dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor");418 //dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor"); 419 419 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 420 420 //this->attachCamera(); … … 1047 1047 { //create the widget 1048 1048 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1049 this->electronicWidget->setDisplayedName("Electronics:");1049 //this->electronicWidget->setDisplayedName("Electronics:"); 1050 1050 //this->electronicWidget->setSize2D(100,20); 1051 1051 //this->electronicWidget->setAbsCoor2D(150,200); … … 1066 1066 { 1067 1067 this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1068 this->shieldWidget->setDisplayedName("Shield:");1068 //this->shieldWidget->setDisplayedName("Shield:"); 1069 1069 //his->shieldWidget->setSize2D(100,20); 1070 1070 //this->shieldWidget->setAbsCoor2D(200,200); -
branches/playability/src/world_entities/world_entity.cc
r10139 r10194 752 752 { 753 753 this->healthWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 754 this->healthWidget->setDisplayedName("Health");754 //this->healthWidget->setDisplayedName("Health"); 755 755 //this->healthWidget->setSize2D(100,20); 756 756 //this->healthWidget->setAbsCoor2D(100,200);
Note: See TracChangeset
for help on using the changeset viewer.