Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6287 in orxonox.OLD for trunk/src/lib


Ignore:
Timestamp:
Dec 25, 2005, 5:32:21 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: some gui-work

Location:
trunk/src/lib/gui/gl_gui
Files:
13 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/gui/gl_gui/Makefile.am

    r5463 r6287  
    1616                        glgui_pushbutton.cc \
    1717                        glgui_container.cc \
     18                        glgui_bar.cc \
    1819                        glgui_box.cc \
    1920                        glgui_frame.cc \
     
    2930                glgui_pushbutton.h \
    3031                glgui_container.h \
     32                glgui_bar.h \
    3133                glgui_box.h \
    3234                glgui_frame.h \
  • trunk/src/lib/gui/gl_gui/glgui_bar.cc

    r5365 r6287  
    1616#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI
    1717
    18 #include "glgui_.h"
     18#include "glgui_bar.h"
    1919
    2020using namespace std;
     
    4141 * initializes the GUI-element
    4242 */
    43 GLGuiBar::init()
     43void GLGuiBar::init()
    4444{
    4545  this->setClassID(CL_GLGUI_BAR, "GLGuiBar");
    4646
     47  this->value = 0.5f;
     48  this->minimum = 0.0f;
     49  this->maximum = 1.0f;
    4750}
    4851
     
    5053 * draws the GLGuiBar
    5154 */
    52 void GLGuiBar::draw()
     55void GLGuiBar::draw() const
    5356{
    5457
     58  printf("TEST %f %f\n", this->getAbsCoor2D().x, this->getAbsCoor2D().y);
     59  GLGuiWidget::draw();
     60
     61  glBegin(GL_QUADS);
     62
     63  glVertex2d(.1, .1);
     64  glVertex2d(.1, this->getSizeY2D()* .8 * (value/maximum));
     65  glVertex2d(this->getSizeX2D(), this->getSizeY2D() * .8 * (value/maximum));
     66  glVertex2d(this->getSizeX2D(), .1);
     67
     68  glEnd();
    5569}
  • trunk/src/lib/gui/gl_gui/glgui_bar.h

    r5365 r6287  
    1414//! This is Bar part of the openglGUI class
    1515/**
    16  *
     16 * The Bar shows the part value.
    1717 */
    1818class GLGuiBar : public GLGuiWidget {
     
    2222  virtual ~GLGuiBar();
    2323
    24   void init();
     24  void setValue(float value) { this->value = value; };
     25  void setMinimum(float minimum) { this->minimum = minimum; };
     26  void setMaximum(float maximum) { this->maximum = maximum; };
    2527
    26   virtual void draw();
     28  float getValue() const { return this->value; };
     29  float getMinimum() const { return this->minimum; };
     30  float getMaximum() const { return this->maximum; };
     31
     32  virtual void update() { };
     33  virtual void draw() const;
    2734
    2835 private:
     36   void init();
    2937
     38  private:
     39    float value;
     40
     41    float minimum;
     42    float maximum;
    3043};
    3144
  • trunk/src/lib/gui/gl_gui/glgui_box.cc

    r5393 r6287  
    111111 * draws the GLGuiBox
    112112 */
    113 void GLGuiBox::draw()
     113void GLGuiBox::draw() const
    114114{
    115115
  • trunk/src/lib/gui/gl_gui/glgui_box.h

    r5393 r6287  
    3737  virtual void hideAll();
    3838
    39   virtual void draw();
     39  virtual void draw() const;
    4040
    4141 private:
  • trunk/src/lib/gui/gl_gui/glgui_button.cc

    r5427 r6287  
    6767void GLGuiButton::draw() const
    6868{
    69 
     69  GLGuiWidget::draw();
    7070}
  • trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc

    r5395 r6287  
    5252 * draws the GLGuiCheckButton
    5353 */
    54 void GLGuiCheckButton::draw()
     54void GLGuiCheckButton::draw() const
    5555{
    5656
  • trunk/src/lib/gui/gl_gui/glgui_checkbutton.h

    r5395 r6287  
    2727  void    setActivity(bool bActive);
    2828
    29   virtual void draw() const {};
     29  virtual void draw() const;
    3030  virtual void update() {};
    3131
  • trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc

    r5421 r6287  
    4747  this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");
    4848//  this->label->setRelCoor2D(10, 10);
    49 
    50   this->backMat = new Material();
    51   this->backMat->setDiffuse(0, 0, 0);
    5249}
    5350
     
    5754void GLGuiPushButton::draw() const
    5855{
    59   this->backMat->select();
    60   glPushMatrix();
    61   glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0);
     56  this->startDraw();
     57
     58  GLGuiButton::draw();
     59
    6260  glBegin(GL_QUADS);
    6361
     
    6866
    6967  glEnd();
    70   glPopMatrix();
    7168
     69  this->endDraw();
    7270//   this->label->draw();
    7371//  printf("test");
  • trunk/src/lib/gui/gl_gui/glgui_widget.cc

    r5690 r6287  
    1717
    1818#include "glgui_widget.h"
     19
     20#include "material.h"
    1921
    2022#include "debug.h"
     
    5254//  this->setParent2D((Element2D*)NULL);
    5355
    54   this->backMat = NULL;
    55   this->backModel = 0;
     56  this->backMat = new Material();
     57  this->backMat->setDiffuse(0, 0, 0);
     58
    5659  this->frontMat = NULL;
    5760  this->frontModel = 0;
     
    104107  this->setVisibility(true);
    105108}
     109
     110
     111void GLGuiWidget::draw() const
     112{
     113  this->backMat->select();
     114
     115  glBegin(GL_QUADS);
     116
     117
     118  glVertex2d(0,0);
     119  glVertex2d(0, this->getSizeY2D());
     120  glVertex2d(this->getSizeX2D(), this->getSizeY2D());
     121  glVertex2d(this->getSizeX2D(),0);
     122
     123  glEnd();
     124}
     125
  • trunk/src/lib/gui/gl_gui/glgui_widget.h

    r5690 r6287  
    6262
    6363    virtual void update() = 0;
    64     virtual void draw() const = 0;
     64    virtual void draw() const;
    6565
    6666  protected:
     67    inline void startDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); };
     68    inline void endDraw() const { glPopMatrix(); };
     69
     70  private:
    6771    Material*             backMat;
    6872    GLuint                backModel;
  • trunk/src/lib/gui/gl_gui/glgui_window.cc

    r5364 r6287  
    5050 * draws the GLGuiWindow
    5151 */
    52 void GLGuiWindow::draw()
     52void GLGuiWindow::draw() const
    5353{
    5454
  • trunk/src/lib/gui/gl_gui/glgui_window.h

    r5364 r6287  
    2424  void init();
    2525
    26   virtual void draw();
     26  virtual void draw() const;
    2727
    2828 private:
Note: See TracChangeset for help on using the changeset viewer.