Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8974 in orxonox.OLD for trunk


Ignore:
Timestamp:
Jul 1, 2006, 11:47:08 AM (18 years ago)
Author:
bensch
Message:

trunk: better implemented

Location:
trunk/src
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl/glgui_bar.cc

    r8972 r8974  
    6868  void GLGuiBar::draw() const
    6969  {
    70     printf("BAR\n");
    7170    this->beginDraw();
    7271    GLGuiWidget::draw();
  • trunk/src/world_entities/elements/glgui_energywidget.cc

    r8973 r8974  
    2828    //   this->setClassID(CL_PROTO_ID, "GLGuiEnergyWidget");
    2929
    30     this->text.setParent2D(this);
    31     this->bar.setParent2D(this);
     30    this->pack(&this->text);
     31    this->pack(&this->bar);
    3232  }
    3333
     
    4040    // delete what has to be deleted here
    4141  }
     42
     43
     44  void GLGuiEnergyWidget::setMaximum(float max)
     45  {
     46    this->bar.setMaximum(max);
     47  }
     48
     49  void GLGuiEnergyWidget::setValue(float value)
     50  {
     51    MultiType val = value;
     52
     53    this->bar.setValue(value);
     54    this->text.setText(val.getString());
     55  }
     56
     57
     58
    4259}
  • trunk/src/world_entities/elements/glgui_energywidget.h

    r8973 r8974  
    77#define _GLGUI_ENERGY_WIDGET_H
    88
    9 #include "glgui_widget.h"
     9#include "glgui_box.h"
    1010#include "glgui_bar.h"
    1111#include "glgui_text.h"
     
    1515
    1616  //! A class for ...
    17   class GLGuiEnergyWidget : public GLGuiWidget
     17  class GLGuiEnergyWidget : public GLGuiBox
    1818  {
    1919
     
    2222    virtual ~GLGuiEnergyWidget();
    2323
     24    void setMaximum(float max);
     25    void setValue(float value);
     26
    2427  protected:
    25     virtual void resize();
     28    //virtual void resize();
    2629
    2730  private:
  • trunk/src/world_entities/world_entity.cc

    r8972 r8974  
    3131#include "obb_tree.h"
    3232
    33 #include "glgui_bar.h"
     33#include "elements/glgui_energywidget.h"
    3434
    3535#include "state.h"
     
    681681  if (this->healthWidget == NULL)
    682682  {
    683     this->healthWidget = new OrxGui::GLGuiBar();
     683    this->healthWidget = new OrxGui::GLGuiEnergyWidget();
    684684    this->healthWidget->setSize2D(30,400);
    685685    this->healthWidget->setAbsCoor2D(10,100);
  • trunk/src/world_entities/world_entity.h

    r8894 r8974  
    2424// FORWARD DECLARATION
    2525namespace OrxSound { class SoundBuffer; class SoundSource; }
    26 namespace OrxGui { class GLGuiWidget; class GLGuiBar; };
     26namespace OrxGui { class GLGuiWidget; class GLGuiBar; class GLGuiEnergyWidget; };
    2727
    2828class BVTree;
     
    167167  float                   health;             //!< The Energy of this Entity, if the Entity has any energy at all.
    168168  float                   healthMax;          //!< The Maximal energy this entity can take.
    169   OrxGui::GLGuiBar*       healthWidget;       //!< The Slider (if wanted).
     169  OrxGui::GLGuiEnergyWidget* healthWidget;    //!< The Slider (if wanted).
    170170
    171171  std::vector<Model*>     models;             //!< The model that should be loaded for this entity.
Note: See TracChangeset for help on using the changeset viewer.