Changeset 3152 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Dec 11, 2004, 5:36:03 PM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui.cc
r3147 r3152 54 54 int main( int argc, char *argv[] ) 55 55 { 56 Window::lastWindow = NULL;57 56 OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv); 58 57 return 0; -
orxonox/trunk/gui/orxonox_gui_gtk.cc
r3148 r3152 277 277 } 278 278 279 Window* Window::lastWindow = NULL;280 281 279 /** 282 280 \brief initializes a new Window … … 286 284 if (!mainWindow) 287 285 mainWindow = this; 288 286 289 287 isOpen = false; 290 288 … … 298 296 gtk_container_set_border_width (GTK_CONTAINER (widget), 3); 299 297 300 // printf("%p\n",lastWindow);301 302 if (lastWindow !=NULL)303 {304 lastWindow->next = this;305 printf("%p, %p\n", lastWindow, this);306 }307 Window::lastWindow = this;308 298 } 309 299 -
orxonox/trunk/gui/orxonox_gui_gtk.h
r3148 r3152 92 92 static void addWindow(Window* windowToAdd); 93 93 94 static Window* lastWindow;95 94 Window (void); 96 95 Window (char* windowName); -
orxonox/trunk/gui/orxonox_gui_keys.cc
r3147 r3152 60 60 openButton->connectSignal("button_press_event", this, openWindowEvent); 61 61 62 keyWindow = new Window("keys of player"); 63 64 keysBox = new Box('v'); 65 keysBox->fill(addKey(UP, "up")); 66 keysBox->fill(addKey(DOWN, "down")); 67 keysBox->fill(addKey(LEFT, "left")); 68 keysBox->fill(addKey(RIGHT, "right")); 69 keysBox->fill(addKey(SHOOT, "shoot")); 70 keyWindow->fill(keysBox); 71 windowIsOpen = false; 72 62 pKeyWindow = new Window("keys of player"); 63 pKeysBox = new Box('v'); 64 pKeysBox->fill(addKey(UP, "up")); 65 pKeysBox->fill(addKey(DOWN, "down")); 66 pKeysBox->fill(addKey(LEFT, "left")); 67 pKeysBox->fill(addKey(RIGHT, "right")); 68 pKeysBox->fill(addKey(SHOOT, "shoot")); 69 70 closeButton = new Button("close"); 71 closeButton->connectSignal("button_press_event", this, closeWindowEvent); 72 pKeysBox->fill(closeButton); 73 pKeyWindow->fill(pKeysBox); 74 // Window::addWindow(pKeyWindow); 73 75 } 74 76 75 77 Widget* Player::addKey (KEYS key, char* name) 76 78 { 77 keyBox[key] = new Box();78 keyLabel[key] = new Label (name);79 keyButton[key] = new Button(name);80 keyButton[key]->saveable;79 pKeyBox[key] = new Box(); 80 pKeyLabel[key] = new Label (name); 81 pKeyButton[key] = new Button(name); 82 pKeyButton[key]->saveable = true; 81 83 82 keyButton[key]->connectSignal("key_press_event", keyButton[key], key_cb);84 pKeyButton[key]->connectSignal("key_press_event", pKeyButton[key], key_cb); 83 85 84 keyBox[key]->fill(keyLabel[key]);85 keyBox[key]->fill(keyButton[key]);86 return keyBox[key];86 pKeyBox[key]->fill(pKeyLabel[key]); 87 pKeyBox[key]->fill(pKeyButton[key]); 88 return pKeyBox[key]; 87 89 } 88 90 … … 96 98 { 97 99 cout << "setting up Key: "<< key <<endl; 98 99 }100 101 /**102 \brief function to display, hide the palyer window103 Buggy, segmentation fault on WindowMaker104 */105 void Player::openWindow ()106 {107 if (!windowIsOpen)108 keyWindow->showall();109 else110 keyWindow->hide();111 windowIsOpen = !windowIsOpen;112 100 } 113 101 114 102 gint Player::openWindowEvent (GtkWidget* widget, GdkEvent* event, void* player) 115 103 { 116 117 static_cast<Player*>(player)->openWindow(); 118 } 119 104 static_cast<Player*>(player)->pKeyWindow->open(); 105 } 106 107 gint Player::closeWindowEvent (GtkWidget* widget, GdkEvent* event, void* player) 108 { 109 static_cast<Player*>(player)->pKeyWindow->close(); 110 } 120 111 121 112 /** -
orxonox/trunk/gui/orxonox_gui_keys.h
r2737 r3152 15 15 enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT }; 16 16 17 //! Class to hold infos about a Player 18 class Player 19 { 20 private: 21 Window* keyWindow; 22 bool windowIsOpen; 23 Button* openButton; 24 25 26 Box* keysBox; 27 28 Box* keyBox[10]; 29 Button* keyButton[10]; 30 Label* keyLabel[10]; 31 32 33 public: 34 Player(char* player); 35 36 Widget* addKey (KEYS key, char* name); 37 38 Button* getOpenButton(); 39 40 void openWindow (); 41 42 static gint openWindowEvent(GtkWidget* widget, GdkEvent* event, void* player); 43 static gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget); 44 void setkey(KEYS key); 45 46 }; 47 17 class Player; 48 18 //! Class that creates the Keys-Options. 49 19 class OrxonoxGuiKeys … … 63 33 }; 64 34 35 //! Class to hold infos about a Player 36 class Player 37 { 38 private: 39 Window* pKeyWindow; 40 Button* openButton; 41 Button* closeButton; 42 Box* pKeysBox; 43 44 Box* pKeyBox[10]; 45 Button* pKeyButton[10]; 46 Label* pKeyLabel[10]; 47 48 49 public: 50 Player(char* player); 51 52 Widget* addKey (KEYS key, char* name); 53 54 Button* getOpenButton(); 55 56 static gint openWindowEvent(GtkWidget* widget, GdkEvent* event, void* player); 57 static gint closeWindowEvent(GtkWidget* widget, GdkEvent* event, void* player); 58 static gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget); 59 void setkey(KEYS key); 60 61 }; 65 62 66 63
Note: See TracChangeset
for help on using the changeset viewer.