Changeset 10759 in orxonox.OLD for branches/presentation
- Timestamp:
- Jun 21, 2007, 1:52:38 AM (18 years ago)
- Location:
- branches/presentation/src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/presentation/src/util/hud.cc
r10753 r10759 33 33 #include "world_entities/space_ships/space_ship.h" 34 34 35 #include "tools/camera.h" 36 37 35 38 36 39 … … 49 52 50 53 //this->setSize2D( 54 this->playmode = Full3D; 51 55 this->weaponManager = NULL; 52 56 this->weaponManagerSecondary = NULL; … … 61 65 this->rightHit = NULL; 62 66 this->ifinit = true; 67 this->hidden = false; 63 68 64 69 this->barSocket = NULL; … … 192 197 this->energyWidget->setParent2D(this->leftRect); 193 198 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->energyWidget)->setDisplayedImage("textures/gui/gui_electronics_icon.png"); 194 this->energyWidget->show(); 199 if (!this->hidden) 200 this->energyWidget->show(); 201 else 202 this->energyWidget->hide(); 195 203 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 196 204 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 221 229 this->shieldWidget->setParent2D(this->leftRect); 222 230 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->shieldWidget)->setDisplayedImage("textures/gui/gui_shield_icon.png"); 223 this->shieldWidget->show(); 231 if (!this->hidden) 232 this->shieldWidget->show(); 233 else 234 this->shieldWidget->hide(); 224 235 /* this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 225 236 this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 261 272 this->healthWidget->setParent2D(this->leftRect); 262 273 //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setDisplayedImage("textures/gui/gui_health_icon.png"); 263 this->healthWidget->show(); 274 if(!this->hidden) 275 this->healthWidget->show(); 276 else 277 this->healthWidget->hide(); 264 278 /* this->healthWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 265 279 this->healthWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 291 305 this->implantWidget->setParent2D(this->leftRect); 292 306 dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->implantWidget)->setDisplayedImage("textures/gui/gui_electronics_icon.png"); 293 this->implantWidget->show(); 307 if (!this->hidden) 308 this->implantWidget->show(); 309 else 310 this->implantWidget->hide(); 294 311 /* this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png"); 295 312 this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/ … … 409 426 else 410 427 weapon->getEnergyWidget()->setParent2D(this->bottomRect); 411 weapon->getEnergyWidget()->show(); 428 if (!this->hidden) 429 weapon->getEnergyWidget()->show(); 430 else 431 weapon->getEnergyWidget()->hide(); 412 432 weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); 413 433 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); … … 426 446 //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName()); 427 447 weapon->getEnergyWidget()->setParent2D(this->rightRect); 428 weapon->getEnergyWidget()->show(); 448 if (!this->hidden) 449 weapon->getEnergyWidget()->show(); 450 else 451 weapon->getEnergyWidget()->hide(); 429 452 weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1)); 430 453 weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6)); … … 447 470 void Hud::getHit() 448 471 { 472 printf("Got hit!\n"); 449 473 this->leftHit->show(); 450 474 this->rightHit->show(); … … 463 487 } 464 488 if (this->leftHit->isVisible()) 489 { 465 490 hitBarCount -= dt; 466 if (hitBarCount < 0) 491 printf("Reduce visibilty!\n"); 492 } 493 if (hitBarCount <= 0) 467 494 { 468 495 hitBarCount = 0; 469 496 this->leftHit->hide(); 470 497 this->rightHit->hide(); 498 printf("Hide again!\n"); 471 499 } 472 500 } 501 //Crosshair* crosshair = dynamic_cast<Crosshair*>(this->weaponManager->getFixedTarget()); 502 if ((State::getCamera())->getName() == "GameWorldCamera") 503 { 504 this->hidden = false; 505 if(this->weaponManager) 506 this->weaponManager->showCrosshair(); 507 } 508 else 509 { 510 this->hidden = true; 511 if(this->weaponManager) 512 this->weaponManager->hideCrosshair(); 513 } 514 this->updateResolution(); 473 515 } 474 516 … … 518 560 this->bottomRect->setWidgetSize(float(this->resX), float(overlayWidth)); 519 561 this->bottomRect->setAbsCoor2D(0, this->resY - overlayWidth); 562 //this->bottomRect->show(); 520 563 521 564 this->topRect->setParent2D(this); 522 565 this->topRect->setWidgetSize(float(this->resX), float(overlayWidth)); 523 566 this->topRect->setAbsCoor2D(0, 0); 567 //this->topRect->show(); 524 568 525 569 this->middleRect->setParent2D(this); 526 570 this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2); 527 571 this->middleRect->setAbsCoor2D(float(this->resX)/4, float(this->resY)/4/*float(this->resX/2), float(this->resY/2)*/); 572 //this->middleRect->show(); 528 573 529 574 /*this->bottomHit->setRelCoor2D(0, this->resY/4); … … 535 580 this->leftHit->setRelCoor2D(0, 0); 536 581 this->leftHit->setWidgetSize(this->resX/9, this->resX/3); 537 this->leftHit->hide();582 //this->leftHit->hide(); 538 583 this->rightHit->setRelCoor2D(this->resX/3, 0); 539 584 this->rightHit->setWidgetSize(this->resX/9, this->resX/3); 540 this->rightHit->hide();585 //this->rightHit->hide(); 541 586 542 587 this->barSocket->setWidgetSize(overlayWidth, overlayWidth); 543 588 this->barSocket->setRelCoor2D(this->resX - overlayWidth, 0); 544 this->barSocket->show(); 589 if (!this->hidden) 590 this->barSocket->show(); 591 else 592 this->barSocket->hide(); 545 593 546 594 //this->middleRect->show(); … … 549 597 } 550 598 551 if (this->overlayActive )599 if (this->overlayActive && !this->hidden) 552 600 { 553 601 this->rightRect->show(); … … 574 622 this->_radar->setWidgetSize(overlayWidth, overlayWidth); 575 623 this->_radar->setRange(300); 576 this->_radar->show(); 624 if (!this->hidden) 625 this->_radar->show(); 626 else 627 this->_radar->hide(); 577 628 578 629 int statWidgetsNumber = 0; … … 632 683 this->barSocket->setParent2D(this->bottomRect); 633 684 this->barSocket->setWidgetSize( float(overlayWidth), float(overlayWidth)); 634 this->barSocket->setRelCoor2D(0,this->resX - float(overlayWidth)); 685 this->barSocket->setRelCoor2D(this->resX - float(overlayWidth),0); 686 this->barSocket->show(); 635 687 636 688 this->healthWidget->setRelCoor2D(10,-20); … … 681 733 (*weaponWidget)->setAbsCoor2D(pos.x + this->rightRect->getAbsCoor2D().x, pos.y); 682 734 //(*weaponWidget)->setAbsCoor2D(0,100); 683 (*weaponWidget)->show(); 735 if (!this->hidden) 736 (*weaponWidget)->show(); 737 else 738 (*weaponWidget)->hide(); 684 739 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 685 740 } … … 708 763 //PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D()); 709 764 (*weaponWidget)->setAbsCoor2D(pos.x, pos.y);//+this->rightRect->getAbsCoor2D().x, pos.y); 710 (*weaponWidget)->show(); 765 if (!this->hidden) 766 (*weaponWidget)->show(); 767 else 768 (*weaponWidget)->hide(); 711 769 //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName()); 712 770 } -
branches/presentation/src/util/hud.h
r10758 r10759 121 121 122 122 bool ifinit; 123 bool hidden; 123 124 124 125 OrxGui::GLGuiWidget* rightRect; -
branches/presentation/src/world_entities/weapons/crosshair.cc
r10753 r10759 23 23 #include "state.h" 24 24 #include "material.h" 25 26 #include "tools/camera.h" 25 27 26 28 -
branches/presentation/src/world_entities/weapons/weapon_manager.cc
r10739 r10759 124 124 void WeaponManager::showCrosshair() 125 125 { 126 this->crosshair->setVisibility( true); 126 if (this->crosshair) 127 this->crosshair->setVisibility( true); 127 128 } 128 129 129 130 void WeaponManager::hideCrosshair() 130 131 { 131 this->crosshair->setVisibility( false); 132 if (this->crosshair) 133 this->crosshair->setVisibility( false); 132 134 } 133 135
Note: See TracChangeset
for help on using the changeset viewer.