Changeset 10120 in orxonox.OLD for branches/playability/src
- Timestamp:
- Dec 20, 2006, 12:02:01 PM (18 years ago)
- Location:
- branches/playability/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/util/hud.cc
r10111 r10120 24 24 #include "glgui_widget.h" 25 25 #include "glgui_box.h" 26 #include "elements/glgui_energywidgetvertical.h" 26 27 27 28 #include "glgui_inputline.h" … … 108 109 this->energyWidget->show(); 109 110 this->energyWidget->shiftDir2D(270); 110 //this->energyWidget->setDisplayedName("Electronics")111 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedName("Electronics"); 111 112 this->shipValuesBox->pack(this->energyWidget); 112 113 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); … … 118 119 119 120 void Hud::setShiledWidget(OrxGui::GLGuiWidget* widget) 120 {} 121 { 122 // decopple old widget 123 if (this->shieldWidget != NULL) 124 { 125 this->shieldWidget->hide(); 126 } 127 128 this->shieldWidget = widget; 129 if (this->shieldWidget != NULL) 130 { 131 this->shieldWidget->show(); 132 this->shieldWidget->shiftDir2D(270); 133 this->shipValuesBox->pack(this->shieldWidget); 134 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 135 this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ 136 } 137 138 this->updateResolution(); 139 } 121 140 122 141 void Hud::setArmorWidget(OrxGui::GLGuiWidget* widget) 123 {} 142 { 143 // decopple old widget 144 if (this->armorWidget != NULL) 145 { 146 this->armorWidget->hide(); 147 } 148 149 this->armorWidget = widget; 150 if (this->armorWidget != NULL) 151 { 152 this->armorWidget->show(); 153 this->armorWidget->shiftDir2D(270); 154 //this->shipValuesBox->pack(this->armorWidget); 155 /* this->armorWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 156 this->armorWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ 157 } 158 159 this->updateResolution(); 160 } 124 161 125 162 void Hud::setWeaponManager(WeaponManager* weaponMan, WeaponManager* weaponManSec) … … 235 272 if (this->shipValuesBox != NULL) 236 273 { 237 this->shipValuesBox->setAbsCoor2D(0. 2* this->resX, 0.85 * this->resY);274 this->shipValuesBox->setAbsCoor2D(0.8 * this->resX, 0.85 * this->resY); 238 275 this->shipValuesBox->setWidgetSize(.4 * this->resX, 0.1 * this->resY); 239 276 } -
branches/playability/src/world_entities/elements/glgui_energywidgetvertical.cc
r10111 r10120 32 32 33 33 this->_bar.setSize2D(100, 30); 34 this->_name.setRelCoor2D(20 ,0);34 this->_name.setRelCoor2D(200,0); 35 35 this->_valueText.setRelCoor2D(22,0); 36 36 -
branches/playability/src/world_entities/player.cc
r10030 r10120 74 74 PRINTF(4)("Enter new Playable\n"); 75 75 this->playable = playable; 76 this->_hud.set EnergyWidget(this->playable->getHealthWidget());76 this->_hud.setArmorWidget(this->playable->getHealthWidget()); 77 77 if (dynamic_cast<SpaceShip*>(this->playable) != 0) 78 78 this->_hud.setWeaponManager(&this->playable->getWeaponManager(), &dynamic_cast<SpaceShip*>(this->playable)->getWeaponManagerSecondary()); -
branches/playability/src/world_entities/space_ships/space_ship.cc
r10119 r10120 30 30 #include "weapons/turret.h" 31 31 #include "weapons/cannon.h" 32 33 #include "elements/glgui_energywidgetvertical.h" 32 34 33 35 #include "particles/dot_emitter.h" … … 238 240 this->cameraNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE); 239 241 240 242 // widget handling 243 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 244 this->electronicWidget->setDisplayedName(std::string(this->getClassName()) + " Electronics:"); 245 this->electronicWidget->setSize2D(30,400); 246 this->electronicWidget->setAbsCoor2D(150,200); 247 this->electronicWidget->shiftDir2D(270); 248 this->updateElectronicWidget(); 249 this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 250 this->shieldWidget->setDisplayedName(std::string(this->getClassName()) + " Shield:"); 251 this->shieldWidget->setSize2D(30,400); 252 this->shieldWidget->setAbsCoor2D(200,200); 253 this->shieldWidget->shiftDir2D(270); 254 this->updateShieldWidget(); 255 if (this->hasPlayer()) 256 { 257 State::getPlayer()->hud().setShiledWidget(this->shieldWidget); 258 State::getPlayer()->hud().setEnergyWidget(this->electronicWidget); 259 } 241 260 242 261 //add events to the eventlist … … 694 713 this->destroy(this); 695 714 715 updateElectronicWidget(); 716 updateShieldWidget(); 717 696 718 this->setHealth( this->armorCur); 697 719 } … … 714 736 this->shieldCur = tmp; 715 737 this->shieldActive = ( this->shieldActive || this->shieldCur > shieldTH); 738 739 updateShieldWidget(); 716 740 } 717 741 … … 724 748 else 725 749 this->electronicCur = tmp; 726 } 750 751 updateElectronicWidget(); 752 } 753 727 754 } 728 755 … … 993 1020 //this->collidesWith(killer, this->getAbsCoor()); 994 1021 } 1022 1023 void SpaceShip::updateElectronicWidget() 1024 { 1025 this->electronicWidget->setMaximum(this->electronicMax); 1026 this->electronicWidget->setValue(this->electronicCur); 1027 if (this->hasPlayer()) 1028 this->electronicWidget->show(); 1029 } 1030 1031 void SpaceShip::updateShieldWidget() 1032 { 1033 this->shieldWidget->setMaximum(this->shieldMax); 1034 this->shieldWidget->setValue(this->shieldCur); 1035 if (this->hasPlayer()) 1036 this->shieldWidget->show(); 1037 } -
branches/playability/src/world_entities/space_ships/space_ship.h
r10117 r10120 75 75 virtual void damage(float pDamage, float eDamage); //!< pDamage physical damage, eDamage electronic damage 76 76 77 //included by Michel: (( 77 78 virtual void enterPlaymode(Playable::Playmode playmode); 78 void setPlaymodeXML(const std::string& playmode); 79 void setPlaymodeXML(const std::string& playmode); //recieves the playmode from a string (useful for script implementation) 79 80 virtual void movement (float dt); 81 82 //)) 80 83 81 84 void nextWeaponConfig(); … … 94 97 95 98 inline bool systemFailure() { return (this->electronicCur < float(rand())/float(RAND_MAX) * this->electronicTH); }; 99 100 void updateElectronicWidget(); 101 void updateShieldWidget(); 96 102 97 103 //WeaponManager weaponMan; //!< the primary weapon manager: managing a list of energy weapons to wepaon-slot mapping … … 107 113 float shieldTH; //!< shield threshhold for reactivation 108 114 bool shieldActive; //!< wheather the shield is working 115 OrxGui::GLGuiEnergyWidgetVertical* shieldWidget; //!< holds the widget that shows the shield bar 109 116 110 117 float armorCur; //!< current armor 111 118 float armorMax; //!< maximum armor 112 119 float armorRegen; //!< armor regeneration per tick (usable on bioships?) 120 //note that the armor widget is set on the health- widget in world- entity (see in player.cc) 113 121 114 122 float electronicCur; //!< current electronic … … 116 124 float electronicRegen; //!< electronic regenration rate per tick 117 125 float electronicTH; //!< Threshhold for electronic failure 126 OrxGui::GLGuiEnergyWidgetVertical* electronicWidget; //!< holds the widget that shows the electronic bar 118 127 119 128 float engineSpeedCur; //!< speed output for movement = speed base + energy share part -
branches/playability/src/world_entities/world_entity.cc
r10113 r10120 752 752 { 753 753 this->healthWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 754 this->healthWidget->setDisplayedName( std::string(this->getClassName()) + " Energy:");754 this->healthWidget->setDisplayedName("Electronics"); 755 755 this->healthWidget->setSize2D(30,400); 756 this->healthWidget->setAbsCoor2D(10 ,100);756 this->healthWidget->setAbsCoor2D(100,200); 757 757 758 758 this->updateHealthWidget();
Note: See TracChangeset
for help on using the changeset viewer.