Changeset 7880 in orxonox.OLD for branches/gui/src
- Timestamp:
- May 26, 2006, 11:35:21 PM (18 years ago)
- Location:
- branches/gui/src
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/gui/src/lib/gui/gl_gui/glgui.h
r7876 r7880 6 6 #ifndef _GLGUI_H 7 7 #define _GLGUI_H 8 9 #include "glgui_handler.h" 10 8 11 #include "glgui_widget.h" 9 12 -
branches/gui/src/lib/gui/gl_gui/glgui_handler.cc
r7868 r7880 20 20 21 21 #include "glgui_mainwidget.h" 22 #include "glgui_cursor.h" 23 24 #include "class_list.h" 25 22 26 23 27 namespace OrxGui … … 32 36 this->setName("GLGuiHandler"); 33 37 38 39 this->cursor = NULL; 34 40 //this->subscribeEvent() 35 41 … … 48 54 GLGuiHandler::singletonRef = NULL; 49 55 } 56 57 void GLGuiHandler::activateCursor() 58 { 59 this->cursor = new GLGuiCursor(); 60 this->cursor->show(); 61 } 62 63 void GLGuiHandler::deactivateCursor() 64 { 65 if (this->cursor) 66 { 67 delete this->cursor; 68 this->cursor = NULL; 69 } 70 } 71 50 72 51 73 void GLGuiHandler::activate() … … 76 98 void GLGuiHandler::tick(float dt) 77 99 { 100 101 // CHECK THE COLLISIONS. 102 const std::list<BaseObject*>* objects = ClassList::getList(CL_GLGUI_WIDGET); 103 104 if (objects != NULL && this->cursor != NULL) 105 { 106 for (std::list<BaseObject*>::const_iterator it = objects->begin(); it != objects->end(); it++) 107 { 108 GLGuiWidget* widget = dynamic_cast<GLGuiWidget*>(*it); 109 if (widget->focusOverWidget(this->cursor->getAbsCoor2D().x, this->cursor->getAbsCoor2D().y)) 110 { 111 // receiving Focus 112 if (GLGuiWidget::focused() != widget) 113 { 114 printf("yeah\n"); 115 widget->giveFocus(); 116 } 117 } 118 } 119 } 78 120 } 79 121 } -
branches/gui/src/lib/gui/gl_gui/glgui_handler.h
r7779 r7880 8 8 9 9 #include "event_listener.h" 10 #include "glgui_widget.h" 10 11 11 12 namespace OrxGui 12 13 { 14 15 class GLGuiCursor; 16 13 17 // FORWARD DECLARATION 14 18 … … 21 25 /** @returns a Pointer to the only object of this Class */ 22 26 inline static GLGuiHandler* getInstance(void) { if (!GLGuiHandler::singletonRef) GLGuiHandler::singletonRef = new GLGuiHandler(); return GLGuiHandler::singletonRef; }; 27 28 void activateCursor(); 29 void deactivateCursor(); 30 GLGuiCursor* getCursor() const { return this->cursor; } 23 31 24 32 void activate(); … … 36 44 37 45 bool isActive; 46 GLGuiCursor* cursor; 47 38 48 }; 39 49 } -
branches/gui/src/lib/gui/gl_gui/glgui_widget.cc
r7879 r7880 65 65 66 66 67 bool GLGuiWidget::focusOverWidget(float x, float y) 67 bool GLGuiWidget::focusOverWidget(float x, float y) const 68 68 { 69 69 if (this->getAbsCoor2D().x < x && this->getAbsCoor2D().x + this->getSizeX2D() > x && -
branches/gui/src/lib/gui/gl_gui/glgui_widget.h
r7879 r7880 52 52 void hide(); 53 53 54 void giveFocus() { GLGuiWidget::_focused = this; this->receivedFocus(); }; 55 54 56 void connectSignal(SignalType signalType, BaseObject* obj, const Executor* signal); 55 57 void disconnectSignal(SignalType signalType); 56 bool focusOverWidget(float x, float y) ;58 bool focusOverWidget(float x, float y) const; 57 59 58 60 … … 65 67 Material& frontMaterial() { return this->frontMat; }; 66 68 const Material& frontMaterial() const { return this->frontMat; }; 69 70 71 72 static const GLGuiWidget* const focused() { return GLGuiWidget::_focused; }; 73 67 74 68 75 protected: -
branches/gui/src/story_entities/simple_game_menu.cc
r7876 r7880 67 67 pb->setAbsCoor2D(50, 50); 68 68 69 OrxGui::GLGuiCursor* cursor = new OrxGui::GLGuiCursor(); 70 cursor->show(); 69 OrxGui::GLGuiHandler::getInstance()->activateCursor(); 71 70 72 71 if (root != NULL) … … 315 314 GameWorld::tick(); 316 315 316 // Make the GLGui tick. 317 OrxGui::GLGuiHandler::getInstance()->tick(this->dtS); 318 317 319 this->animateScene(this->dtS); 318 320 }
Note: See TracChangeset
for help on using the changeset viewer.