Changeset 2736 in orxonox.OLD for orxonox/trunk
- Timestamp:
- Nov 6, 2004, 3:38:51 AM (20 years ago)
- Location:
- orxonox/trunk/gui
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
orxonox/trunk/gui/orxonox_gui_keys.cc
r2735 r2736 62 62 keyWindow = new Window("keys of player"); 63 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); 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); 84 71 windowIsOpen = false; 85 72 73 } 74 75 Widget* Player::addKey (KEYS key, char* name) 76 { 77 keyBox[key] = new Box(); 78 keyButton[key] = new Button(name); 79 keyLabel[key] = new Label ("test"); 80 81 keyButton[key]->connectSignal("key_press_event", keyLabel[key], key_cb); 82 83 keyBox[key]->fill(keyButton[key]); 84 keyBox[key]->fill(keyLabel[key]); 85 return keyBox[key]; 86 86 } 87 87 … … 131 131 case GDK_Up: 132 132 printf("Up arrow key!\n"); 133 static_cast<Label*>(Widget)->setText("up"); 133 134 break; 134 135 case GDK_Down: -
orxonox/trunk/gui/orxonox_gui_keys.h
r2735 r2736 24 24 25 25 26 Box* keyBox; 27 Button* Keys[10]; 26 Box* keysBox; 27 28 Box* keyBox[10]; 29 Button* keyButton[10]; 30 Label* keyLabel[10]; 28 31 29 32 30 33 public: 31 34 Player(char* player); 35 36 Widget* addKey (KEYS key, char* name); 32 37 33 38 Button* getOpenButton();
Note: See TracChangeset
for help on using the changeset viewer.