Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

File:
1 copied

Legend:

Unmodified
Added
Removed
  • 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}
Note: See TracChangeset for help on using the changeset viewer.