Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 2736 in orxonox.OLD for orxonox/trunk


Ignore:
Timestamp:
Nov 6, 2004, 3:38:51 AM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: nicer, modularer, better, but not finished

Location:
orxonox/trunk/gui
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • orxonox/trunk/gui/orxonox_gui_keys.cc

    r2735 r2736  
    6262  keyWindow = new Window("keys of player");
    6363
    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);
    8471  windowIsOpen = false;
    8572
     73}
     74
     75Widget* 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];
    8686}
    8787
     
    131131  case GDK_Up:
    132132    printf("Up arrow key!\n");
     133    static_cast<Label*>(Widget)->setText("up");
    133134    break;
    134135  case GDK_Down:
  • orxonox/trunk/gui/orxonox_gui_keys.h

    r2735 r2736  
    2424
    2525
    26   Box* keyBox;
    27   Button* Keys[10];
     26  Box* keysBox;
     27 
     28  Box* keyBox[10];
     29  Button* keyButton[10];
     30  Label* keyLabel[10];
    2831
    2932
    3033 public:
    3134  Player(char* player);
     35
     36  Widget* addKey (KEYS key, char* name);
    3237
    3338  Button* getOpenButton();
Note: See TracChangeset for help on using the changeset viewer.