Changeset 7925 in orxonox.OLD for branches/gui/src/lib
- Timestamp:
- May 28, 2006, 5:56:17 PM (19 years ago)
- Location:
- branches/gui/src/lib
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/event/event_handler.cc
r7919 r7925 337 337 else 338 338 { 339 SDL_WM_GrabInput(SDL_GRAB_ON);339 //SDL_WM_GrabInput(SDL_GRAB_ON); 340 340 SDL_ShowCursor(SDL_DISABLE); 341 341 } -
branches/gui/src/lib/gui/gl_gui/glgui_button.h
r7919 r7925 39 39 void setLabel(const std::string& label); 40 40 41 virtual void resize() = 0;42 43 41 virtual void draw() const; 44 42 45 43 private: 46 44 void init(); 45 47 46 48 47 -
branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.cc
r7919 r7925 62 62 this->label.setRelCoor2D(25, 5); 63 63 this->setSize2D(this->label.getSizeX2D() + 30, this->label.getSizeY2D() + 10); 64 GLGuiWidget::resize(); 65 this->frontRect().setTopLeft(1, 1); 66 this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2); 64 67 } 65 68 … … 72 75 } 73 76 77 78 74 79 /** 75 80 * @brief draws the GLGuiPushButton … … 81 86 82 87 this->frontMaterial().select(); 83 glBegin(GL_QUADS); 84 85 glTexCoord2i(0,0); glVertex2d(1, 1); 86 glTexCoord2i(0,1); glVertex2d(1, this->getSizeY2D() - 1); 87 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D() - 1, this->getSizeY2D() -1); 88 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D() - 1, 1); 88 this->drawRect(this->frontRect()); 89 89 90 90 if (this->bActive) 91 91 { 92 glBegin(GL_QUADS); 92 93 glColor3f( 1, 1 ,1); 93 94 glTexCoord2i(0,0); glVertex2d(8, 8); … … 117 118 else 118 119 { 120 glBegin(GL_QUADS); 119 121 glColor3f(0, 0, 0); 120 122 glTexCoord2i(0,0); glVertex2d(8, 8); … … 125 127 } 126 128 127 128 129 this->endDraw(); 129 // this->label->draw();130 // printf("test");131 130 } 132 131 } -
branches/gui/src/lib/gui/gl_gui/glgui_checkbutton.h
r7919 r7925 26 26 virtual ~GLGuiCheckButton(); 27 27 28 virtual void resize();29 28 virtual void released(); 30 29 … … 35 34 virtual void draw() const; 36 35 virtual void update() {}; 36 37 protected: 38 virtual void resize(); 37 39 38 40 private: -
branches/gui/src/lib/gui/gl_gui/glgui_cursor.cc
r7924 r7925 64 64 this->color = 0.0f; 65 65 66 this->resize(); 66 67 } 67 68 … … 88 89 89 90 90 this->setAbsCoor 2D(newPos);91 this->setAbsCoorSoft2D(newPos, 20); 91 92 movement = Vector2D(); 92 93 } -
branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.cc
r7919 r7925 45 45 void GLGuiPushButton::resize() 46 46 { 47 this->label.setRelCoor2D( 5, 5);47 this->label.setRelCoor2D(25, 5); 48 48 this->setSize2D(this->label.getSizeX2D() + 10, this->label.getSizeY2D() + 10); 49 GLGuiWidget::resize(); 50 this->frontRect().setTopLeft(1, 1); 51 this->frontRect().setSize(this->getSizeX2D() -2, this->getSizeY2D() -2); 49 52 } 50 53 -
branches/gui/src/lib/gui/gl_gui/glgui_pushbutton.h
r7919 r7925 27 27 28 28 29 virtual void resize();30 31 29 virtual void receivedFocus(); 32 30 virtual void removedFocus(); … … 37 35 virtual void draw() const; 38 36 virtual void update(); 37 protected: 38 virtual void resize(); 39 40 39 41 private: 40 42 void init(); -
branches/gui/src/lib/gui/gl_gui/glgui_widget.cc
r7924 r7925 104 104 } 105 105 106 107 void GLGuiWidget::resize() 108 { 109 this->backRect().setSize(this->getSize2D()); 110 } 111 112 106 113 void GLGuiWidget::click() 107 114 { … … 189 196 } 190 197 198 191 199 void GLGuiWidget::hide() 192 200 { … … 195 203 196 204 205 /** 206 * USE THIS FUNCTION ONLY FROM DERIVED CLASS 207 */ 197 208 void GLGuiWidget::draw() const 198 209 { 199 210 this->backMaterial().select(); 200 201 glBegin(GL_QUADS); 202 glTexCoord2i(0,0); glVertex2d(0, 0); 203 glTexCoord2i(0,1); glVertex2d(0, this->getSizeY2D()); 204 glTexCoord2i(1,1); glVertex2d(this->getSizeX2D(), this->getSizeY2D()); 205 glTexCoord2i(1,0); glVertex2d(this->getSizeX2D(), 0); 206 glEnd(); 211 this->drawRect(this->backRect()); 207 212 } 208 213 -
branches/gui/src/lib/gui/gl_gui/glgui_widget.h
r7924 r7925 81 81 82 82 83 83 84 /// CLICK 84 85 void click(); … … 86 87 bool clickable() const { return this->_clickable; }; 87 88 void setClickable(bool clickable = true) { this->_clickable = clickable; }; 88 89 virtual void update() {};90 virtual void draw() const;91 89 92 90 … … 102 100 const Rect2D& frontRect() const { return this->_frontRect; }; 103 101 104 inline void drawRect(const Rect2D& rect) {102 inline void drawRect(const Rect2D& rect) const { 105 103 glBegin(GL_QUADS); 106 104 glTexCoord2i(0,0); glVertex2d(rect.left(), rect.top()); … … 111 109 } 112 110 111 112 virtual void update() {}; 113 virtual void draw() const; 114 113 115 /** @param the Event to process. @returns true if the Event has been consumed*/ 114 116 virtual bool processEvent(const Event& event) { }; … … 117 119 DeclareSignal(testSignal, ()); 118 120 121 122 119 123 protected: 120 // if something was clickt on the GUI-widget. 124 125 /// LOOKS 126 virtual void resize(); 127 128 // if something was clickt on the GUI-widget. 121 129 virtual void clicked(); 122 130 virtual void released(); -
branches/gui/src/lib/math/rect2D.h
r7919 r7925 83 83 inline void setRight(float right) { _bottomRight.x = right; }; 84 84 /** @param topLeft the top left corner of the Rectangle */ 85 void setTopLeft(const Vector2D& topLeft) { _topLeft = topLeft; }; 85 inline void setTopLeft(const Vector2D& topLeft) { _topLeft = topLeft; }; 86 /** @param x the left border of the Rectangle @param y the top border */ 87 inline void setTopLeft(float x, float y) { this->setTopLeft(Vector2D(x,y)); }; 86 88 /** @param bottomRight the lower right corner of the Rectangle */ 87 void setBottomRight(const Vector2D& bottomRight) { _bottomRight = bottomRight; }; 89 inline void setBottomRight(const Vector2D& bottomRight) { _bottomRight = bottomRight; }; 90 /** @param x the right border of the Rectangle @param y the bottom border */ 91 inline void setBottomRight(float x, float y) { this->setBottomRight(Vector2D(x,y)); }; 88 92 89 93 void setWidth(float width);
Note: See TracChangeset
for help on using the changeset viewer.