Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6441 in orxonox.OLD for trunk/src/util/hud.cc


Ignore:
Timestamp:
Jan 8, 2006, 4:02:30 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: the Hud now scales the Widgets itself

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/util/hud.cc

    r6440 r6441  
    1818#include "hud.h"
    1919
     20#include "state.h"
     21
    2022using namespace std;
    2123
     
    2931  this->setClassID(CL_HUD, "Hud");
    3032
    31 
     33  //this->setSize2D(
    3234  this->energyWidget = NULL;
    3335  this->shieldWidget = NULL;
    3436  this->armorWidget = NULL;
     37  this->resX = 1;
     38  this->resY = 1;
    3539}
    3640
     
    6771  {
    6872    this->energyWidget->show();
    69     this->energyWidget->setAbsCoor2D(10,80);
    70     this->energyWidget->setSize2D(20,300);
    7173  }
    7274
    73 
     75  this->updateResolution();
    7476}
    7577
     
    9496}
    9597
    96 void setResolution(unsigned int resX, unsigned int resY);
     98void Hud::updateResolution()
     99{
     100  this->resX = State::resX();
     101  this->resY = State::resY();
     102  if (this->energyWidget != NULL)
     103  {
     104    this->energyWidget->setAbsCoor2D(.02 * this->resX, .4 * this->resY);
     105    this->energyWidget->setSize2D(.05 * this->resX, .55 * this->resY);
     106  }
     107}
     108
     109
     110void Hud::tick(float dt)
     111{
     112  if (this->resY != State::resY() || this->resX != State::resY())
     113    this->updateResolution();
     114}
     115
     116void Hud::draw() const
     117{
     118  GLGuiWidget::draw();
     119}
     120
     121
Note: See TracChangeset for help on using the changeset viewer.