Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10759 in orxonox.OLD


Ignore:
Timestamp:
Jun 21, 2007, 1:52:38 AM (17 years ago)
Author:
bknecht
Message:

hud updated

Location:
branches/presentation/src
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • branches/presentation/src/util/hud.cc

    r10753 r10759  
    3333#include "world_entities/space_ships/space_ship.h"
    3434
     35#include "tools/camera.h"
     36
     37
    3538
    3639
     
    4952
    5053  //this->setSize2D(
     54  this->playmode = Full3D;
    5155  this->weaponManager = NULL;
    5256  this->weaponManagerSecondary = NULL;
     
    6165  this->rightHit = NULL;
    6266  this->ifinit = true;
     67  this->hidden = false;
    6368 
    6469  this->barSocket = NULL;
     
    192197    this->energyWidget->setParent2D(this->leftRect);
    193198    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();
    195203    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
    196204        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
     
    221229    this->shieldWidget->setParent2D(this->leftRect);
    222230    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();
    224235    /*    this->shieldWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
    225236        this->shieldWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
     
    261272            this->healthWidget->setParent2D(this->leftRect);
    262273            //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();
    264278            /*    this->healthWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
    265279                this->healthWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
     
    291305    this->implantWidget->setParent2D(this->leftRect);
    292306    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();
    294311    /*    this->energyWidget->frontMaterial().setDiffuseMap("hud_energy_bar.png");
    295312        this->energyWidget->frontMaterial().setBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);*/
     
    409426        else
    410427                weapon->getEnergyWidget()->setParent2D(this->bottomRect);
    411         weapon->getEnergyWidget()->show();
     428        if (!this->hidden)
     429                weapon->getEnergyWidget()->show();
     430        else
     431                weapon->getEnergyWidget()->hide();
    412432        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
    413433        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
     
    426446        //PRINTF(0)("WEAPON %s::%s in Slots\n", weapon->getClassCName(), weapon->getName());
    427447        weapon->getEnergyWidget()->setParent2D(this->rightRect);
    428         weapon->getEnergyWidget()->show();
     448                if (!this->hidden)
     449                weapon->getEnergyWidget()->show();
     450        else
     451                weapon->getEnergyWidget()->hide();
    429452        weapon->getEnergyWidget()->setBackgroundColor(Color(.8,.2,.11, 0.1));
    430453        weapon->getEnergyWidget()->setFrontColor(Color( .2,.5,.7,.6));
     
    447470void Hud::getHit()
    448471{
     472        printf("Got hit!\n");
    449473        this->leftHit->show();
    450474        this->rightHit->show();
     
    463487        }
    464488        if (this->leftHit->isVisible())
     489        {
    465490                hitBarCount -= dt;
    466         if (hitBarCount < 0)
     491                printf("Reduce visibilty!\n");
     492        }
     493        if (hitBarCount <= 0)
    467494        {
    468495                hitBarCount = 0;
    469496                this->leftHit->hide();
    470497                this->rightHit->hide();
     498                printf("Hide again!\n");
    471499        }
    472500  }
     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();
    473515}
    474516
     
    518560        this->bottomRect->setWidgetSize(float(this->resX), float(overlayWidth));
    519561        this->bottomRect->setAbsCoor2D(0, this->resY - overlayWidth);
     562        //this->bottomRect->show();
    520563       
    521564        this->topRect->setParent2D(this);
    522565        this->topRect->setWidgetSize(float(this->resX), float(overlayWidth));
    523566        this->topRect->setAbsCoor2D(0, 0);
     567        //this->topRect->show();
    524568       
    525569        this->middleRect->setParent2D(this);
    526570        this->middleRect->setWidgetSize(float(this->resY)/2, float(this->resY)/2);
    527571        this->middleRect->setAbsCoor2D(float(this->resX)/4, float(this->resY)/4/*float(this->resX/2), float(this->resY/2)*/);
     572        //this->middleRect->show();
    528573       
    529574        /*this->bottomHit->setRelCoor2D(0, this->resY/4);
     
    535580        this->leftHit->setRelCoor2D(0, 0);
    536581        this->leftHit->setWidgetSize(this->resX/9, this->resX/3);
    537         this->leftHit->hide();
     582        //this->leftHit->hide();
    538583        this->rightHit->setRelCoor2D(this->resX/3, 0);
    539584        this->rightHit->setWidgetSize(this->resX/9, this->resX/3);
    540         this->rightHit->hide();
     585        //this->rightHit->hide();
    541586
    542587        this->barSocket->setWidgetSize(overlayWidth, overlayWidth);
    543588        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();
    545593
    546594        //this->middleRect->show();
     
    549597  }
    550598
    551   if (this->overlayActive)
     599  if (this->overlayActive && !this->hidden)
    552600  {
    553601    this->rightRect->show();
     
    574622    this->_radar->setWidgetSize(overlayWidth, overlayWidth);
    575623    this->_radar->setRange(300);
    576     this->_radar->show();
     624    if (!this->hidden)
     625        this->_radar->show();
     626    else
     627        this->_radar->hide();
    577628   
    578629    int statWidgetsNumber = 0;
     
    632683                this->barSocket->setParent2D(this->bottomRect);
    633684                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();
    635687               
    636688                this->healthWidget->setRelCoor2D(10,-20);
     
    681733    (*weaponWidget)->setAbsCoor2D(pos.x + this->rightRect->getAbsCoor2D().x, pos.y);
    682734    //(*weaponWidget)->setAbsCoor2D(0,100);
    683     (*weaponWidget)->show();
     735    if (!this->hidden)
     736        (*weaponWidget)->show();
     737    else
     738        (*weaponWidget)->hide();
    684739    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
    685740  }
     
    708763    //PRINTF(0)("secweaponwidget y-size: %f/n", (*weaponWidget)->getSizeY2D());
    709764    (*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();
    711769    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
    712770  }
  • branches/presentation/src/util/hud.h

    r10758 r10759  
    121121
    122122  bool                  ifinit;
     123  bool                  hidden;
    123124
    124125  OrxGui::GLGuiWidget*     rightRect;
  • branches/presentation/src/world_entities/weapons/crosshair.cc

    r10753 r10759  
    2323#include "state.h"
    2424#include "material.h"
     25
     26#include "tools/camera.h"
    2527
    2628
  • branches/presentation/src/world_entities/weapons/weapon_manager.cc

    r10739 r10759  
    124124void WeaponManager::showCrosshair()
    125125{
    126   this->crosshair->setVisibility( true);
     126  if (this->crosshair)
     127        this->crosshair->setVisibility( true);
    127128}
    128129
    129130void WeaponManager::hideCrosshair()
    130131{
    131   this->crosshair->setVisibility( false);
     132  if (this->crosshair)
     133        this->crosshair->setVisibility( false);
    132134}
    133135
Note: See TracChangeset for help on using the changeset viewer.