Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10766 in orxonox.OLD


Ignore:
Timestamp:
Jun 21, 2007, 5:20:30 AM (17 years ago)
Author:
bknecht
Message:

some finishing stuff

Location:
branches/presentation/src/util
Files:
2 edited

Legend:

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

    r10764 r10766  
    3434
    3535#include "tools/camera.h"
     36#include "multi_type.h"
    3637
    3738
     
    155156                this->rightHit->setParent2D(this->middleRect);
    156157               
     158                this->healthText = new OrxGui::GLGuiText();
     159                this->healthText->setParent2D(this->barSocket);
     160               
     161                this->shieldText = new OrxGui::GLGuiText();
     162                this->shieldText->setParent2D(this->barSocket);
     163               
    157164               
    158165                this->leftRect->setParent2D(this);
     
    218225                this->shieldWidget->setBackgroundColor(Color(0,0,0,0));
    219226                this->shieldWidget->setForegroundTexture("textures/gui/gui_element_background_faded.png");
    220                 this->shieldWidget->setForegroundColor(Color(1,1,0,1));
     227                this->shieldWidget->setForegroundColor(Color(1,1,0,0.5));
    221228                dynamic_cast<OrxGui::GLGuiBar*>(this->shieldWidget)->setChangedValueColor(Color(1,0,0,0.2));
    222                 this->shieldWidget->setWidgetSize(150,20);
     229                this->shieldWidget->setWidgetSize(150,40);
    223230                this->shieldWidget->setRelDir2D(180);
    224231                this->shieldWidget->setParent2D(this->barSocket);
     232               
     233                this->shieldText->setTextSize(50);
     234                this->shieldText->setChangedTextColor(Color::white);
     235                this->shieldText->setForegroundColor(Color(1,1,0,1));
     236                this->shieldText->setBackgroundTexture(Texture());
     237                this->shieldText->setBackgroundColor(Color(0,0,0,0));
     238                MultiType val(dynamic_cast<OrxGui::GLGuiBar*>(this->shieldWidget)->value());
     239                val.setType(MT_INT);
     240                this->shieldText->setText(val.getString());
    225241        }
    226242        else
     
    274290                this->healthWidget->setRelDir2D(180);
    275291                this->healthWidget->setParent2D(this->barSocket);
     292
     293                this->healthText->setTextSize(80);
     294                this->healthText->setChangedTextColor(Color::white);
     295                this->healthText->setForegroundColor(Color::red);
     296                this->healthText->setBackgroundTexture(Texture());
     297                this->healthText->setBackgroundColor(Color(0,0,0,0));
     298                MultiType val(dynamic_cast<OrxGui::GLGuiBar*>(this->healthWidget)->value());
     299                val.setType(MT_INT);
     300                this->healthText->setText(val.getString());
    276301        }
    277302        else
     
    494519void Hud::getHit()
    495520{
    496         printf("Got hit!\n");
    497521        this->leftHit->show();
    498522        this->rightHit->show();
     
    710734                else
    711735                        this->barSocket->hide();
    712                
    713                 this->healthWidget->setRelCoor2D(50,70);
    714                 this->healthWidget->show();
    715736                if (this->shieldWidget)
    716737                {
    717                         this->shieldWidget->setRelCoor2D(40,110);
    718                         this->shieldWidget->show();
     738                        this->shieldWidget->setRelCoor2D(40,overlayWidth/2+10);
     739                        if (!this->hidden)
     740                                this->shieldWidget->show();
     741                        else
     742                                this->shieldWidget->hide();
     743                        this->shieldText->setRelCoor2D(overlayWidth/2-30,overlayWidth/2-60);
     744                        if (!this->hidden)
     745                                this->shieldText->show();
     746                        else
     747                                this->shieldText->hide();
    719748                }
     749                this->healthWidget->setRelCoor2D(40,overlayWidth/2);
     750                if (!this->hidden)
     751                        this->healthWidget->show();
     752                else
     753                        this->healthWidget->hide();
     754                this->healthText->setRelCoor2D(overlayWidth/2-50,overlayWidth/2-20);
     755                if (!this->hidden)
     756                        this->healthText->show();
     757                else
     758                        this->healthText->hide();
     759
    720760        }
    721761       
     
    742782    createShipValuesBox();
    743783  */
    744 
     784 if (this->playmode != FirstPerson )
     785 {
    745786  std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
    746787  Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY);
     
    800841    //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
    801842  }
     843 }
     844 else
     845 {
     846        std::list<OrxGui::GLGuiEnergyWidgetVertical*>::iterator weaponWidget;
     847        Vector2D pos = Vector2D(overlayWidth, 0.4*this->resY);
     848        float largestWidgetSizeX = 0;
     849
     850        for (weaponWidget = this->weaponsWidgetsPrim.begin(); weaponWidget != this->weaponsWidgetsPrim.end(); weaponWidget++)
     851        {
     852                (*weaponWidget)->setParent2D(this->barSocket);
     853                (*weaponWidget)->setRelCoor2D(overlayWidth/2, 0);
     854                //(*weaponWidget)->setAbsCoor2D(0,100);
     855                if (!this->hidden)
     856                        (*weaponWidget)->show();
     857                else
     858                        (*weaponWidget)->hide();
     859                //printf("update thing %s::%s\n", (*weaponWidget)->getClassCName(), (*weaponWidget)->getName());
     860        }
     861 }
    802862
    803863}
  • branches/presentation/src/util/hud.h

    r10764 r10766  
    114114  OrxGui::GLGuiWidget*      healthWidget;
    115115  OrxGui::GLGuiWidget*      implantWidget;
    116   OrxGui::GLGuiText*        energyText;
     116  OrxGui::GLGuiText*        healthText;
     117  OrxGui::GLGuiText*        shieldText;
    117118
    118119  OrxGui::GLGuiNotifier*    notifier;
Note: See TracChangeset for help on using the changeset viewer.