Changeset 6287 in orxonox.OLD for trunk/src/lib/gui/gl_gui
- Timestamp:
- Dec 25, 2005, 5:32:21 PM (19 years ago)
- Location:
- trunk/src/lib/gui/gl_gui
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl_gui/Makefile.am
r5463 r6287 16 16 glgui_pushbutton.cc \ 17 17 glgui_container.cc \ 18 glgui_bar.cc \ 18 19 glgui_box.cc \ 19 20 glgui_frame.cc \ … … 29 30 glgui_pushbutton.h \ 30 31 glgui_container.h \ 32 glgui_bar.h \ 31 33 glgui_box.h \ 32 34 glgui_frame.h \ -
trunk/src/lib/gui/gl_gui/glgui_bar.cc
r5365 r6287 16 16 #define DEBUG_SPECIAL_MODULE DEBUG_MODULE_GUI 17 17 18 #include "glgui_ .h"18 #include "glgui_bar.h" 19 19 20 20 using namespace std; … … 41 41 * initializes the GUI-element 42 42 */ 43 GLGuiBar::init()43 void GLGuiBar::init() 44 44 { 45 45 this->setClassID(CL_GLGUI_BAR, "GLGuiBar"); 46 46 47 this->value = 0.5f; 48 this->minimum = 0.0f; 49 this->maximum = 1.0f; 47 50 } 48 51 … … 50 53 * draws the GLGuiBar 51 54 */ 52 void GLGuiBar::draw() 55 void GLGuiBar::draw() const 53 56 { 54 57 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(); 55 69 } -
trunk/src/lib/gui/gl_gui/glgui_bar.h
r5365 r6287 14 14 //! This is Bar part of the openglGUI class 15 15 /** 16 * 16 * The Bar shows the part value. 17 17 */ 18 18 class GLGuiBar : public GLGuiWidget { … … 22 22 virtual ~GLGuiBar(); 23 23 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; }; 25 27 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; 27 34 28 35 private: 36 void init(); 29 37 38 private: 39 float value; 40 41 float minimum; 42 float maximum; 30 43 }; 31 44 -
trunk/src/lib/gui/gl_gui/glgui_box.cc
r5393 r6287 111 111 * draws the GLGuiBox 112 112 */ 113 void GLGuiBox::draw() 113 void GLGuiBox::draw() const 114 114 { 115 115 -
trunk/src/lib/gui/gl_gui/glgui_box.h
r5393 r6287 37 37 virtual void hideAll(); 38 38 39 virtual void draw() ;39 virtual void draw() const; 40 40 41 41 private: -
trunk/src/lib/gui/gl_gui/glgui_button.cc
r5427 r6287 67 67 void GLGuiButton::draw() const 68 68 { 69 69 GLGuiWidget::draw(); 70 70 } -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc
r5395 r6287 52 52 * draws the GLGuiCheckButton 53 53 */ 54 void GLGuiCheckButton::draw() 54 void GLGuiCheckButton::draw() const 55 55 { 56 56 -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.h
r5395 r6287 27 27 void setActivity(bool bActive); 28 28 29 virtual void draw() const {};29 virtual void draw() const; 30 30 virtual void update() {}; 31 31 -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc
r5421 r6287 47 47 this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); 48 48 // this->label->setRelCoor2D(10, 10); 49 50 this->backMat = new Material();51 this->backMat->setDiffuse(0, 0, 0);52 49 } 53 50 … … 57 54 void GLGuiPushButton::draw() const 58 55 { 59 this->backMat->select(); 60 glPushMatrix(); 61 glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); 56 this->startDraw(); 57 58 GLGuiButton::draw(); 59 62 60 glBegin(GL_QUADS); 63 61 … … 68 66 69 67 glEnd(); 70 glPopMatrix();71 68 69 this->endDraw(); 72 70 // this->label->draw(); 73 71 // printf("test"); -
trunk/src/lib/gui/gl_gui/glgui_widget.cc
r5690 r6287 17 17 18 18 #include "glgui_widget.h" 19 20 #include "material.h" 19 21 20 22 #include "debug.h" … … 52 54 // this->setParent2D((Element2D*)NULL); 53 55 54 this->backMat = NULL; 55 this->backModel = 0; 56 this->backMat = new Material(); 57 this->backMat->setDiffuse(0, 0, 0); 58 56 59 this->frontMat = NULL; 57 60 this->frontModel = 0; … … 104 107 this->setVisibility(true); 105 108 } 109 110 111 void 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 62 62 63 63 virtual void update() = 0; 64 virtual void draw() const = 0;64 virtual void draw() const; 65 65 66 66 protected: 67 inline void startDraw() const { glPushMatrix(); glTranslatef(this->getAbsCoor2D().x, this->getAbsCoor2D().y, 0); }; 68 inline void endDraw() const { glPopMatrix(); }; 69 70 private: 67 71 Material* backMat; 68 72 GLuint backModel; -
trunk/src/lib/gui/gl_gui/glgui_window.cc
r5364 r6287 50 50 * draws the GLGuiWindow 51 51 */ 52 void GLGuiWindow::draw() 52 void GLGuiWindow::draw() const 53 53 { 54 54 -
trunk/src/lib/gui/gl_gui/glgui_window.h
r5364 r6287 24 24 void init(); 25 25 26 virtual void draw() ;26 virtual void draw() const; 27 27 28 28 private:
Note: See TracChangeset
for help on using the changeset viewer.