Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10764 in orxonox.OLD


Ignore:
Timestamp:
Jun 21, 2007, 3:44:16 AM (17 years ago)
Author:
bknecht
Message:

hud is slowly cooler

Location:
branches/presentation/src
Files:
3 edited

Legend:

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

    r10759 r10764  
    210210void Hud::setShieldWidget(OrxGui::GLGuiWidget* widget)
    211211{
    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        {
    234236        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  }
    240257
    241258  this->updateResolution();
     
    249266                dynamic_cast<OrxGui::GLGuiBar*> (this->healthWidget)->setMaximum(dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (widget)->getBarWidget()->maximum());
    250267                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);
    251275                this->healthWidget->setParent2D(this->barSocket);
    252276        }
     
    271295            //dynamic_cast<OrxGui::GLGuiEnergyWidgetVertical*> (this->healthWidget)->setStandardSettings();
    272296            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");
    274298            if(!this->hidden)
    275299                this->healthWidget->show();
     
    489513        {
    490514                hitBarCount -= dt;
    491                 printf("Reduce visibilty!\n");
    492515        }
    493516        if (hitBarCount <= 0)
     
    496519                this->leftHit->hide();
    497520                this->rightHit->hide();
    498                 printf("Hide again!\n");
    499521        }
    500522  }
     
    684706                this->barSocket->setWidgetSize( float(overlayWidth), float(overlayWidth));
    685707                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();
    687712               
    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                }
    689720        }
    690721       
  • branches/presentation/src/util/hud.h

    r10759 r10764  
    114114  OrxGui::GLGuiWidget*      healthWidget;
    115115  OrxGui::GLGuiWidget*      implantWidget;
     116  OrxGui::GLGuiText*        energyText;
    116117
    117118  OrxGui::GLGuiNotifier*    notifier;
  • branches/presentation/src/world_entities/player.cc

    r10698 r10764  
    8080        this->_hud.setMode(Hud::FirstPerson);
    8181        this->_hud.setHealthWidget(this->playable->getHealthWidget());
     82        this->_hud.setShieldWidget(this->playable->getShieldWidget());
    8283    }
    8384    else
     
    8586        this->_hud.setMode(Hud::Full3D);
    8687        this->_hud.setHealthWidget(this->playable->getHealthWidget());
     88        this->_hud.setShieldWidget(this->playable->getShieldWidget());
    8789    }
    8890    /*if (dynamic_cast<SpaceShip*>(this->playable) != 0)
Note: See TracChangeset for help on using the changeset viewer.