Changeset 2735 in orxonox.OLD for orxonox/trunk/gui
- Timestamp:
- Nov 6, 2004, 3:18:40 AM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui_keys.cc
r2733 r2735 36 36 keysBox = new Box ('v'); 37 37 player1 = new Player("player1"); 38 player2 = new Player("player2");39 38 // player2 = new Player("player2"); 39 40 40 keysBox->fill(player1->getOpenButton()); 41 player1->getOpenButton()->connectSignal("key_press_event", this, key_cb);42 41 43 42 keysFrame->fill (keysBox); … … 59 58 { 60 59 openButton = new Button (player); 60 openButton->connectSignal("button_press_event", this, openWindowEvent); 61 62 keyWindow = new Window("keys of player"); 63 64 keyBox = new Box('v'); 65 Keys[UP] = new Button("up"); 66 Keys[DOWN] = new Button("down"); 67 Keys[LEFT] = new Button("left"); 68 Keys[RIGHT] = new Button("right"); 69 Keys[SHOOT] = new Button("shoot"); 70 71 Keys[UP]->connectSignal("key_press_event", Keys[UP], key_cb); 72 Keys[DOWN]->connectSignal("key_press_event", Keys[DOWN], key_cb); 73 Keys[LEFT]->connectSignal("key_press_event", Keys[LEFT], key_cb); 74 Keys[RIGHT]->connectSignal("key_press_event", Keys[RIGHT], key_cb); 75 Keys[SHOOT]->connectSignal("key_press_event", Keys[SHOOT], key_cb); 76 77 keyBox->fill(Keys[UP]); 78 keyBox->fill(Keys[DOWN]); 79 keyBox->fill(Keys[LEFT]); 80 keyBox->fill(Keys[RIGHT]); 81 keyBox->fill(Keys[SHOOT]); 82 83 keyWindow->fill(keyBox); 84 windowIsOpen = false; 85 61 86 } 62 87 … … 73 98 } 74 99 75 gint WindowOpen (GtkWidget* widget, GdkEvent* event, void* player) 76 { 77 78 } 79 80 81 82 gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget) 100 /** 101 \brief function to display, hide the palyer window 102 Buggy, segmentation fault on WindowMaker 103 */ 104 void Player::openWindow () 105 { 106 if (!windowIsOpen) 107 keyWindow->showall(); 108 else 109 keyWindow->hide(); 110 windowIsOpen = !windowIsOpen; 111 } 112 113 gint Player::openWindowEvent (GtkWidget* widget, GdkEvent* event, void* player) 114 { 115 116 static_cast<Player*>(player)->openWindow(); 117 } 118 119 120 /** 121 \brief Function which gets keystrokes 122 \param w the widget that released the Function. 123 \param event The event that happened. 124 \param Widget the Widget which will be applied. 125 \returns Nothing 126 */ 127 gint key_cb(GtkWidget* w, GdkEventKey* event, void* Widget) 83 128 { 84 129 switch(event->keyval) { -
orxonox/trunk/gui/orxonox_gui_keys.h
r2733 r2735 13 13 * defines the Possible Player Keys 14 14 */ 15 enum KEYS { UP, DOWN, LEFT, RIG TH, SHOOT };15 enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT }; 16 16 17 /** 18 \brief Class to hold infos about a Player 19 */ 17 //! Class to hold infos about a Player 20 18 class Player 21 19 { 22 20 private: 23 char keys[10]; 21 Window* keyWindow; 22 bool windowIsOpen; 24 23 Button* openButton; 25 Window* window; 26 24 25 26 Box* keyBox; 27 Button* Keys[10]; 28 29 27 30 public: 28 31 Player(char* player); 29 32 30 33 Button* getOpenButton(); 34 35 void openWindow (); 31 36 37 static gint openWindowEvent(GtkWidget* widget, GdkEvent* event, void* player); 32 38 void setkey(KEYS key); 33 39 … … 52 58 53 59 54 gint key_cb(GtkWidget* w, GdkEventKey* event, gpointer data); 60 61 gint key_cb(GtkWidget* w, GdkEventKey* event, void* Widget); 55 62 56 63 #endif /* _ORXONOX_GUI_KEYS_H */
Note: See TracChangeset
for help on using the changeset viewer.