Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/util/hud.cc @ 6441

Last change on this file since 6441 was 6441, checked in by bensch, 18 years ago

orxonox/trunk: the Hud now scales the Widgets itself

File size: 1.9 KB
RevLine 
[4744]1/*
[1853]2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004 orx
5
6   This program is free software; you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation; either version 2, or (at your option)
9   any later version.
[1855]10
11   ### File Specific:
[6437]12   main-programmer: Benjamin Grauer
[1855]13   co-programmer: ...
[1853]14*/
15
[3955]16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
[1853]17
[6437]18#include "hud.h"
[1853]19
[6441]20#include "state.h"
21
[1856]22using namespace std;
[1853]23
[1856]24
[3245]25/**
[4838]26 * standard constructor
27 * @todo this constructor is not jet implemented - do it
[3245]28*/
[6437]29Hud::Hud ()
[3365]30{
[6438]31  this->setClassID(CL_HUD, "Hud");
[4320]32
[6441]33  //this->setSize2D(
[6440]34  this->energyWidget = NULL;
35  this->shieldWidget = NULL;
36  this->armorWidget = NULL;
[6441]37  this->resX = 1;
38  this->resY = 1;
[3365]39}
[1853]40
41
[3245]42/**
[4838]43 * standard deconstructor
[3245]44*/
[6437]45Hud::~Hud ()
[3543]46{
47  // delete what has to be deleted here
48}
[6438]49
50
51void Hud::loadParams(const TiXmlElement* root)
52{
53
54}
55
56void Hud::setBackGround()
57{
58
59}
60
61void Hud::setEnergyWidget(GLGuiWidget* widget)
62{
[6440]63  // decopple old widget
64  if (this->energyWidget != NULL)
65  {
66    this->energyWidget->hide();
67  }
[6438]68
[6440]69  this->energyWidget = widget;
70  if (this->energyWidget != NULL)
71  {
72    this->energyWidget->show();
73  }
74
[6441]75  this->updateResolution();
[6438]76}
77
78void Hud::setShiledWidget(GLGuiWidget* widget)
79{
80
81}
82
83void Hud::setArmorWidget(GLGuiWidget* widget)
84{
85
86}
87
88void Hud::addWeaponWidget(GLGuiWidget* widget)
89{
90
91}
92
93void Hud::removeWeaponWidget(GLGuiWidget* widget)
94{
95
96}
97
[6441]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 TracBrowser for help on using the repository browser.