Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8991 in orxonox.OLD for trunk/src/world_entities/elements


Ignore:
Timestamp:
Jul 1, 2006, 8:16:09 PM (18 years ago)
Author:
bensch
Message:

orxonox/trunk: added a Radar class, to display radar as Widget

Location:
trunk/src/world_entities/elements
Files:
1 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/elements/glgui_energywidget.cc

    r8990 r8991  
    3232    this->_bar.setParent2D(&this->_valueText);
    3333
    34     this->setBackgroundTexture("maps/gui_element_background_2.png");
     34    this->_name.setForegroundColor(Color(1,1,1,.8));
     35    this->_valueText.setChangedTextColor(Color::white);
     36
     37    //this->setBackgroundTexture("maps/gui_element_background_2.png");
    3538    this->setBackgroundColor(Color(.5,.5,.5,1));
    3639
    37     this->_name.setBackgroundTexture(Texture());
    38     this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
     40    //this->_name.setBackgroundTexture(Texture());
     41    //this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
    3942    this->_bar.setBackgroundTexture(Texture());
    4043    this->_bar.setBackgroundColor(Color(0,0,0,0));
    4144    this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
    4245    this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
     46    this->_bar.setChangedValueColor(Color::black);
    4347  }
    4448
  • trunk/src/world_entities/elements/glgui_radar.cc

    r8990 r8991  
    1010
    1111   ### File Specific:
    12    main-programmer: ...
     12   main-programmer: Benjamin Grauer
    1313   co-programmer: ...
    1414*/
     
    1616//#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_
    1717
    18 #include "glgui_energywidget.h"
     18#include "glgui_radar.h"
    1919
    2020namespace OrxGui
     
    2323   * @brief standard constructor
    2424   */
    25   GLGuiEnergyWidget::GLGuiEnergyWidget ()
     25  GLGuiRadar::GLGuiRadar ()
    2626  {
    27     //   this->setClassID(CL_PROTO_ID, "GLGuiEnergyWidget");
    28 
    29     this->_bar.setSize2D(100, 30);
    30     this->pack(&this->_name);
    31     this->pack(&this->_valueText);
    32     this->_bar.setParent2D(&this->_valueText);
    33 
    34     this->setBackgroundTexture("maps/gui_element_background_2.png");
    35     this->setBackgroundColor(Color(.5,.5,.5,1));
    36 
    37     this->_name.setBackgroundTexture(Texture());
    38     this->_valueText.setBackgroundTexture("maps/gui_element_background_2.png");
    39     this->_bar.setBackgroundTexture(Texture());
    40     this->_bar.setBackgroundColor(Color(0,0,0,0));
    41     this->_bar.setForegroundTexture("maps/gui_element_background_faded.png");
    42     this->_bar.setForegroundColor(Color(.5, .5, .5, 1));
    4327  }
    4428
     
    4731   * @brief standard deconstructor
    4832   */
    49   GLGuiEnergyWidget::~GLGuiEnergyWidget ()
     33  GLGuiRadar::~GLGuiRadar ()
    5034  {
    5135  }
    5236
    5337
    54   void GLGuiEnergyWidget::setDisplayedName(const std::string& name)
     38  void GLGuiRadar::resize()
    5539  {
    56     this->_name.setText(name);
    57     this->_bar.setWidgetSize(this->_name.getSize2D());
    58   }
    59 
    60   void GLGuiEnergyWidget::setMaximum(float max)
    61   {
    62     this->_bar.setMaximum(max);
    63   }
    64 
    65   void GLGuiEnergyWidget::setValue(float value)
    66   {
    67     MultiType val(value);
    68     val.setType(MT_INT);
    69 
    70 
    71     this->_bar.setValue(value);
    72     this->_bar.setForegroundColor(Color::slerpHSVColor(Color::red, Color::green, value/this->_bar.maximum()));
    73     this->_bar.setFrontColor(Color(1,1,1,1), true);
    74     this->_valueText.setText(val.getString());
    75   }
    76 
    77   void GLGuiEnergyWidget::resize()
    78   {
    79     GLGuiBox::resize();
     40    GLGuiWidget::resize();
    8041  }
    8142
    8243
    83   void GLGuiEnergyWidget::showing()
     44  void GLGuiRadar::showing()
    8445  {
    85     this->_name.show();
    86     this->_valueText.show();
    87     this->_bar.show();
    8846  }
    8947
    90   void GLGuiEnergyWidget::hiding()
     48  void GLGuiRadar::hiding()
    9149  {
    92     this->_name.hide();
    93     this->_valueText.hide();
    94     this->_bar.hide();
    9550  }
    9651}
  • trunk/src/world_entities/elements/glgui_radar.h

    r8988 r8991  
    11/*!
    2  * @file glgui_energywidget.h
    3  * @brief Definition of an EnergyWidget, that displays a bar and a Text
     2 * @file glgui_radar.h
     3 * @brief Definition of an Radar, that displays a bar and a Text
    44*/
    55
    6 #ifndef _GLGUI_ENERGY_WIDGET_H
    7 #define _GLGUI_ENERGY_WIDGET_H
     6#ifndef _GLGUI_RADAR_H
     7#define _GLGUI_RADAR_H
    88
    9 #include "glgui_box.h"
    10 #include "glgui_bar.h"
    11 #include "glgui_text.h"
     9#include "glgui_widget.h"
     10
     11class WorldEntity;
    1212
    1313namespace OrxGui
     
    1515
    1616  //! A class for ...
    17   class GLGuiEnergyWidget : public GLGuiBox
     17  class GLGuiRadar : public GLGuiWidget
    1818  {
    1919
    2020  public:
    21     GLGuiEnergyWidget();
    22     virtual ~GLGuiEnergyWidget();
     21    GLGuiRadar();
     22    virtual ~GLGuiRadar();
    2323
    24     void setDisplayedName(const std::string& name);
    25     void setMaximum(float max);
    26     void setValue(float value);
     24    void setRange(float range);
     25    float range() const { return this->_range; }
    2726
    2827  protected:
     
    3231
    3332  private:
    34     GLGuiText               _name;
    35     GLGuiText               _valueText;
    36     GLGuiBar                _bar;
     33    typedef struct
     34    {
     35
     36      Color                     dotColor;
     37      std::list<WorldEntity*>&  entityList;
     38      std::vector<Vector2D>     position;
     39    } DotList;
     40
     41    std::vector<DotList>        _dotLists;
     42
     43    float                       _range;
    3744
    3845  };
    3946}
    40 #endif /* _GLGUI_ENERGY_WIDGET_H */
     47#endif /* _GLGUI_RADAR_H */
Note: See TracChangeset for help on using the changeset viewer.