Changeset 10139 in orxonox.OLD for branches/playability/src/world_entities/space_ships/space_ship.cc
- Timestamp:
- Dec 22, 2006, 12:21:38 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/playability/src/world_entities/space_ships/space_ship.cc
r10133 r10139 232 232 233 233 // widget handling 234 /* 234 235 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 235 236 this->electronicWidget->setDisplayedName(std::string(this->getClassName()) + " Electronics:"); … … 249 250 State::getPlayer()->hud().setEnergyWidget(this->electronicWidget); 250 251 } 252 */ 253 this->electronicWidget = NULL; 254 this->shieldWidget = NULL; 251 255 252 256 //add events to the eventlist … … 392 396 this->secWeaponMan.showCrosshair(); 393 397 this->toList( OM_GROUP_01 ); 398 dynamic_cast <OrxGui::GLGuiEnergyWidgetVertical*> (State::getPlayer()->hud().getArmorWidget())->setDisplayedName("Armor"); 394 399 //dynamic_cast<Element2D*>(this->secWeaponMan.getFixedTarget())->setVisibility( true); 395 400 //this->attachCamera(); … … 1014 1019 void SpaceShip::updateElectronicWidget() 1015 1020 { 1016 this->electronicWidget->setMaximum(this->electronicMax); 1017 this->electronicWidget->setValue(this->electronicCur); 1018 if (this->hasPlayer()) 1019 this->electronicWidget->show(); 1021 if (this->electronicWidget != NULL) 1022 { //if it exists already: update it 1023 this->electronicWidget->setMaximum(this->electronicMax); 1024 this->electronicWidget->setValue(this->electronicCur); 1025 } 1026 else 1027 { //create the widget 1028 this->electronicWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1029 this->electronicWidget->setDisplayedName("Electronics:"); 1030 //this->electronicWidget->setSize2D(100,20); 1031 //this->electronicWidget->setAbsCoor2D(150,200); 1032 this->updateElectronicWidget(); 1033 if (this->hasPlayer()) 1034 State::getPlayer()->hud().setEnergyWidget(this->electronicWidget); 1035 } 1020 1036 } 1021 1037 1022 1038 void SpaceShip::updateShieldWidget() 1023 1039 { 1024 this->shieldWidget->setMaximum(this->shieldMax); 1025 this->shieldWidget->setValue(this->shieldCur); 1026 if (this->hasPlayer()) 1027 this->shieldWidget->show(); 1028 } 1040 if (this->shieldWidget != NULL) 1041 { 1042 this->shieldWidget->setMaximum(this->shieldMax); 1043 this->shieldWidget->setValue(this->shieldCur);; 1044 } 1045 else 1046 { 1047 this->shieldWidget = new OrxGui::GLGuiEnergyWidgetVertical(); 1048 this->shieldWidget->setDisplayedName("Shield:"); 1049 //his->shieldWidget->setSize2D(100,20); 1050 //this->shieldWidget->setAbsCoor2D(200,200); 1051 this->updateShieldWidget(); 1052 if (this->hasPlayer()) 1053 State::getPlayer()->hud().setShiledWidget(this->shieldWidget); 1054 } 1055 }
Note: See TracChangeset
for help on using the changeset viewer.