Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/elements/glgui_energywidget.cc @ 8981

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

trunk: less debug output

File size: 1.8 KB
Line 
1/*
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.
10
11   ### File Specific:
12   main-programmer: ...
13   co-programmer: ...
14*/
15
16//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
17
18#include "glgui_energywidget.h"
19
20namespace OrxGui
21{
22  /**
23   * @brief standard constructor
24   */
25  GLGuiEnergyWidget::GLGuiEnergyWidget ()
26  {
27    //   this->setClassID(CL_PROTO_ID, "GLGuiEnergyWidget");
28    this->pack(&this->_name);
29    this->pack(&this->_valueText);
30    this->pack(&this->_bar);
31
32    this->setBackgroundTexture("maps/gui_element_background_2.png");
33    this->setBackgroundColor(Color(.5,.5,.5,1));
34
35    this->_name.setBackgroundTexture(Texture());
36    this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
37    this->_bar.setBackgroundTexture(Texture());
38  }
39
40
41  /**
42   * @brief standard deconstructor
43   */
44  GLGuiEnergyWidget::~GLGuiEnergyWidget ()
45  {
46  }
47
48
49  void GLGuiEnergyWidget::setDisplayedName(const std::string& name)
50  {
51    this->_name.setText(name);
52  }
53
54  void GLGuiEnergyWidget::setMaximum(float max)
55  {
56    this->_bar.setMaximum(max);
57  }
58
59  void GLGuiEnergyWidget::setValue(float value)
60  {
61    MultiType val(value);
62    val.setType(MT_INT);
63
64    this->_bar.setValue(value);
65    this->_valueText.setText(val.getString());
66  }
67
68  void GLGuiEnergyWidget::resize()
69  {
70    GLGuiBox::resize();
71  }
72
73
74  void GLGuiEnergyWidget::showing()
75  {
76    this->_name.show();
77    this->_valueText.show();
78    this->_bar.show();
79  }
80
81  void GLGuiEnergyWidget::hiding()
82  {
83    this->_name.hide();
84    this->_valueText.hide();
85    this->_bar.hide();
86  }
87}
Note: See TracBrowser for help on using the repository browser.