Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6440 in orxonox.OLD for trunk/src


Ignore:
Timestamp:
Jan 8, 2006, 3:20:00 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: now the Widgets are only rendered within the HUD

Location:
trunk/src
Files:
6 edited

Legend:

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

    r6438 r6440  
    2929  this->setClassID(CL_HUD, "Hud");
    3030
     31
     32  this->energyWidget = NULL;
     33  this->shieldWidget = NULL;
     34  this->armorWidget = NULL;
    3135}
    3236
     
    5357void Hud::setEnergyWidget(GLGuiWidget* widget)
    5458{
     59  // decopple old widget
     60  if (this->energyWidget != NULL)
     61  {
     62    this->energyWidget->hide();
     63  }
     64
     65  this->energyWidget = widget;
     66  if (this->energyWidget != NULL)
     67  {
     68    this->energyWidget->show();
     69    this->energyWidget->setAbsCoor2D(10,80);
     70    this->energyWidget->setSize2D(20,300);
     71  }
     72
    5573
    5674}
  • trunk/src/world_entities/player.cc

    r6438 r6440  
    3232Player::Player()
    3333{
    34   this->init();
     34//  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
     35  this->setClassID(CL_PLAYER, "Player");
     36
     37  PRINTF(4)("PLAYER INIT\n");
     38
     39  this->controllable = NULL;
     40  this->hud = new Hud();
    3541
    3642  EventHandler::getInstance()->subscribe(this, ES_GAME, SDLK_l);
     
    4349Player::~Player ()
    4450{
    45 }
     51  delete this->hud;
    4652
    47 
    48 /**
    49  * initializes a Player
    50  */
    51 void Player::init()
    52 {
    53 //  this->setRelDir(Quaternion(M_PI, Vector(1,0,0)));
    54   this->setClassID(CL_PLAYER, "Player");
    55 
    56   PRINTF(4)("PLAYER INIT\n");
    57 
    58   this->controllable = NULL;
    59   this->hud = new Hud();
    6053}
    6154
     
    6659  {
    6760      this->controllable = controllable;
     61      this->hud->setEnergyWidget(this->controllable->getEnergyWidget());
    6862      return true;
    6963  }
     
    7973   {
    8074     this->controllable = NULL;
     75     this->hud->setEnergyWidget(NULL);
    8176     return true;
    8277   }
  • trunk/src/world_entities/player.h

    r6438 r6440  
    3535
    3636  private:
    37     void              init();
    38 
    39 
    40   private:
    4137    Playable*         controllable;                  //!< The one we controll or NULL if none
    4238    Hud*              hud;                           //!< The HUD to be displayed.
  • trunk/src/world_entities/space_ships/space_ship.cc

    r6436 r6440  
    213213  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( true);
    214214  this->attachCamera();
    215 
    216   this->setEnergyWidgetVisibilit(true);
    217 
    218215}
    219216
     
    222219  dynamic_cast<Element2D*>(this->getWeaponManager()->getFixedTarget())->setVisibility( false);
    223220  this->detachCamera();
    224 
    225   this->setEnergyWidgetVisibilit(false);
    226 
    227221}
    228222
  • trunk/src/world_entities/world_entity.cc

    r6431 r6440  
    410410}
    411411
     412GLGuiWidget* WorldEntity::getEnergyWidget()
     413{
     414  this->createEnergyWidget();
     415  return this->energyWidget;
     416}
     417
    412418/**
    413419 * @param visibility shows or hides the energy-bar
  • trunk/src/world_entities/world_entity.h

    r6430 r6440  
    2020class BVTree;
    2121class Model;
     22
     23class GLGuiWidget;
    2224class GLGuiBar;
    2325
     
    3638  void loadModel(const char* fileName, float scaling = 1.0f, unsigned int modelNumber = 0);
    3739  void setModel(Model* model, unsigned int modelNumber = 0);
    38 Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
     40  Model* getModel(unsigned int modelNumber = 0) const { return (this->models.size() > modelNumber)? this->models[modelNumber] : NULL; };
    3941
    4042  inline void loadMD2Texture(const char* fileName) { this->md2TextureFileName = fileName; }
     
    9193  float removeEnergy(float energy);
    9294  void setMaxEnergy(float maxEnergy);
    93 
     95  GLGuiWidget* getEnergyWidget();
    9496
    9597protected:
Note: See TracChangeset for help on using the changeset viewer.