Changeset 3423 in orxonox.OLD for orxonox/trunk/src/gui/orxonox_gui_keys.cc
- Timestamp:
- Feb 27, 2005, 7:11:19 PM (19 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/src/gui/orxonox_gui_keys.cc
r3187 r3423 29 29 \brief Creates an Keyboard-Frame 30 30 */ 31 OrxonoxGuiKeys::OrxonoxGuiKeys ()32 { 33 keysFrame = new Frame("Keyboard-Options:");31 OrxonoxGuiKeys::OrxonoxGuiKeys(void) 32 { 33 this->keysFrame = new Frame("Keyboard-Options:"); 34 34 // keysFrame->setGroupName("Keyboard"); 35 keysBox = new Box ('h'); 36 player1 = new Player("player1"); 37 player2 = new Player("player2"); 38 39 keysBox->fill(player1->getOpenButton()); 40 keysBox->fill(player2->getOpenButton()); 41 42 keysFrame->fill (keysBox); 35 this->keysBox = new Box('h'); 36 this->player1 = new Player("player1"); 37 this->player2 = new Player("player2"); 38 39 this->keysBox->fill(this->player1->getOpenButton()); 40 this->keysBox->fill(this->player2->getOpenButton()); 41 42 this->keysFrame->fill(this->keysBox); 43 } 44 45 /** 46 \brief Destructs the Keys-stuff 47 */ 48 OrxonoxGuiKeys::~OrxonoxGuiKeys(void) 49 { 50 // nothing to do here. 43 51 } 44 52 … … 47 55 \return Returns the Audio-frame 48 56 */ 49 Widget* OrxonoxGuiKeys::getWidget ()50 { 51 return keysFrame;57 Widget* OrxonoxGuiKeys::getWidget(void) 58 { 59 return this->keysFrame; 52 60 } 53 61 … … 60 68 Player::Player(char* player) 61 69 { 62 char windowName[100] = "Keyboard settings of "; 63 strcat (windowName, player); 64 pKeyWindow = new Window(windowName); 65 pKeyFrame = new Frame (windowName); 66 pKeysBox = new Box('v'); 67 pKeysBox->setGroupName (player); 68 pKeysBox->fill(addKey(UP, "up")); 69 pKeysBox->fill(addKey(DOWN, "down")); 70 pKeysBox->fill(addKey(LEFT, "left")); 71 pKeysBox->fill(addKey(RIGHT, "right")); 72 pKeysBox->fill(addKey(SHOOT, "shoot")); 73 70 char* windowName = new char[strlen(player)+25]; 71 strcpy(windowName, "Keyboard settings of "); 72 strcat(windowName, player); 73 this->pKeyWindow = new Window(windowName); 74 this->pKeyFrame = new Frame(windowName); 75 this->pKeysBox = new Box('v'); 76 this->pKeysBox->setGroupName(player); 77 this->pKeysBox->fill(addKey(UP, "up")); 78 this->pKeysBox->fill(addKey(DOWN, "down")); 79 this->pKeysBox->fill(addKey(LEFT, "left")); 80 this->pKeysBox->fill(addKey(RIGHT, "right")); 81 this->pKeysBox->fill(addKey(SHOOT, "shoot")); 82 delete windowName; 74 83 closeButton = new Button("close"); 75 84 #ifdef HAVE_GTK2 76 closeButton->connectSignal("button_press_event",pKeyWindow, Window::windowClose);77 #endif /* HAVE_GTK2 */ 78 79 pKeysBox->fill(closeButton);80 pKeyFrame->fill(pKeysBox);81 pKeyWindow->fill(pKeyFrame);82 Window::addWindow( pKeyWindow);83 #ifdef HAVE_GTK2 84 pKeyWindow->connectSignal("destroy",pKeyWindow, Window::windowClose);85 pKeyWindow->connectSignal("delete_event",pKeyWindow, Window::windowClose);86 #endif /* HAVE_GTK2 */ 87 88 openButton = new Button(player);89 #ifdef HAVE_GTK2 90 openButton->connectSignal("button_press_event",pKeyWindow, Window::windowOpen);91 #endif /* HAVE_GTK2 */ 92 93 inputWindow = new Window("inputWindow");94 95 inputButton = new Button("test");96 inputWindow->fill(inputButton);97 #ifdef HAVE_GTK2 98 inputWindow->connectSignal("destroy", Widget::doNothingSignal);99 inputWindow->connectSignal("delete_event", Widget::doNothingSignal);85 this->closeButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowClose); 86 #endif /* HAVE_GTK2 */ 87 88 this->pKeysBox->fill(this->closeButton); 89 this->pKeyFrame->fill(this->pKeysBox); 90 this->pKeyWindow->fill(this->pKeyFrame); 91 Window::addWindow(this->pKeyWindow); 92 #ifdef HAVE_GTK2 93 this->pKeyWindow->connectSignal("destroy", this->pKeyWindow, Window::windowClose); 94 this->pKeyWindow->connectSignal("delete_event", this->pKeyWindow, Window::windowClose); 95 #endif /* HAVE_GTK2 */ 96 97 this->openButton = new Button(player); 98 #ifdef HAVE_GTK2 99 this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen); 100 #endif /* HAVE_GTK2 */ 101 102 this->inputWindow = new Window("inputWindow"); 103 104 this->inputButton = new Button("test"); 105 this->inputWindow->fill(inputButton); 106 #ifdef HAVE_GTK2 107 this->inputWindow->connectSignal("destroy", Widget::doNothingSignal); 108 this->inputWindow->connectSignal("delete_event", Widget::doNothingSignal); 100 109 #endif /* HAVE_GTK2 */ 101 110 … … 108 117 \returns A widget that has the Key-Box 109 118 */ 110 Widget* Player::addKey 111 { 112 inputKey[key] = new InputKey;113 inputKey[key]->pKeyBox = new Box();114 inputKey[key]->pKeyButton = new Button(name);115 inputKey[key]->pKeyOLabel = new OptionLabel(name, name);116 inputKey[key]->pKeyOLabel->saveable = true;119 Widget* Player::addKey(KEYS key, char* name) 120 { 121 this->inputKey[key] = new InputKey; 122 this->inputKey[key]->pKeyBox = new Box(); 123 this->inputKey[key]->pKeyButton = new Button(name); 124 this->inputKey[key]->pKeyOLabel = new OptionLabel(name, name); 125 this->inputKey[key]->pKeyOLabel->saveability(); 117 126 118 127 #ifdef HAVE_GTK2 119 128 //inputKey[key]->pKeyButton->connectSignal("key_press_event", inputKey[key]->pKeyButton, key_cb); 120 inputKey[key]->pKeyButton->connectSignal("button_press_event",inputKey[key], inputWindowEvent);121 #endif /* HAVE_GTK2 */ 122 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyButton);123 inputKey[key]->pKeyBox->fill(inputKey[key]->pKeyOLabel);124 return inputKey[key]->pKeyBox;129 this->inputKey[key]->pKeyButton->connectSignal("button_press_event", this->inputKey[key], inputWindowEvent); 130 #endif /* HAVE_GTK2 */ 131 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyButton); 132 this->inputKey[key]->pKeyBox->fill(this->inputKey[key]->pKeyOLabel); 133 return this->inputKey[key]->pKeyBox; 125 134 } 126 135 … … 128 137 \returns the OpenButton of a Player 129 138 */ 130 Button* Player::getOpenButton( )131 { 132 return openButton;133 } 134 135 /** 136 \brief sets a new Key 139 Button* Player::getOpenButton(void) 140 { 141 return this->openButton; 142 } 143 144 /** 145 \brief sets a new Key(only output) 137 146 \param key the new Key. 138 147 */ … … 163 172 gint Player::key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey) 164 173 { 165 InputKey* inputkey = 174 InputKey* inputkey =(InputKey*) inputKey; 166 175 char title [20]; 167 176 … … 256 265 char* tmp; 257 266 sprintf(tmp, "%c", event->keyval); 258 printf 267 printf("other key %s \n", tmp); 259 268 strcpy(title, tmp); 260 269 break; 261 270 } 262 271 263 inputkey->pKeyOLabel->setValue 272 inputkey->pKeyOLabel->setValue(title); 264 273 inputButton->disconnectSignal(keySignal); 265 274 inputWindow->close();
Note: See TracChangeset
for help on using the changeset viewer.