Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 7779 in orxonox.OLD for trunk/src/lib/gui/gl_gui/glgui_bar.cc


Ignore:
Timestamp:
May 23, 2006, 10:04:17 PM (18 years ago)
Author:
bensch
Message:

3088 linews changed :): trunk: namespaces

File:
1 edited

Legend:

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

    r7073 r7779  
    1818#include "glgui_bar.h"
    1919
    20 using namespace std;
    2120
    22 /**
    23  * @brief standard constructor
    24 */
    25 GLGuiBar::GLGuiBar ()
     21namespace OrxGui
    2622{
    27   this->init();
    2823
    29 }
     24  /**
     25   * @brief standard constructor
     26  */
     27  GLGuiBar::GLGuiBar ()
     28  {
     29    this->init();
     30
     31  }
    3032
    3133
    32 /**
    33  * @brief standard deconstructor
    34  */
    35 GLGuiBar::~GLGuiBar()
    36 {
     34  /**
     35   * @brief standard deconstructor
     36   */
     37  GLGuiBar::~GLGuiBar()
     38  {
     39  }
    3740
     41  /**
     42   * @brief initializes the GUI-element
     43   */
     44  void GLGuiBar::init()
     45  {
     46    this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
     47
     48    this->frontMat.setDiffuse(1,1,1);
     49
     50    this->setSize2D(50, 10);
     51
     52    this->value = 0.5f;
     53    this->minimum = 0.0f;
     54    this->maximum = 1.0f;
     55  }
     56
     57  /**
     58   * @brief draws the GLGuiBar
     59   */
     60  void GLGuiBar::draw() const
     61  {
     62    this->startDraw();
     63
     64    GLGuiWidget::draw();
     65
     66    this->frontMat.select();
     67    glBegin(GL_QUADS);
     68
     69    glTexCoord2f(0,0);
     70    glVertex2f(3.0, 3.0);
     71    glTexCoord2f(0, value/maximum);
     72    glVertex2f(3.0, (this->getSizeY2D()-3.0)* (value/maximum));
     73    glTexCoord2f(1, value/maximum);
     74    glVertex2f(this->getSizeX2D()-3.0, (this->getSizeY2D()-3.0) * (value/maximum));
     75    glTexCoord2f(1,0);
     76    glVertex2f(this->getSizeX2D()-3.0, 3.0);
     77
     78    glEnd();
     79    this->endDraw();
     80  }
    3881}
    39 
    40 /**
    41  * @brief initializes the GUI-element
    42  */
    43 void GLGuiBar::init()
    44 {
    45   this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
    46 
    47   this->frontMat.setDiffuse(1,1,1);
    48 
    49   this->setSize2D(50, 10);
    50 
    51   this->value = 0.5f;
    52   this->minimum = 0.0f;
    53   this->maximum = 1.0f;
    54 }
    55 
    56 /**
    57  * @brief draws the GLGuiBar
    58  */
    59 void GLGuiBar::draw() const
    60 {
    61   this->startDraw();
    62 
    63   GLGuiWidget::draw();
    64 
    65   this->frontMat.select();
    66   glBegin(GL_QUADS);
    67 
    68   glTexCoord2f(0,0);
    69   glVertex2f(3.0, 3.0);
    70   glTexCoord2f(0, value/maximum);
    71   glVertex2f(3.0, (this->getSizeY2D()-3.0)* (value/maximum));
    72   glTexCoord2f(1, value/maximum);
    73   glVertex2f(this->getSizeX2D()-3.0, (this->getSizeY2D()-3.0) * (value/maximum));
    74   glTexCoord2f(1,0);
    75   glVertex2f(this->getSizeX2D()-3.0, 3.0);
    76 
    77   glEnd();
    78   this->endDraw();
    79 }
Note: See TracChangeset for help on using the changeset viewer.