- Timestamp:
- Jun 21, 2007, 3:44:16 AM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/util/hud.cc
r10759 r10764 210 210 void Hud::setShieldWidget(OrxGui::GLGuiWidget* widget) 211 211 { 212 /* 213 if (this->shipValuesBox == NULL) 214 this->createShipValuesBox(); 215 */ 216 217 // decopple old widget 218 if (this->shieldWidget != NULL) 219 { 220 this->shieldWidget->hide(); 221 } 222 223 this->shieldWidget = widget; 224 if (this->shieldWidget != NULL) 225 { 226 //this->shieldWidget->shiftDir2D(270); 227 //this->shipValuesBox->pack(this->shieldWidget); 228 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings(); 229 this->shieldWidget->setParent2D(this->leftRect); 230 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setDisplayedImage("textures/gui/gui_shield_icon.png"); 231 if (!this->hidden) 232 this->shieldWidget->show(); 233 else 212 if( this->playmode == FirstPerson ) 213 { 214 this->shieldWidget = new OrxGui::GLGuiBar(); 215 dynamic_cast<OrxGui::GLGuiBar*> (this->shieldWidget)->setMaximum(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->maximum()); 216 dynamic_cast<OrxGui::GLGuiBar*> (this->shieldWidget)->setValue(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->value()); 217 this->shieldWidget->setBackgroundTexture(Texture()); 218 this->shieldWidget->setBackgroundColor(Color(0,0,0,0)); 219 this->shieldWidget->setForegroundTexture("textures/gui/gui_element_background_faded.png"); 220 this->shieldWidget->setForegroundColor(Color(1,1,0,1)); 221 dynamic_cast<OrxGui::GLGuiBar*>(this->shieldWidget)->setChangedValueColor(Color(1,0,0,0.2)); 222 this->shieldWidget->setWidgetSize(150,20); 223 this->shieldWidget->setRelDir2D(180); 224 this->shieldWidget->setParent2D(this->barSocket); 225 } 226 else 227 { 228 /* 229 if (this->shipValuesBox == NULL) 230 this->createShipValuesBox(); 231 */ 232 233 // decopple old widget 234 if (this->shieldWidget != NULL) 235 { 234 236 this->shieldWidget->hide(); 235 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 236 this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ 237 } 238 else 239 printf("schild im hud nicht uebergeben!!!!!!!!!!!!!!!!!!!!!!!!!"); 237 } 238 239 this->shieldWidget = widget; 240 if (this->shieldWidget != NULL) 241 { 242 //this->shieldWidget->shiftDir2D(270); 243 //this->shipValuesBox->pack(this->shieldWidget); 244 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setStandardSettings(); 245 this->shieldWidget->setParent2D(this->leftRect); 246 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setDisplayedImage("textures/gui/gui_shield_icon.png"); 247 if (!this->hidden) 248 this->shieldWidget->show(); 249 else 250 this->shieldWidget->hide(); 251 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 252 this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ 253 } 254 else 255 printf("schild im hud nicht uebergeben!!!!!!!!!!!!!!!!!!!!!!!!!"); 256 } 240 257 241 258 this->updateResolution(); … … 249 266 dynamic_cast<OrxGui::GLGuiBar*> (this->healthWidget)->setMaximum(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->maximum()); 250 267 dynamic_cast<OrxGui::GLGuiBar*> (this->healthWidget)->setValue(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->value()); 268 this->healthWidget->setBackgroundTexture(Texture()); 269 this->healthWidget->setBackgroundColor(Color(0,0,0,0)); 270 this->healthWidget->setForegroundTexture("textures/gui/gui_element_background_faded.png"); 271 this->healthWidget->setForegroundColor(Color::red); 272 dynamic_cast<OrxGui::GLGuiBar*>(this->healthWidget)->setChangedValueColor(Color(1,0,0,0.2)); 273 this->healthWidget->setWidgetSize(150,20); 274 this->healthWidget->setRelDir2D(180); 251 275 this->healthWidget->setParent2D(this->barSocket); 252 276 } … … 271 295 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setStandardSettings(); 272 296 this->healthWidget->setParent2D(this->leftRect); 273 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setDisplayedImage("textures/gui/gui_health_icon.png");297 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setDisplayedImage("textures/gui/gui_health_icon.png"); 274 298 if(!this->hidden) 275 299 this->healthWidget->show(); … … 489 513 { 490 514 hitBarCount -= dt; 491 printf("Reduce visibilty!\n");492 515 } 493 516 if (hitBarCount <= 0) … … 496 519 this->leftHit->hide(); 497 520 this->rightHit->hide(); 498 printf("Hide again!\n");499 521 } 500 522 } … … 684 706 this->barSocket->setWidgetSize( float(overlayWidth), float(overlayWidth)); 685 707 this->barSocket->setRelCoor2D(this->resX - float(overlayWidth),0); 686 this->barSocket->show(); 708 if (!this->hidden) 709 this->barSocket->show(); 710 else 711 this->barSocket->hide(); 687 712 688 this->healthWidget->setRelCoor2D(10,-20); 713 this->healthWidget->setRelCoor2D(50,70); 714 this->healthWidget->show(); 715 if (this->shieldWidget) 716 { 717 this->shieldWidget->setRelCoor2D(40,110); 718 this->shieldWidget->show(); 719 } 689 720 } 690 721 -
branches/presentation/src/util/hud.h
r10759 r10764 114 114 OrxGui::GLGuiWidget* healthWidget; 115 115 OrxGui::GLGuiWidget* implantWidget; 116 OrxGui::GLGuiText* energyText; 116 117 117 118 OrxGui::GLGuiNotifier* notifier; -
branches/presentation/src/world_entities/player.cc
r10698 r10764 80 80 this->_hud.setMode(Hud::FirstPerson); 81 81 this->_hud.setHealthWidget(this->playable->getHealthWidget()); 82 this->_hud.setShieldWidget(this->playable->getShieldWidget()); 82 83 } 83 84 else … … 85 86 this->_hud.setMode(Hud::Full3D); 86 87 this->_hud.setHealthWidget(this->playable->getHealthWidget()); 88 this->_hud.setShieldWidget(this->playable->getShieldWidget()); 87 89 } 88 90 /*if (dynamic_cast<SpaceShip*>(this->playable) != 0)
Note: See TracChangeset
for help on using the changeset viewer.