- Timestamp:
- May 23, 2006, 10:04:17 PM (19 years ago)
- Location:
- trunk/src
- Files:
-
- 45 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/lib/gui/gl_gui/glgui.h
r5359 r7779 6 6 #ifndef _GLGUI_H 7 7 #define _GLGUI_H 8 9 8 #include "glgui_widget.h" 10 9 10 namespace OrxGui 11 { 12 13 }; 11 14 12 15 -
trunk/src/lib/gui/gl_gui/glgui_bar.cc
r7073 r7779 18 18 #include "glgui_bar.h" 19 19 20 using namespace std;21 20 22 /** 23 * @brief standard constructor 24 */ 25 GLGuiBar::GLGuiBar () 21 namespace OrxGui 26 22 { 27 this->init();28 23 29 } 24 /** 25 * @brief standard constructor 26 */ 27 GLGuiBar::GLGuiBar () 28 { 29 this->init(); 30 31 } 30 32 31 33 32 /** 33 * @brief standard deconstructor 34 */ 35 GLGuiBar::~GLGuiBar() 36 { 34 /** 35 * @brief standard deconstructor 36 */ 37 GLGuiBar::~GLGuiBar() 38 { 39 } 37 40 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 } 38 81 } 39 40 /**41 * @brief initializes the GUI-element42 */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 GLGuiBar58 */59 void GLGuiBar::draw() const60 {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 } -
trunk/src/lib/gui/gl_gui/glgui_bar.h
r6287 r7779 10 10 #include "glgui_widget.h" 11 11 12 // FORWARD DECLARATION13 12 14 //! This is Bar part of the openglGUI class 15 /** 16 * The Bar shows the part value. 17 */ 18 class GLGuiBar : public GLGuiWidget { 13 namespace OrxGui 14 { 19 15 20 public:21 GLGuiBar();22 virtual ~GLGuiBar();23 16 24 void setValue(float value) { this->value = value; }; 25 void setMinimum(float minimum) { this->minimum = minimum; }; 26 void setMaximum(float maximum) { this->maximum = maximum; }; 17 //! This is Bar part of the openglGUI class 18 /** 19 * The Bar shows the part value. 20 */ 21 class GLGuiBar : public GLGuiWidget 22 { 27 23 28 float getValue() const { return this->value; };29 float getMinimum() const { return this->minimum; };30 float getMaximum() const { return this->maximum; };24 public: 25 GLGuiBar(); 26 virtual ~GLGuiBar(); 31 27 32 virtual void update() { }; 33 virtual void draw() const; 28 void setValue(float value) { this->value = value; }; 29 void setMinimum(float minimum) { this->minimum = minimum; }; 30 void setMaximum(float maximum) { this->maximum = maximum; }; 34 31 35 private: 36 void init(); 32 float getValue() const { return this->value; }; 33 float getMinimum() const { return this->minimum; }; 34 float getMaximum() const { return this->maximum; }; 35 36 virtual void update() { }; 37 virtual void draw() const; 38 39 private: 40 void init(); 37 41 38 42 private: … … 41 45 float minimum; 42 46 float maximum; 43 };44 47 }; 48 } 45 49 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_box.cc
r7130 r7779 18 18 #include "glgui_box.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 22 /** 23 * standard constructor 24 */ 25 GLGuiBox::GLGuiBox (BoxType type) 26 { 27 this->init(); 21 28 22 /** 23 * standard constructor 24 */ 25 GLGuiBox::GLGuiBox (GLGuiBoxType type) 26 { 27 this->init(); 28 29 this->setType (type); 30 } 29 this->setType (type); 30 } 31 31 32 32 33 /** 34 * standard deconstructor 35 */ 36 GLGuiBox::~GLGuiBox() 37 { 38 } 33 /** 34 * standard deconstructor 35 */ 36 GLGuiBox::~GLGuiBox() 37 {} 39 38 40 /**41 * initializes the GUI-element42 */43 void GLGuiBox::init()44 {45 this->setClassID(CL_GLGUI_BOX, "GLGuiBox");46 }39 /** 40 * initializes the GUI-element 41 */ 42 void GLGuiBox::init() 43 { 44 this->setClassID(CL_GLGUI_BOX, "GLGuiBox"); 45 } 47 46 48 void GLGuiBox::pack(GLGuiWidget* widget)49 {50 if (widget == NULL)51 return;47 void GLGuiBox::pack(GLGuiWidget* widget) 48 { 49 if (widget == NULL) 50 return; 52 51 53 this->children.push_back(widget);54 }52 this->children.push_back(widget); 53 } 55 54 56 55 57 void GLGuiBox::unpack(GLGuiWidget* widget) 58 { 59 if (widget == NULL) 56 void GLGuiBox::unpack(GLGuiWidget* widget) 60 57 { 61 this->children.clear(); 58 if (widget == NULL) 59 { 60 this->children.clear(); 61 } 62 else 63 { 64 this->children.remove(widget); 65 } 62 66 } 63 else 67 68 void GLGuiBox::showAll() 64 69 { 65 this->children.remove(widget); 70 std::list<GLGuiWidget*>::iterator itC = this->children.begin(); 71 while (itC != this->children.end()) 72 { 73 if ((*itC)->isA(CL_GLGUI_CONTAINER)) 74 static_cast<GLGuiContainer*>(*itC)->showAll(); 75 else 76 (*itC)->show(); 77 itC++; 78 } 79 80 this->show(); 81 82 } 83 84 void GLGuiBox::hideAll() 85 { 86 std::list<GLGuiWidget*>::iterator itC = this->children.begin(); 87 while (itC != this->children.end()) 88 { 89 if ((*itC)->isA(CL_GLGUI_CONTAINER)) 90 static_cast<GLGuiContainer*>(*itC)->hideAll(); 91 else 92 (*itC)->hide(); 93 itC++; 94 } 95 96 this->hide(); 97 } 98 99 100 /** 101 * draws the GLGuiBox 102 */ 103 void GLGuiBox::draw() const 104 { 66 105 } 67 106 } 68 69 void GLGuiBox::showAll()70 {71 std::list<GLGuiWidget*>::iterator itC = this->children.begin();72 while (itC != this->children.end())73 {74 if ((*itC)->isA(CL_GLGUI_CONTAINER))75 static_cast<GLGuiContainer*>(*itC)->showAll();76 else77 (*itC)->show();78 itC++;79 }80 81 this->show();82 83 }84 85 void GLGuiBox::hideAll()86 {87 std::list<GLGuiWidget*>::iterator itC = this->children.begin();88 while (itC != this->children.end())89 {90 if ((*itC)->isA(CL_GLGUI_CONTAINER))91 static_cast<GLGuiContainer*>(*itC)->hideAll();92 else93 (*itC)->hide();94 itC++;95 }96 97 this->hide();98 }99 100 101 /**102 * draws the GLGuiBox103 */104 void GLGuiBox::draw() const105 {106 107 } -
trunk/src/lib/gui/gl_gui/glgui_box.h
r7130 r7779 10 10 #include "glgui_container.h" 11 11 12 // FORWARD DECLARATION13 12 14 typedef enum 13 namespace OrxGui 15 14 { 16 GLGuiBox_H, 17 GLGuiBox_V, 18 } GLGuiBoxType; 15 typedef enum 16 { 17 Box_H, 18 Box_V, 19 } BoxType; 19 20 20 //! This is BOX part of the openglGUI class 21 /** 22 * 23 */ 24 class GLGuiBox : public GLGuiContainer { 21 //! This is BOX part of the openglGUI class 22 /** 23 * 24 */ 25 class GLGuiBox : public GLGuiContainer 26 { 25 27 26 public:27 GLGuiBox(GLGuiBoxType type = GLGuiBox_H);28 virtual ~GLGuiBox();28 public: 29 GLGuiBox(BoxType type = Box_H); 30 virtual ~GLGuiBox(); 29 31 30 void init();31 void setType(GLGuiBoxType type) { this->type = type; };32 void init(); 33 void setType(BoxType type) { this->type = type; }; 32 34 33 virtual void pack(GLGuiWidget* widget);34 virtual void unpack(GLGuiWidget* widget);35 virtual void showAll();36 virtual void hideAll();35 virtual void pack(GLGuiWidget* widget); 36 virtual void unpack(GLGuiWidget* widget); 37 virtual void showAll(); 38 virtual void hideAll(); 37 39 38 virtual void draw() const;40 virtual void draw() const; 39 41 40 private:41 GLGuiBoxTypetype;42 std::list<GLGuiWidget*> children;43 };44 42 private: 43 BoxType type; 44 std::list<GLGuiWidget*> children; 45 }; 46 } 45 47 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_button.cc
r7221 r7779 20 20 #include "text.h" 21 21 22 using namespace std;23 22 24 /** 25 * standard constructor 26 */ 27 GLGuiButton::GLGuiButton () 23 namespace OrxGui 28 24 { 29 this->init(); 25 /** 26 * standard constructor 27 */ 28 GLGuiButton::GLGuiButton () 29 { 30 this->init(); 30 31 31 }32 } 32 33 33 34 34 /** 35 * standard deconstructor 36 */ 37 GLGuiButton::~GLGuiButton() 38 { 39 /* this does not have to be done, since the Label is a child, 40 * and will be deleted by Element2D's deletion Process 41 * delete this->label; 35 /** 36 * standard deconstructor 42 37 */ 43 } 38 GLGuiButton::~GLGuiButton() 39 { 40 /* this does not have to be done, since the Label is a child, 41 * and will be deleted by Element2D's deletion Process 42 * delete this->label; 43 */ 44 } 44 45 45 /**46 * initializes the GUI-element47 */48 void GLGuiButton::init()49 {50 this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton");46 /** 47 * initializes the GUI-element 48 */ 49 void GLGuiButton::init() 50 { 51 this->setClassID(CL_GLGUI_BUTTON, "GLGuiButton"); 51 52 52 this->label = new Text();53 this->label->setParent2D(this);54 }53 this->label = new Text(); 54 this->label->setParent2D(this); 55 } 55 56 56 void GLGuiButton::setLabel(const std::string& label)57 {58 this->label->setText(label);59 this->label->setRelCoor2D(5, 5);60 this->setSize2D(this->label->getSizeX2D()+10, this->label->getSizeY2D()+10);61 }57 void GLGuiButton::setLabel(const std::string& label) 58 { 59 this->label->setText(label); 60 this->label->setRelCoor2D(5, 5); 61 this->setSize2D(this->label->getSizeX2D()+10, this->label->getSizeY2D()+10); 62 } 62 63 63 64 64 /** 65 * draws the GLGuiButton 66 */ 67 void GLGuiButton::draw() const 68 { 69 GLGuiWidget::draw(); 65 /** 66 * draws the GLGuiButton 67 */ 68 void GLGuiButton::draw() const 69 { 70 GLGuiWidget::draw(); 71 } 70 72 } -
trunk/src/lib/gui/gl_gui/glgui_button.h
r7221 r7779 10 10 #include "glgui_widget.h" 11 11 12 typedef enum13 {14 GLGui_Button_Active,15 GLGui_Button_Inactive,16 GLGui_Button_Pressed,17 GLGui_Button_Released,18 GLGui_Button_Activating,19 GLGui_Button_Deactivating,20 21 } GLGui_ButtonState;22 23 // FORWARD DECLARATION24 12 class Text; 25 13 26 //! This is part of the openglGUI class 27 /** 28 * 29 */ 30 class GLGuiButton : public GLGuiWidget { 14 namespace OrxGui 15 { 16 typedef enum 17 { 18 Button_Active, 19 Button_Inactive, 20 Button_Pressed, 21 Button_Released, 22 Button_Activating, 23 Button_Deactivating, 31 24 32 public: 33 GLGuiButton(); 34 virtual ~GLGuiButton(); 25 } ButtonState; 35 26 36 void init(); 37 void setLabel(const std::string& label); 27 //! This is part of the openglGUI class 28 /** 29 * 30 */ 31 class GLGuiButton : public GLGuiWidget 32 { 38 33 39 virtual void draw() const; 34 public: 35 GLGuiButton(); 36 virtual ~GLGuiButton(); 37 38 void init(); 39 void setLabel(const std::string& label); 40 41 virtual void draw() const; 40 42 41 43 protected: … … 43 45 44 46 private: 45 GLGui_ButtonStatestate;46 };47 47 ButtonState state; 48 }; 49 } 48 50 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.cc
r6287 r7779 20 20 #include "text.h" 21 21 22 using namespace std; 23 24 /** 25 * standard constructor 26 */ 27 GLGuiCheckButton::GLGuiCheckButton () 22 namespace OrxGui 28 23 { 29 this->init();30 31 }32 24 33 25 34 /** 35 * standard deconstructor 36 */ 37 GLGuiCheckButton::~GLGuiCheckButton() 38 { 26 /** 27 * standard constructor 28 */ 29 GLGuiCheckButton::GLGuiCheckButton () 30 { 31 this->init(); 39 32 33 } 34 35 36 /** 37 * standard deconstructor 38 */ 39 GLGuiCheckButton::~GLGuiCheckButton() 40 { 41 } 42 43 /** 44 * initializes the GUI-element 45 */ 46 GLGuiCheckButton::init() 47 { 48 this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton"); 49 50 } 51 52 /** 53 * draws the GLGuiCheckButton 54 */ 55 void GLGuiCheckButton::draw() const 56 { 57 } 40 58 } 41 42 /**43 * initializes the GUI-element44 */45 GLGuiCheckButton::init()46 {47 this->setClassID(CL_GLGUI_CHECKBUTTON, "GLGuiCheckButton");48 49 }50 51 /**52 * draws the GLGuiCheckButton53 */54 void GLGuiCheckButton::draw() const55 {56 57 } -
trunk/src/lib/gui/gl_gui/glgui_checkbutton.h
r6287 r7779 10 10 #include "glgui_button.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 13 14 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiCheckButton : public GLGuiButton { 15 // FORWARD DECLARATION 19 16 20 public: 21 GLGuiCheckButton(); 22 virtual ~GLGuiCheckButton(); 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiCheckButton : public GLGuiButton 22 { 23 23 24 void init(); 24 public: 25 GLGuiCheckButton(); 26 virtual ~GLGuiCheckButton(); 25 27 26 bool isActive() { return this->bActive; }; 27 void setActivity(bool bActive); 28 void init(); 28 29 29 virtual void draw() const;30 virtual void update() {};30 bool isActive() { return this->bActive; }; 31 void setActivity(bool bActive); 31 32 32 private:33 bool bActive;33 virtual void draw() const; 34 virtual void update() {}; 34 35 35 }; 36 private: 37 bool bActive; 38 39 }; 40 } 36 41 37 42 #endif /* _GLGUI_CHECKBUTTON_H */ -
trunk/src/lib/gui/gl_gui/glgui_colorselector.cc
r5360 r7779 18 18 #include "glgui_.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGui::GLGui ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGui::GLGui () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGui::~GLGui() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGui::~GLGui() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 GLGui::init() 44 { 45 this->setClassID(CL_GLGUI_, "GLGui"); 46 47 } 48 49 /** 50 * draws the GLGui 51 */ 52 void GLGui::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 GLGui::init()44 {45 this->setClassID(CL_GLGUI_, "GLGui");46 47 }48 49 /**50 * draws the GLGui51 */52 void GLGui::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_colorselector.h
r5360 r7779 10 10 #include "base_object.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 13 14 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGui : public GLGui { 15 // FORWARD DECLARATION 19 16 20 public: 21 GLGui(); 22 virtual ~GLGui(); 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGui : public GLGui 22 { 23 23 24 void init(); 24 public: 25 GLGui(); 26 virtual ~GLGui(); 25 27 26 virtual void draw();28 void init(); 27 29 28 private:30 virtual void draw(); 29 31 30 }; 32 private: 31 33 34 }; 35 } 32 36 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_container.cc
r5393 r7779 18 18 #include "glgui_container.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGuiContainer::GLGuiContainer ()26 {27 this->init();28 }23 /** 24 * standard constructor 25 */ 26 GLGuiContainer::GLGuiContainer () 27 { 28 this->init(); 29 } 29 30 30 31 31 /** 32 * standard deconstructor 33 */ 34 GLGuiContainer::~GLGuiContainer() 35 { 36 } 32 /** 33 * standard deconstructor 34 */ 35 GLGuiContainer::~GLGuiContainer() 36 {} 37 37 38 /**39 * initializes the GUI-element40 */41 void GLGuiContainer::init()42 {43 this->setClassID(CL_GLGUI_CONTAINER, "GLGuiContainer");38 /** 39 * initializes the GUI-element 40 */ 41 void GLGuiContainer::init() 42 { 43 this->setClassID(CL_GLGUI_CONTAINER, "GLGuiContainer"); 44 44 45 }45 } 46 46 47 47 48 /**49 * draws the GLGuiContainer50 */51 void GLGuiContainer::draw()52 {53 48 /** 49 * draws the GLGuiContainer 50 */ 51 void GLGuiContainer::draw() 52 { 53 } 54 54 } -
trunk/src/lib/gui/gl_gui/glgui_container.h
r5393 r7779 10 10 #include "glgui_widget.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 14 // FORWARD DECLARATION 13 15 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiContainer : public GLGuiWidget { 16 //! This is part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGuiContainer : public GLGuiWidget 21 { 19 22 20 public:21 GLGuiContainer();22 virtual ~GLGuiContainer();23 public: 24 GLGuiContainer(); 25 virtual ~GLGuiContainer(); 23 26 24 void init();27 void init(); 25 28 26 29 27 void setBorderWidth(float borderwidth);30 void setBorderWidth(float borderwidth); 28 31 29 32 30 virtual void pack(GLGuiWidget* widget) = 0;31 /** unpacks a Widget from this container. @param widget the GLGuiWidget to unpack, if NULL all subwidgets will be unpackt. */32 virtual void unpack(GLGuiWidget* widget) = 0;33 virtual void hideAll() = 0;34 virtual void showAll() = 0;33 virtual void pack(GLGuiWidget* widget) = 0; 34 /** unpacks a Widget from this container. @param widget the GLGuiWidget to unpack, if NULL all subwidgets will be unpackt. */ 35 virtual void unpack(GLGuiWidget* widget) = 0; 36 virtual void hideAll() = 0; 37 virtual void showAll() = 0; 35 38 36 39 37 virtual void draw();40 virtual void draw(); 38 41 39 private:42 private: 40 43 41 };42 44 }; 45 } 43 46 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_cursor.cc
r5360 r7779 18 18 #include "glgui_.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGui::GLGui ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGui::GLGui () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGui::~GLGui() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGui::~GLGui() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 GLGui::init() 44 { 45 this->setClassID(CL_GLGUI_, "GLGui"); 46 47 } 48 49 /** 50 * draws the GLGui 51 */ 52 void GLGui::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 GLGui::init()44 {45 this->setClassID(CL_GLGUI_, "GLGui");46 47 }48 49 /**50 * draws the GLGui51 */52 void GLGui::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_cursor.h
r5360 r7779 10 10 #include "base_object.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 14 // FORWARD DECLARATION 13 15 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGui : public GLGui { 16 //! This is part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGui : public GLGui 21 { 19 22 20 public:21 GLGui();22 virtual ~GLGui();23 public: 24 GLGui(); 25 virtual ~GLGui(); 23 26 24 void init();27 void init(); 25 28 26 virtual void draw();29 virtual void draw(); 27 30 28 private:31 private: 29 32 30 };31 33 }; 34 } 32 35 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_element.cc
r5360 r7779 18 18 #include "glgui_.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGui::GLGui ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGui::GLGui () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGui::~GLGui() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGui::~GLGui() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 GLGui::init() 44 { 45 this->setClassID(CL_GLGUI_, "GLGui"); 46 47 } 48 49 /** 50 * draws the GLGui 51 */ 52 void GLGui::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 GLGui::init()44 {45 this->setClassID(CL_GLGUI_, "GLGui");46 47 }48 49 /**50 * draws the GLGui51 */52 void GLGui::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_element.h
r5360 r7779 10 10 #include "base_object.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 14 // FORWARD DECLARATION 13 15 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGui : public GLGui { 16 //! This is part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGui : public GLGui 21 { 19 22 20 public:21 GLGui();22 virtual ~GLGui();23 public: 24 GLGui(); 25 virtual ~GLGui(); 23 26 24 void init();27 void init(); 25 28 26 virtual void draw();29 virtual void draw(); 27 30 28 private:31 private: 29 32 30 };31 33 }; 34 } 32 35 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_frame.cc
r5393 r7779 19 19 20 20 #include "debug.h" 21 namespace OrxGui 22 { 21 23 22 using namespace std; 24 /** 25 * standard constructor 26 */ 27 GLGuiFrame::GLGuiFrame () 28 { 29 this->init(); 23 30 24 /** 25 * standard constructor 26 */ 27 GLGuiFrame::GLGuiFrame () 28 { 29 this->init(); 30 31 } 31 } 32 32 33 33 34 /** 35 * standard deconstructor 36 */ 37 GLGuiFrame::~GLGuiFrame() 38 { 34 /** 35 * standard deconstructor 36 */ 37 GLGuiFrame::~GLGuiFrame() 38 { 39 } 39 40 40 } 41 /** 42 * initializes the GUI-element 43 */ 44 void GLGuiFrame::init() 45 { 46 this->setClassID(CL_GLGUI_FRAME, "GLGuiFrame"); 47 this->child = NULL; 48 } 41 49 42 /** 43 * initializes the GUI-element 44 */ 45 void GLGuiFrame::init() 46 { 47 this->setClassID(CL_GLGUI_FRAME, "GLGuiFrame"); 48 this->child = NULL; 49 } 50 void GLGuiFrame::pack(GLGuiWidget* widget) 51 { 52 if (widget == NULL) 53 return; 50 54 51 void GLGuiFrame::pack(GLGuiWidget* widget) 52 { 53 if (widget == NULL) 54 return; 55 if (this->child == NULL) 56 this->child = widget; 57 else 58 { 59 PRINTF(2)("Frame %s is already filled, not filling with %s\n", this->getName(), widget->getName()); 60 } 61 } 55 62 56 if (this->child == NULL) 57 this->child = widget; 58 else 63 void GLGuiFrame::unpack(GLGuiWidget* widget) 59 64 { 60 PRINTF(2)("Frame %s is already filled, not filling with %s\n", this->getName(), widget->getName()); 65 if (widget == NULL || widget == this->child) 66 this->child = NULL; 67 } 68 69 void GLGuiFrame::showAll() 70 { 71 if (this->child != NULL) 72 { 73 if (this->child->isA(CL_GLGUI_CONTAINER)) 74 static_cast<GLGuiContainer*>(this->child)->showAll(); 75 else 76 this->child->show(); 77 } 78 this->show(); 79 } 80 81 void GLGuiFrame::hideAll() 82 { 83 if (this->child != NULL) 84 { 85 if (this->child->isA(CL_GLGUI_CONTAINER)) 86 static_cast<GLGuiContainer*>(this->child)->hideAll(); 87 else 88 this->child->hide(); 89 } 90 this->hide(); 91 } 92 93 94 /** 95 * draws the GLGuiFrame 96 */ 97 void GLGuiFrame::draw() 98 { 61 99 } 62 100 } 63 64 void GLGuiFrame::unpack(GLGuiWidget* widget)65 {66 if (widget == NULL || widget == this->child)67 this->child = NULL;68 }69 70 void GLGuiFrame::showAll()71 {72 if (this->child != NULL)73 {74 if (this->child->isA(CL_GLGUI_CONTAINER))75 static_cast<GLGuiContainer*>(this->child)->showAll();76 else77 this->child->show();78 }79 this->show();80 }81 82 void GLGuiFrame::hideAll()83 {84 if (this->child != NULL)85 {86 if (this->child->isA(CL_GLGUI_CONTAINER))87 static_cast<GLGuiContainer*>(this->child)->hideAll();88 else89 this->child->hide();90 }91 this->hide();92 }93 94 95 /**96 * draws the GLGuiFrame97 */98 void GLGuiFrame::draw()99 {100 101 } -
trunk/src/lib/gui/gl_gui/glgui_frame.h
r5393 r7779 10 10 #include "glgui_container.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 14 // FORWARD DECLARATION 13 15 14 //! This is Frame part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiFrame : public GLGuiContainer { 16 //! This is Frame part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGuiFrame : public GLGuiContainer 21 { 19 22 20 public:21 GLGuiFrame();22 virtual ~GLGuiFrame();23 public: 24 GLGuiFrame(); 25 virtual ~GLGuiFrame(); 23 26 24 void init();27 void init(); 25 28 26 virtual void pack(GLGuiWidget* widget);27 virtual void unpack(GLGuiWidget* widget);28 virtual void showAll();29 virtual void hideAll();29 virtual void pack(GLGuiWidget* widget); 30 virtual void unpack(GLGuiWidget* widget); 31 virtual void showAll(); 32 virtual void hideAll(); 30 33 31 virtual void draw();34 virtual void draw(); 32 35 33 private:34 GLGuiWidget* child;36 private: 37 GLGuiWidget* child; 35 38 36 };37 39 }; 40 } 38 41 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_handler.cc
r5406 r7779 21 21 #include "glgui_mainwidget.h" 22 22 23 using namespace std; 23 namespace OrxGui 24 { 24 25 25 /**26 * standard constructor27 */28 GLGuiHandler::GLGuiHandler ()29 {30 this->setClassID(CL_GLGUI_HANDLER, "GLGuiHandler");31 this->setName("GLGuiHandler");26 /** 27 * standard constructor 28 */ 29 GLGuiHandler::GLGuiHandler () 30 { 31 this->setClassID(CL_GLGUI_HANDLER, "GLGuiHandler"); 32 this->setName("GLGuiHandler"); 32 33 33 }34 } 34 35 35 /**36 * the singleton reference to this class37 */38 GLGuiHandler* GLGuiHandler::singletonRef = NULL;36 /** 37 * the singleton reference to this class 38 */ 39 GLGuiHandler* GLGuiHandler::singletonRef = NULL; 39 40 40 /**41 @brief standard deconstructor42 */43 GLGuiHandler::~GLGuiHandler ()44 {45 GLGuiHandler::singletonRef = NULL;46 }41 /** 42 @brief standard deconstructor 43 */ 44 GLGuiHandler::~GLGuiHandler () 45 { 46 GLGuiHandler::singletonRef = NULL; 47 } 47 48 48 void GLGuiHandler::activate()49 {50 EventHandler::getInstance()->pushState(ES_MENU);49 void GLGuiHandler::activate() 50 { 51 EventHandler::getInstance()->pushState(ES_MENU); 51 52 52 }53 } 53 54 54 void GLGuiHandler::deactivate()55 {56 EventHandler::getInstance()->popState();55 void GLGuiHandler::deactivate() 56 { 57 EventHandler::getInstance()->popState(); 57 58 58 }59 } 59 60 60 61 61 void GLGuiHandler::process(const Event &event)62 {62 void GLGuiHandler::process(const Event &event) 63 { 63 64 64 65 66 } 65 67 66 } 67 68 void GLGuiHandler::draw() 69 { 70 GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP); 71 } 68 void GLGuiHandler::draw() 69 { 70 GLGuiMainWidget::getInstance()->draw2D(E2D_LAYER_TOP); 71 } 72 72 73 73 74 void GLGuiHandler::tick(float dt)75 {76 74 void GLGuiHandler::tick(float dt) 75 { 76 } 77 77 } -
trunk/src/lib/gui/gl_gui/glgui_handler.h
r5406 r7779 9 9 #include "event_listener.h" 10 10 11 // FORWARD DECLARATION 11 namespace OrxGui 12 { 13 // FORWARD DECLARATION 12 14 13 //! A singleton class for the GLGui-Handler 14 class GLGuiHandler : public EventListener { 15 //! A singleton class for the GLGui-Handler 16 class GLGuiHandler : public EventListener 17 { 15 18 16 public:17 virtual ~GLGuiHandler(void);18 /** @returns a Pointer to the only object of this Class */19 inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; };19 public: 20 virtual ~GLGuiHandler(void); 21 /** @returns a Pointer to the only object of this Class */ 22 inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; }; 20 23 21 void activate();22 void deactivate();24 void activate(); 25 void deactivate(); 23 26 24 27 25 virtual void process(const Event &event);26 void draw();27 void tick(float dt);28 virtual void process(const Event &event); 29 void draw(); 30 void tick(float dt); 28 31 29 private:30 GLGuiHandler(void);31 static GLGuiHandler* singletonRef;32 private: 33 GLGuiHandler(void); 34 static GLGuiHandler* singletonRef; 32 35 33 36 34 bool isActive; 35 }; 37 bool isActive; 38 }; 39 } 36 40 37 41 #endif /* _GLGUI_HANDLER_H */ -
trunk/src/lib/gui/gl_gui/glgui_image.cc
r5366 r7779 18 18 #include "glgui_image.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGuiImage::GLGuiImage ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGuiImage::GLGuiImage () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGuiImage::~GLGuiImage() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGuiImage::~GLGuiImage() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 void GLGuiImage::init() 44 { 45 this->setClassID(CL_GLGUI_, "GLGuiImage"); 46 47 } 48 49 /** 50 * draws the GLGuiImage 51 */ 52 void GLGuiImage::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 void GLGuiImage::init()44 {45 this->setClassID(CL_GLGUI_, "GLGuiImage");46 47 }48 49 /**50 * draws the GLGuiImage51 */52 void GLGuiImage::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_image.h
r5392 r7779 12 12 // FORWARD DECLARATION 13 13 struct SDL_Surface; 14 namespace OrxGui 15 { 14 16 15 //! This is Image part of the openglGUI class 16 /** 17 * 18 */ 19 class GLGuiImage : public GLGuiWidget { 17 //! This is Image part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiImage : public GLGuiWidget 22 { 20 23 21 public:22 GLGuiImage();23 virtual ~GLGuiImage();24 public: 25 GLGuiImage(); 26 virtual ~GLGuiImage(); 24 27 25 void init();26 void loadImageFromFile(const char* fileName);27 void loadImageFromSDLSurface(SDL_Surface* surface);28 void loadImageFromDisplayList(GLuint displayList);28 void init(); 29 void loadImageFromFile(const char* fileName); 30 void loadImageFromSDLSurface(SDL_Surface* surface); 31 void loadImageFromDisplayList(GLuint displayList); 29 32 30 virtual void draw();33 virtual void draw(); 31 34 32 private:35 private: 33 36 34 };35 37 }; 38 } 36 39 #endif /* _GLGUI_IMAGE_H */ -
trunk/src/lib/gui/gl_gui/glgui_mainwidget.cc
r5384 r7779 18 18 #include "glgui_mainwidget.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 23 23 /** 24 * standard constructor 25 */ 26 GLGuiMainWidget::GLGuiMainWidget() 27 { 28 this->setClassID(CL_GLGUI_MAIN_WIDGET, "GLGuiMainWidget"); 29 this->setName("GLGuiMainWidget"); 24 /** 25 * standard constructor 26 */ 27 GLGuiMainWidget::GLGuiMainWidget() 28 { 29 this->setClassID(CL_GLGUI_MAIN_WIDGET, "GLGuiMainWidget"); 30 this->setName("GLGuiMainWidget"); 31 } 32 33 /** 34 * the singleton reference to this class 35 */ 36 GLGuiMainWidget* GLGuiMainWidget::singletonRef = NULL; 37 38 /** 39 * standard deconstructor 40 */ 41 GLGuiMainWidget::~GLGuiMainWidget () 42 { 43 GLGuiMainWidget::singletonRef = NULL; 44 } 30 45 } 31 32 /**33 * the singleton reference to this class34 */35 GLGuiMainWidget* GLGuiMainWidget::singletonRef = NULL;36 37 /**38 * standard deconstructor39 */40 GLGuiMainWidget::~GLGuiMainWidget ()41 {42 GLGuiMainWidget::singletonRef = NULL;43 } -
trunk/src/lib/gui/gl_gui/glgui_mainwidget.h
r5405 r7779 9 9 #include "glgui_widget.h" 10 10 11 // FORWARD DECLARATION 11 namespace OrxGui 12 { 12 13 13 //! A default singleton class. 14 class GLGuiMainWidget : public GLGuiWidget { 14 //! A default singleton class. 15 class GLGuiMainWidget : public GLGuiWidget 16 { 15 17 16 public:17 virtual ~GLGuiMainWidget(void);18 /** @returns a Pointer to the only object of this Class */19 inline static GLGuiMainWidget* getInstance(void) { if (!GLGuiMainWidget::singletonRef) GLGuiMainWidget::singletonRef = new GLGuiMainWidget(); return GLGuiMainWidget::singletonRef; };18 public: 19 virtual ~GLGuiMainWidget(void); 20 /** @returns a Pointer to the only object of this Class */ 21 inline static GLGuiMainWidget* getInstance(void) { if (!GLGuiMainWidget::singletonRef) GLGuiMainWidget::singletonRef = new GLGuiMainWidget(); return GLGuiMainWidget::singletonRef; }; 20 22 21 23 virtual void update() {}; 22 virtual void draw() const {};24 virtual void draw() const {}; 23 25 24 private: 25 GLGuiMainWidget(void); 26 static GLGuiMainWidget* singletonRef; 27 }; 26 private: 27 GLGuiMainWidget(void); 28 static GLGuiMainWidget* singletonRef; 29 }; 30 } 28 31 29 32 #endif /* _GLGUI_MAINWIDGET_H */ -
trunk/src/lib/gui/gl_gui/glgui_menu.cc
r5366 r7779 18 18 #include "glgui_.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGuiMenu::GLGuiMenu ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGuiMenu::GLGuiMenu () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGuiMenu::~GLGuiMenu() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGuiMenu::~GLGuiMenu() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 void GLGuiMenu::init() 44 { 45 this->setClassID(CL_GLGUI_MENU, "GLGuiMenu"); 46 47 } 48 49 /** 50 * draws the GLGuiMenu 51 */ 52 void GLGuiMenu::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 void GLGuiMenu::init()44 {45 this->setClassID(CL_GLGUI_MENU, "GLGuiMenu");46 47 }48 49 /**50 * draws the GLGuiMenu51 */52 void GLGuiMenu::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_menu.h
r7221 r7779 9 9 10 10 #include "base_object.h" 11 namespace OrxGui 12 { 11 13 12 // FORWARD DECLARATION13 template<class T> class tList; 14 //! This is Menu part of the openglGUI class 15 /**16 *17 */18 class GLGuiMenu : public GLGuiMenu{14 // FORWARD DECLARATION 15 //! This is Menu part of the openglGUI class 16 /** 17 * 18 */ 19 class GLGuiMenu : public GLGuiMenu 20 { 19 21 20 public:21 GLGuiMenu();22 virtual ~GLGuiMenu();22 public: 23 GLGuiMenu(); 24 virtual ~GLGuiMenu(); 23 25 24 void init();26 void init(); 25 27 26 void addItem(const std::string& itemName);27 void removeItem(const std::string& itemName);28 void removeItem(unsigned int itemNumber);29 void selectItem(const std::string& itemName);30 void selectItem(unsigned int itemNumber);28 void addItem(const std::string& itemName); 29 void removeItem(const std::string& itemName); 30 void removeItem(unsigned int itemNumber); 31 void selectItem(const std::string& itemName); 32 void selectItem(unsigned int itemNumber); 31 33 32 virtual void draw();34 virtual void draw(); 33 35 34 private:35 tList<char>*itemList;36 private: 37 std::list<std::string> itemList; 36 38 37 };38 39 }; 40 } 39 41 #endif /* _GLGUI_MENU_H */ -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.cc
r6295 r7779 21 21 #include "material.h" 22 22 23 using namespace std; 23 namespace OrxGui 24 { 24 25 25 /**26 * standard constructor27 */28 GLGuiPushButton::GLGuiPushButton ()29 {30 this->init();31 }26 /** 27 * standard constructor 28 */ 29 GLGuiPushButton::GLGuiPushButton () 30 { 31 this->init(); 32 } 32 33 33 34 34 /** 35 * standard deconstructor 36 */ 37 GLGuiPushButton::~GLGuiPushButton() 38 { 35 /** 36 * standard deconstructor 37 */ 38 GLGuiPushButton::~GLGuiPushButton() 39 { 40 } 39 41 42 /** 43 * initializes the GUI-element 44 */ 45 void GLGuiPushButton::init() 46 { 47 this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton"); 48 this->frontMat.setDiffuse(1,0,0); 49 // this->label->setRelCoor2D(10, 10); 50 } 51 52 /** 53 * draws the GLGuiPushButton 54 */ 55 void GLGuiPushButton::draw() const 56 { 57 this->startDraw(); 58 59 // GLGuiButton::draw(); 60 61 this->frontMat.select(); 62 glBegin(GL_QUADS); 63 64 glVertex2d(0,0); 65 glVertex2d(0, this->getSizeY2D()); 66 glVertex2d(this->getSizeX2D(), this->getSizeY2D()); 67 glVertex2d(this->getSizeX2D(),0); 68 69 glEnd(); 70 71 this->endDraw(); 72 // this->label->draw(); 73 // printf("test"); 74 } 75 76 /** 77 * updates the GLGuiPushButton 78 */ 79 void GLGuiPushButton::update() 80 { 81 82 } 40 83 } 41 42 /**43 * initializes the GUI-element44 */45 void GLGuiPushButton::init()46 {47 this->setClassID(CL_GLGUI_PUSHBUTTON, "GLGuiPushButton");48 this->frontMat.setDiffuse(1,0,0);49 // this->label->setRelCoor2D(10, 10);50 }51 52 /**53 * draws the GLGuiPushButton54 */55 void GLGuiPushButton::draw() const56 {57 this->startDraw();58 59 // GLGuiButton::draw();60 61 this->frontMat.select();62 glBegin(GL_QUADS);63 64 glVertex2d(0,0);65 glVertex2d(0, this->getSizeY2D());66 glVertex2d(this->getSizeX2D(), this->getSizeY2D());67 glVertex2d(this->getSizeX2D(),0);68 69 glEnd();70 71 this->endDraw();72 // this->label->draw();73 // printf("test");74 }75 76 /**77 * updates the GLGuiPushButton78 */79 void GLGuiPushButton::update()80 {81 82 83 } -
trunk/src/lib/gui/gl_gui/glgui_pushbutton.h
r5395 r7779 10 10 #include "glgui_button.h" 11 11 12 // FORWARD DECLARATION 12 namespace OrxGui 13 { 13 14 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiPushButton : public GLGuiButton { 15 // FORWARD DECLARATION 19 16 20 public: 21 GLGuiPushButton(); 22 virtual ~GLGuiPushButton(); 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiPushButton : public GLGuiButton 22 { 23 23 24 void init(); 24 public: 25 GLGuiPushButton(); 26 virtual ~GLGuiPushButton(); 25 27 26 virtual void draw() const; 27 virtual void update(); 28 private: 28 void init(); 29 29 30 }; 30 virtual void draw() const; 31 virtual void update(); 32 private: 31 33 34 }; 35 } 32 36 #endif /* _GLGUI_PUSHBUTTON_H */ -
trunk/src/lib/gui/gl_gui/glgui_slider.cc
r5365 r7779 18 18 #include "glgui_slider.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGuiSlider::GLGuiSlider ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGuiSlider::GLGuiSlider () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGuiSlider::~GLGuiSlider() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGuiSlider::~GLGuiSlider() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 void GLGuiSlider::init() 44 { 45 this->setClassID(CL_GLGUI_SLIDER, "GLGuiSlider"); 46 47 } 48 49 /** 50 * draws the GLGuiSlider 51 */ 52 void GLGuiSlider::draw() 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 void GLGuiSlider::init()44 {45 this->setClassID(CL_GLGUI_SLIDER, "GLGuiSlider");46 47 }48 49 /**50 * draws the GLGuiSlider51 */52 void GLGuiSlider::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_slider.h
r5365 r7779 10 10 #include "base_object.h" 11 11 12 // FORWARD DECLARATION13 12 14 //! This is part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiSlider : public GLGuiSlider { 13 namespace OrxGui 14 { 15 // FORWARD DECLARATION 19 16 20 public: 21 GLGuiSlider(); 22 virtual ~GLGuiSlider(); 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiSlider : public GLGuiSlider 22 { 23 23 24 void init(); 24 public: 25 GLGuiSlider(); 26 virtual ~GLGuiSlider(); 25 27 26 virtual void draw();28 void init(); 27 29 28 private:30 virtual void draw(); 29 31 30 }; 32 private: 31 33 34 }; 35 } 32 36 #endif /* _GLGUI_SLIDER_H */ -
trunk/src/lib/gui/gl_gui/glgui_text.cc
r5365 r7779 20 20 #include "text.h" 21 21 22 using namespace std; 22 namespace OrxGui 23 { 24 /** 25 * standard constructor 26 */ 27 GLGuiText::GLGuiText () 28 { 29 this->init(); 23 30 24 /** 25 * standard constructor 26 */ 27 GLGuiText::GLGuiText () 28 { 29 this->init(); 30 31 } 31 } 32 32 33 33 34 /** 35 * standard deconstructor 36 */ 37 GLGuiText::~GLGuiText() 38 { 34 /** 35 * standard deconstructor 36 */ 37 GLGuiText::~GLGuiText() 38 { 39 } 39 40 41 /** 42 * initializes the GUI-element 43 */ 44 void GLGuiText::init() 45 { 46 this->setClassID(CL_GLGUI_, "GLGuiText"); 47 48 } 49 50 /** 51 * draws the GLGuiText 52 */ 53 void GLGuiText::draw() 54 { 55 } 40 56 } 41 42 /**43 * initializes the GUI-element44 */45 void GLGuiText::init()46 {47 this->setClassID(CL_GLGUI_, "GLGuiText");48 49 }50 51 /**52 * draws the GLGuiText53 */54 void GLGuiText::draw()55 {56 57 } -
trunk/src/lib/gui/gl_gui/glgui_text.h
r5365 r7779 12 12 // FORWARD DECLARATION 13 13 class Text; 14 namespace OrxGui 15 { 14 16 15 //! This is part of the openglGUI class 16 /** 17 * 18 */ 19 class GLGuiText : public GLWidget { 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiText : public GLWidget 22 { 20 23 21 public:22 GLGuiText();23 virtual ~GLGuiText();24 public: 25 GLGuiText(); 26 virtual ~GLGuiText(); 24 27 25 void init();28 void init(); 26 29 27 virtual void draw();30 virtual void draw(); 28 31 29 private: 30 Text* text; 31 }; 32 private: 33 Text* text; 34 }; 35 } 32 36 33 37 #endif /* _GLGUI_TEXT_H */ -
trunk/src/lib/gui/gl_gui/glgui_textfield.cc
r5365 r7779 17 17 18 18 #include "glgui_textfield_.h" 19 namespace OrxGui 20 { 19 21 20 using namespace std; 22 /** 23 * standard constructor 24 */ 25 GLGuiTextfield::GLGuiTextfield () 26 { 27 this->init(); 21 28 22 /** 23 * standard constructor 24 */ 25 GLGuiTextfield::GLGuiTextfield () 26 { 27 this->init(); 28 29 } 29 } 30 30 31 31 32 /** 33 * standard deconstructor 34 */ 35 GLGuiTextfield::~GLGuiTextfield() 36 { 32 /** 33 * standard deconstructor 34 */ 35 GLGuiTextfield::~GLGuiTextfield() 36 { 37 } 37 38 39 /** 40 * initializes the GUI-element 41 */ 42 void GLGuiTextfield::init() 43 { 44 this->setClassID(CL_GLGUI_, "GLGuiTextfield"); 45 46 } 47 48 /** 49 * draws the GLGuiTextfield 50 */ 51 void GLGuiTextfield::draw() 52 { 53 } 38 54 } 39 40 /**41 * initializes the GUI-element42 */43 void GLGuiTextfield::init()44 {45 this->setClassID(CL_GLGUI_, "GLGuiTextfield");46 47 }48 49 /**50 * draws the GLGuiTextfield51 */52 void GLGuiTextfield::draw()53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_textfield.h
r5365 r7779 12 12 // FORWARD DECLARATION 13 13 class Text; 14 template<class T> class tList; 14 namespace OrxGui 15 { 15 16 16 //! This is part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGuiTextfield : public GLGuiWidget { 17 //! This is part of the openglGUI class 18 /** 19 * 20 */ 21 class GLGuiTextfield : public GLGuiWidget 22 { 21 23 22 public:23 GLGuiTextfield();24 virtual ~GLGuiTextfield();24 public: 25 GLGuiTextfield(); 26 virtual ~GLGuiTextfield(); 25 27 26 void init();28 void init(); 27 29 28 virtual void draw();30 virtual void draw(); 29 31 30 private:31 tList<Text>*textLines;32 private: 33 std::list<Text*> textLines; 32 34 33 };34 35 }; 36 } 35 37 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/glgui_widget.cc
r7062 r7779 22 22 #include "debug.h" 23 23 24 using namespace std; 24 namespace OrxGui 25 { 25 26 26 /**27 * standard constructor28 */29 GLGuiWidget::GLGuiWidget ( )30 {31 this->init();32 }27 /** 28 * standard constructor 29 */ 30 GLGuiWidget::GLGuiWidget ( ) 31 { 32 this->init(); 33 } 33 34 34 35 35 /** 36 * standard deconstructor 37 */ 38 GLGuiWidget::~GLGuiWidget() 39 { 36 /** 37 * standard deconstructor 38 */ 39 GLGuiWidget::~GLGuiWidget() 40 { 41 } 42 43 44 /** 45 * initializes the GUI-element 46 */ 47 void GLGuiWidget::init() 48 { 49 this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget"); 50 51 this->focusable = true; 52 this->clickable = true; 53 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE); 54 // this->setParent2D((Element2D*)NULL); 55 56 this->backMat.setDiffuse(1.0, 1.0, 1.0); 57 58 this->frontModel = 0; 59 60 this->widgetSignals.resize(GLGuiSignalCount, NULL); 61 } 62 63 64 bool GLGuiWidget::focusOverWidget(float x, float y) 65 { 66 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x+ this->getSizeX2D() > x && 67 this->getAbsCoor2D().y < y && this->getAbsCoor2D().y+ this->getSizeX2D() > y) 68 return true; 69 else 70 return false; 71 } 72 73 /** 74 * @brief connects a Signal to the Gui-Elements' Event. 75 * @param sinalType the Type of Signal to set. @see GLGuiSignalType 76 * @param signal the name of the Signal 77 */ 78 void GLGuiWidget::connectSignal(GLGuiSignalType signalType, BaseObject*, const Executor* signal) 79 { 80 if (signalType >= GLGuiSignalCount) 81 return; 82 83 if (this->widgetSignals[signalType] != NULL) 84 PRINTF(2)("Already connected a Signal to '%s::%s' type %s... overwriting\n", this->getClassName(), this->getName(), "TEST"); 85 86 //this->widgetSignals[signalType] = ; 87 } 88 89 /** 90 * @brief removes a Signal from a Gui-ELements' Event 91 * @param signalType the type of Signal to remove. 92 */ 93 void GLGuiWidget::disconnectSignal(GLGuiSignalType signalType) 94 { 95 if (signalType > GLGuiSignalCount) 96 return; 97 98 this->widgetSignals[signalType] = NULL; 99 } 100 101 102 void GLGuiWidget::show() 103 { 104 this->setVisibility(true); 105 } 106 107 void GLGuiWidget::hide() 108 { 109 this->setVisibility(false); 110 } 111 112 113 void GLGuiWidget::draw() const 114 { 115 this->backMat.select(); 116 117 glBegin(GL_QUADS); 118 glTexCoord2i(0,1); glVertex2d(0, 0); 119 glTexCoord2i(0,0); glVertex2d(0, this->getSizeY2D()); 120 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), this->getSizeY2D()); 121 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), 0); 122 glEnd(); 123 } 40 124 41 125 } 42 43 44 /**45 * initializes the GUI-element46 */47 void GLGuiWidget::init()48 {49 this->setClassID(CL_GLGUI_WIDGET, "GLGuiWidget");50 51 this->focusable = true;52 this->clickable = true;53 this->setVisibility(GLGUI_WIDGET_DEFAULT_VISIBLE);54 // this->setParent2D((Element2D*)NULL);55 56 this->backMat.setDiffuse(1.0, 1.0, 1.0);57 58 this->frontModel = 0;59 60 for (unsigned int i = 0; i < GLGuiSignalCount; i++)61 this->widgetSignals[i] = NULL;62 }63 64 65 bool GLGuiWidget::focusOverWidget(float x, float y)66 {67 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x+ this->getSizeX2D() > x &&68 this->getAbsCoor2D().y < y && this->getAbsCoor2D().y+ this->getSizeX2D() > y)69 return true;70 else71 return false;72 }73 74 /**75 * @brief connects a Signal to the Gui-Elements' Event.76 * @param sinalType the Type of Signal to set. @see GLGuiSignalType77 * @param signal the name of the Signal78 */79 void GLGuiWidget::connectSignal(GLGuiSignalType signalType, const Executor& signal)80 {81 if (signalType >= GLGuiSignalCount)82 return;83 84 if (this->widgetSignals[signalType] != NULL)85 PRINTF(2)("Already connected a Signal to %s (%s) type %s... overwriting\n");86 87 this->widgetSignals[signalType] = signal.clone();88 }89 90 /**91 * @brief removes a Signal from a Gui-ELements' Event92 * @param signalType the type of Signal to remove.93 */94 void GLGuiWidget::disconnectSignal(GLGuiSignalType signalType)95 {96 if (signalType > GLGuiSignalCount)97 return;98 99 this->widgetSignals[signalType] = NULL;100 }101 102 103 void GLGuiWidget::show()104 {105 this->setVisibility(true);106 }107 108 void GLGuiWidget::hide()109 {110 this->setVisibility(false);111 }112 113 114 void GLGuiWidget::draw() const115 {116 this->backMat.select();117 118 glBegin(GL_QUADS);119 glTexCoord2i(0,1); glVertex2d(0, 0);120 glTexCoord2i(0,0); glVertex2d(0, this->getSizeY2D());121 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), this->getSizeY2D());122 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), 0);123 glEnd();124 }125 -
trunk/src/lib/gui/gl_gui/glgui_widget.h
r7221 r7779 9 9 #include "element_2d.h" 10 10 #include "event.h" 11 12 11 #include "material.h" 13 12 14 13 #include "glincl.h" 15 #include " executor/executor.h"14 #include "signal_connector.h" 16 15 17 16 // FORWARD DECLARATION 18 17 class Material; 19 18 20 typedef enum 19 namespace OrxGui 21 20 { 22 GLGuiSignal_click = 0,23 GLGuiSignal_release,24 GLGuiSignal_rollOn,25 GLGuiSignal_rollOff,26 GLGuiSignal_open,27 GLGuiSignal_close,28 GLGuiSignal_destroy,29 21 30 GLGuiSignalCount, 31 } GLGuiSignalType; 22 typedef enum 23 { 24 GLGuiSignal_click = 0, 25 GLGuiSignal_release, 26 GLGuiSignal_rollOn, 27 GLGuiSignal_rollOff, 28 GLGuiSignal_open, 29 GLGuiSignal_close, 30 GLGuiSignal_destroy, 32 31 33 //! if the Element should be visible by default. 32 GLGuiSignalCount, 33 } GLGuiSignalType; 34 35 //! if the Element should be visible by default. 34 36 #define GLGUI_WIDGET_DEFAULT_VISIBLE false 35 37 36 //! This is widget part of the openglGUI class 37 /** 38 * A widget is the main class of all the elements of th GUI. 39 */ 40 class GLGuiWidget : public Element2D { 38 //! This is widget part of the openglGUI class 39 /** 40 * A widget is the main class of all the elements of th GUI. 41 */ 42 class GLGuiWidget : public Element2D 43 { 44 private: 45 41 46 public: 42 47 GLGuiWidget(); 43 48 virtual ~GLGuiWidget(); 44 49 45 void init();46 /** @returns a new char-array containing a string with the options. Delete with delete[]; */47 virtual char* save() {};48 /** loads options of the Widget. @param loadString a string containing the Options */49 virtual void load(const std::string& loadString) {};50 51 50 void show(); 52 51 void hide(); 53 52 54 void connectSignal(GLGuiSignalType signalType, const Executor&signal);53 void connectSignal(GLGuiSignalType signalType, BaseObject* obj, const Executor* signal); 55 54 void disconnectSignal(GLGuiSignalType signalType); 56 55 bool focusOverWidget(float x, float y); … … 73 72 inline void endDraw() const { glPopMatrix(); }; 74 73 74 private: 75 void init(); 76 75 77 protected: 76 Material backMat;77 GLuint backModel;78 Material backMat; 79 GLuint backModel; 78 80 79 Material frontMat;80 GLuint frontModel;81 Material frontMat; 82 GLuint frontModel; 81 83 82 84 private: 83 Executor* widgetSignals[GLGuiSignalCount];85 std::vector<SignalConnector*> widgetSignals; 84 86 85 bool focusable; //!< If this widget can receive focus.86 bool clickable; //!< if this widget can be clicked upon.87 };88 87 bool focusable; //!< If this widget can receive focus. 88 bool clickable; //!< if this widget can be clicked upon. 89 }; 90 } 89 91 #endif /* _GLGUI_WIDGET_H */ -
trunk/src/lib/gui/gl_gui/glgui_window.cc
r6287 r7779 18 18 #include "glgui_window.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 /**23 * standard constructor24 */25 GLGuiWindow::GLGuiWindow ()26 {27 this->init();23 /** 24 * standard constructor 25 */ 26 GLGuiWindow::GLGuiWindow () 27 { 28 this->init(); 28 29 29 }30 } 30 31 31 32 32 /** 33 * standard deconstructor 34 */ 35 GLGuiWindow::~GLGuiWindow() 36 { 33 /** 34 * standard deconstructor 35 */ 36 GLGuiWindow::~GLGuiWindow() 37 { 38 } 37 39 40 /** 41 * initializes the GUI-element 42 */ 43 void GLGuiWindow::init() 44 { 45 this->setClassID(CL_GLGUI_WINDOW, "GLGuiWindow"); 46 47 } 48 49 /** 50 * draws the GLGuiWindow 51 */ 52 void GLGuiWindow::draw() const 53 { 54 } 38 55 } 39 40 /**41 * initializes the GUI-element42 */43 void GLGuiWindow::init()44 {45 this->setClassID(CL_GLGUI_WINDOW, "GLGuiWindow");46 47 }48 49 /**50 * draws the GLGuiWindow51 */52 void GLGuiWindow::draw() const53 {54 55 } -
trunk/src/lib/gui/gl_gui/glgui_window.h
r6287 r7779 11 11 12 12 // FORWARD DECLARATION 13 namespace OrxGui 14 { 13 15 14 //! This is window part of the openglGUI class 15 /** 16 * 17 */ 18 class GLGuiWindow : public GLGuiContainer { 16 //! This is window part of the openglGUI class 17 /** 18 * 19 */ 20 class GLGuiWindow : public GLGuiContainer 21 { 19 22 20 public:21 GLGuiWindow();22 virtual ~GLGuiWindow();23 public: 24 GLGuiWindow(); 25 virtual ~GLGuiWindow(); 23 26 24 void init();27 void init(); 25 28 26 virtual void draw() const;29 virtual void draw() const; 27 30 28 private:31 private: 29 32 30 };31 33 }; 34 } 32 35 #endif /* _GLGUI__H */ -
trunk/src/lib/gui/gl_gui/signal_connector.cc
r7778 r7779 10 10 11 11 ### File Specific: 12 main-programmer: ...12 main-programmer: Benjamin Grauer 13 13 co-programmer: ... 14 14 */ … … 16 16 //#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_ 17 17 18 #include " proto_class.h"18 #include "signal_connector.h" 19 19 20 using namespace std; 20 namespace OrxGui 21 { 21 22 22 23 /** 24 * standard constructor 25 * @todo this constructor is not jet implemented - do it 26 */ 27 ProtoClass::ProtoClass () 28 { 29 this->setClassID(CL_PROTO_ID, "ProtoClass"); 30 31 /* If you make a new class, what is most probably the case when you write this file 32 don't forget to: 33 1. Add the new file new_class.cc to the ./src/Makefile.am 34 2. Add the class identifier to ./src/class_id.h eg. CL_NEW_CLASS 35 36 Advanced Topics: 37 - if you want to let your object be managed via the ObjectManager make sure to read 38 the object_manager.h header comments. You will use this most certanly only if you 39 make many objects of your class, like a weapon bullet. 40 */ 23 SignalConnector::SignalConnector(BaseObject* object, const Executor* executor) 24 : object(object), exec(exec) 25 {}; 41 26 } 42 43 44 /**45 * standard deconstructor46 */47 ProtoClass::~ProtoClass ()48 {49 // delete what has to be deleted here50 } -
trunk/src/lib/gui/gl_gui/signal_connector.h
r7778 r7779 1 1 /*! 2 * @file proto_class.h2 * @file signal_connector.h 3 3 * @brief Definition of ... 4 4 */ 5 5 6 #ifndef _ PROTO_CLASS_H7 #define _ PROTO_CLASS_H6 #ifndef _SIGNAL_CONNECTOR_H 7 #define _SIGNAL_CONNECTOR_H 8 8 9 #include " base_object.h"9 #include "executor/executor.h" 10 10 11 // FORWARD DECLARATION 11 namespace OrxGui 12 { 13 //! A class for ... 14 class SignalConnector 15 { 16 public: 17 SignalConnector(BaseObject* object, const Executor* exec); 18 SignalConnector(const SignalConnector& signalConnector); 19 ~SignalConnector() { delete exec; } 12 20 21 SignalConnector& operator=(const SignalConnector& signalConnector); 13 22 14 15 //! A class for ... 16 class ProtoClass : public BaseObject { 17 18 public: 19 ProtoClass(); 20 virtual ~ProtoClass(); 21 22 23 private: 24 25 }; 26 27 #endif /* _PROTO_CLASS_H */ 23 private: 24 const Executor* exec; 25 BaseObject* object; 26 }; 27 } 28 #endif /* _SIGNAL_CONNECTOR_H */ -
trunk/src/lib/lang/base_object.h
r7661 r7779 28 28 public: 29 29 BaseObject (const std::string& objectName = ""); 30 30 31 virtual ~BaseObject (); 31 32 -
trunk/src/util/hud.h
r7062 r7779 15 15 16 16 //! A class that renders a HUD. 17 class Hud : public GLGuiWidget17 class Hud : public OrxGui::GLGuiWidget 18 18 { 19 19 -
trunk/src/world_entities/weapons/weapon.cc
r7729 r7779 307 307 } 308 308 309 GLGuiWidget* Weapon::getEnergyWidget()309 OrxGui::GLGuiWidget* Weapon::getEnergyWidget() 310 310 { 311 311 if (this->energyWidget == NULL) 312 312 { 313 this->energyWidget = new GLGuiBar;313 this->energyWidget = new OrxGui::GLGuiBar; 314 314 this->energyWidget->setSize2D( 20, 100); 315 315 this->energyWidget->setMaximum(this->getEnergyMax()); -
trunk/src/world_entities/weapons/weapon.h
r7460 r7779 25 25 class TiXmlElement; 26 26 class FastFactory; 27 namespace OrxGui{ class GLGuiWidget; } 27 28 template<class T> class tFastFactory; 28 class GLGuiWidget;29 29 30 30 //! An enumerator defining Actions a Weapon can take … … 156 156 Animation3D* copyAnimation(WeaponState from, WeaponState to); 157 157 158 GLGuiWidget* getEnergyWidget();158 OrxGui::GLGuiWidget* getEnergyWidget(); 159 159 160 160 // FLOW … … 211 211 float maxCharge; //!< The maximal energy to be loaded onto one projectile (this is only availible if chargeable is enabled) 212 212 213 GLGuiBar*energyWidget;213 OrxGui::GLGuiBar* energyWidget; 214 214 215 215 PNode* defaultTarget; //!< A target for targeting Weapons. -
trunk/src/world_entities/world_entity.cc
r7711 r7779 406 406 if (this->healthWidget == NULL) 407 407 { 408 this->healthWidget = new GLGuiBar();408 this->healthWidget = new OrxGui::GLGuiBar(); 409 409 this->healthWidget->setSize2D(30,400); 410 410 this->healthWidget->setAbsCoor2D(10,100); … … 423 423 424 424 425 GLGuiWidget* WorldEntity::getHealthWidget()425 OrxGui::GLGuiWidget* WorldEntity::getHealthWidget() 426 426 { 427 427 this->createHealthWidget(); -
trunk/src/world_entities/world_entity.h
r7711 r7779 17 17 // FORWARD DECLARATION 18 18 namespace OrxSound { class SoundBuffer; class SoundSource; } 19 namespace OrxGui { class GLGuiWidget; class GLGuiBar; }; 20 19 21 class BVTree; 20 22 class Model; 21 22 class GLGuiWidget;23 class GLGuiBar;24 23 25 24 //class CharacterAttributes; … … 91 90 float decreaseHealth(float health); 92 91 void increaseHealthMax(float increaseHealth); 93 GLGuiWidget* getHealthWidget();92 OrxGui::GLGuiWidget* getHealthWidget(); 94 93 bool hasHealthWidget() const { return this->healthWidget; }; 95 94 … … 108 107 float health; //!< The Energy of this Entity, if the Entity has any energy at all. 109 108 float healthMax; //!< The Maximal energy this entity can take. 110 GLGuiBar*healthWidget; //!< The Slider (if wanted).109 OrxGui::GLGuiBar* healthWidget; //!< The Slider (if wanted). 111 110 112 111 std::vector<Model*> models; //!< The model that should be loaded for this entity.
Note: See TracChangeset
for help on using the changeset viewer.