Changeset 4088 in orxonox.OLD for orxonox/trunk/src/lib/gui
- Timestamp:
- May 6, 2005, 5:02:14 PM (20 years ago)
- Location:
- orxonox/trunk/src/lib/gui/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/lib/gui/gui/gui_keys.cc
r4086 r4088 33 33 GuiKeys::GuiKeys(void) 34 34 { 35 this->keysFrame = new Frame("Keyboard-Options:"); 36 // keysFrame->setGroupName("Keyboard"); 37 this->keysBox = new Box('h'); 38 this->player1 = new Player("player1"); 39 this->player2 = new Player("player2"); 40 41 this->keysBox->fill(this->player1->getOpenButton()); 42 this->keysBox->fill(this->player2->getOpenButton()); 43 44 this->keysFrame->fill(this->keysBox); 45 46 35 Frame* keysFrame; //!< The Frame that holds the keyOptions. 36 37 keysFrame = new Frame("Keyboard-Options:"); 38 { 39 Box* keysBox; //!< The Frame that holds the keyOptions. 40 41 // keysFrame->setGroupName("Keyboard"); 42 keysBox = new Box('h'); 43 { 44 Player* player1; //!< The first Player's keys. 45 Player* player2; //!< The seconds Player's keys. 46 Button* misc; //!< Other keyboeard options come here. \todo include some like pause, quit and so on. 47 48 player1 = new Player("player1"); 49 player2 = new Player("player2"); 50 51 keysBox->fill(player1->getOpenButton()); 52 keysBox->fill(player2->getOpenButton()); 53 } 54 keysFrame->fill(keysBox); 55 } 56 57 // setting up the Input Windows that receives keystrokes. 47 58 this->inputWindow = new Window("inputWindow"); 48 59 this->inputButton = new Button("test"); … … 52 63 #endif /* HAVE_GTK2 */ 53 64 this->inputWindow->fill(inputButton); 54 65 55 66 this->setMainWidget(keysFrame); 56 67 } … … 78 89 Player::Player(char* player) 79 90 { 80 char* windowName = new char[strlen(player)+25]; 81 strcpy(windowName, "Keyboard settings of "); 91 Window* pKeyWindow; //!< The Window for a new Key-setting. 92 93 char* windowName = new char[strlen(player)+12]; 94 strcpy(windowName, "KeySets: "); 82 95 strcat(windowName, player); 83 this->pKeyWindow = new Window(windowName); 84 this->pKeyFrame = new Frame(windowName); 85 this->pKeysBox = new Box('v'); 86 this->pKeysBox->setGroupName(player); 87 this->pKeysBox->fill(addKey(UP, "up")); 88 this->pKeysBox->fill(addKey(DOWN, "down")); 89 this->pKeysBox->fill(addKey(LEFT, "left")); 90 this->pKeysBox->fill(addKey(RIGHT, "right")); 91 this->pKeysBox->fill(addKey(SHOOT, "fire")); 92 delete windowName; 93 closeButton = new Button("close"); 94 #ifdef HAVE_GTK2 95 this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose); 96 #endif /* HAVE_GTK2 */ 97 98 this->pKeysBox->fill(this->closeButton); 99 this->pKeyFrame->fill(this->pKeysBox); 100 this->pKeyWindow->fill(this->pKeyFrame); 101 Window::addWindow(this->pKeyWindow); 102 #ifdef HAVE_GTK2 103 this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose); 104 this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose); 105 #endif /* HAVE_GTK2 */ 106 96 pKeyWindow = new Window(windowName); 97 delete windowName; 98 { 99 Frame* pKeyFrame; //!< The Frame for a new Key-setting. 100 101 pKeyFrame = new Frame(windowName); 102 { 103 Box* pKeysBox; //!< The Box that holds the Key-settings. 104 pKeysBox = new Box('v'); 105 { 106 Button* closeButton; //!< The CloseButton for this key-settings. 107 108 pKeysBox->setGroupName(player); 109 pKeysBox->fill(addKey(UP, "up")); 110 pKeysBox->fill(addKey(DOWN, "down")); 111 pKeysBox->fill(addKey(LEFT, "left")); 112 pKeysBox->fill(addKey(RIGHT, "right")); 113 pKeysBox->fill(addKey(SHOOT, "fire")); 114 closeButton = new Button("close"); 115 #ifdef HAVE_GTK2 116 closeButton->connectSignal("button_press_event", pKeyWindow, Window::windowClose); 117 #endif /* HAVE_GTK2 */ 118 119 pKeysBox->fill(closeButton); 120 } 121 pKeyFrame->fill(pKeysBox); 122 } 123 pKeyWindow->fill(pKeyFrame); 124 } 125 Window::addWindow(pKeyWindow); 126 #ifdef HAVE_GTK2 127 pKeyWindow->connectSignal("destroy", pKeyWindow, Window::windowClose); 128 pKeyWindow->connectSignal("delete_event", pKeyWindow, Window::windowClose); 129 #endif /* HAVE_GTK2 */ 130 107 131 this->openButton = new Button(player); 108 132 #ifdef HAVE_GTK2 109 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen);133 this->openButton->connectSignal("button_press_event", pKeyWindow, Window::windowOpen); 110 134 #endif /* HAVE_GTK2 */ 111 135 } -
orxonox/trunk/src/lib/gui/gui/gui_keys.h
r4086 r4088 28 28 }; 29 29 30 31 class Player;32 30 //! Class that creates the Keys-Options. 33 31 class GuiKeys : public GuiElement 34 32 { 35 private:36 Frame* keysFrame; //!< The Frame that holds the keyOptions.37 Box* keysBox; //!< The Frame that holds the keyOptions.38 Player* player1; //!< The first Player's keys.39 Player* player2; //!< The seconds Player's keys.40 Button* misc; //!< Other keyboeard options come here. \todo include some like pause, quit and so on.41 42 33 public: 43 34 GuiKeys(void); … … 47 38 static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed. 48 39 static long keySignal; //!< A keySignal that handles keyboard clicks. Static, because only one needed. 49 50 40 }; 51 41 52 42 //! Class to hold infos about a Player 53 /**54 \todo split into subclass and superclass ButtonConfigurator55 */56 43 class Player 57 44 { 58 45 private: 59 Window* pKeyWindow; //!< The Window for a new Key-setting.60 Frame* pKeyFrame; //!< The Frame for a new Key-setting.61 46 Button* openButton; //!< The OpenButton for this key-settings. 62 Button* closeButton; //!< The CloseButton for this key-settings.63 Box* pKeysBox; //!< The Box that holds the Key-settings.64 65 // InputKey* inputKey[10]; //!< Buttons-array. \todo make it dynamic.66 47 67 48 public:
Note: See TracChangeset
for help on using the changeset viewer.