Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 3152 in orxonox.OLD


Ignore:
Timestamp:
Dec 11, 2004, 5:36:03 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: keys in the new Style

Location:
orxonox/trunk/gui
Files:
5 edited

Legend:

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

    r3147 r3152  
    5454int main( int argc, char *argv[] )
    5555{
    56   Window::lastWindow = NULL;
    5756  OrxonoxGui* orxonoxgui = new OrxonoxGui(argc, argv);
    5857  return 0;
  • orxonox/trunk/gui/orxonox_gui_gtk.cc

    r3148 r3152  
    277277}
    278278
    279 Window* Window::lastWindow = NULL;
    280 
    281279/**
    282280   \brief initializes a new Window
     
    286284  if (!mainWindow)
    287285    mainWindow = this;
    288 
     286 
    289287  isOpen = false;
    290288
     
    298296  gtk_container_set_border_width (GTK_CONTAINER (widget), 3);
    299297
    300   //  printf("%p\n",lastWindow);
    301 
    302   if (lastWindow !=NULL)
    303     {
    304       lastWindow->next = this;
    305       printf("%p, %p\n", lastWindow, this);
    306     }
    307   Window::lastWindow = this;
    308298}
    309299
  • orxonox/trunk/gui/orxonox_gui_gtk.h

    r3148 r3152  
    9292  static void addWindow(Window* windowToAdd);
    9393
    94   static Window* lastWindow;
    9594  Window (void);
    9695  Window (char* windowName);
  • orxonox/trunk/gui/orxonox_gui_keys.cc

    r3147 r3152  
    6060  openButton->connectSignal("button_press_event", this, openWindowEvent);
    6161
    62   keyWindow = new Window("keys of player");
    63 
    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);
    71   windowIsOpen = false;
    72 
     62  pKeyWindow = new Window("keys of player");
     63   pKeysBox = new Box('v');
     64    pKeysBox->fill(addKey(UP, "up"));
     65    pKeysBox->fill(addKey(DOWN, "down"));
     66    pKeysBox->fill(addKey(LEFT, "left"));
     67    pKeysBox->fill(addKey(RIGHT, "right"));
     68    pKeysBox->fill(addKey(SHOOT, "shoot"));
     69   
     70    closeButton = new Button("close");
     71    closeButton->connectSignal("button_press_event", this, closeWindowEvent);
     72    pKeysBox->fill(closeButton);
     73   pKeyWindow->fill(pKeysBox);
     74   //  Window::addWindow(pKeyWindow);
    7375}
    7476
    7577Widget* Player::addKey (KEYS key, char* name)
    7678{
    77   keyBox[key] = new Box();
    78   keyLabel[key] = new Label (name);
    79   keyButton[key] = new Button(name);
    80   keyButton[key]->saveable;
     79  pKeyBox[key] = new Box();
     80  pKeyLabel[key] = new Label (name);
     81  pKeyButton[key] = new Button(name);
     82  pKeyButton[key]->saveable = true;
    8183 
    82   keyButton[key]->connectSignal("key_press_event", keyButton[key], key_cb);
     84  pKeyButton[key]->connectSignal("key_press_event", pKeyButton[key], key_cb);
    8385 
    84   keyBox[key]->fill(keyLabel[key]);
    85   keyBox[key]->fill(keyButton[key]);
    86   return keyBox[key];
     86  pKeyBox[key]->fill(pKeyLabel[key]);
     87  pKeyBox[key]->fill(pKeyButton[key]);
     88  return pKeyBox[key];
    8789}
    8890
     
    9698{
    9799  cout << "setting up Key: "<< key <<endl;
    98 
    99 }
    100 
    101 /**
    102    \brief function to display, hide the palyer window
    103    Buggy, segmentation fault on WindowMaker
    104 */
    105 void Player::openWindow ()
    106 {
    107   if (!windowIsOpen)
    108     keyWindow->showall();
    109   else
    110     keyWindow->hide();
    111   windowIsOpen = !windowIsOpen;
    112100}
    113101
    114102gint Player::openWindowEvent (GtkWidget* widget, GdkEvent* event, void* player)
    115103{
    116 
    117   static_cast<Player*>(player)->openWindow();
    118 }
    119 
     104  static_cast<Player*>(player)->pKeyWindow->open();
     105}
     106
     107gint Player::closeWindowEvent (GtkWidget* widget, GdkEvent* event, void* player)
     108{
     109  static_cast<Player*>(player)->pKeyWindow->close();
     110}
    120111
    121112/**
  • orxonox/trunk/gui/orxonox_gui_keys.h

    r2737 r3152  
    1515enum KEYS { UP, DOWN, LEFT, RIGHT, SHOOT };
    1616
    17 //! Class to hold infos about a Player
    18 class Player
    19 {
    20  private:
    21   Window* keyWindow;
    22   bool windowIsOpen;
    23   Button* openButton;
    24 
    25 
    26   Box* keysBox;
    27  
    28   Box* keyBox[10];
    29   Button* keyButton[10];
    30   Label* keyLabel[10];
    31 
    32 
    33  public:
    34   Player(char* player);
    35 
    36   Widget* addKey (KEYS key, char* name);
    37 
    38   Button* getOpenButton();
    39  
    40   void openWindow ();
    41 
    42   static gint openWindowEvent(GtkWidget* widget, GdkEvent* event, void* player);
    43   static gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget);
    44   void setkey(KEYS key);
    45  
    46 };
    47 
     17class Player;
    4818//! Class that creates the Keys-Options.
    4919class OrxonoxGuiKeys
     
    6333};
    6434
     35//! Class to hold infos about a Player
     36class Player
     37{
     38 private:
     39  Window* pKeyWindow;
     40  Button* openButton;
     41  Button* closeButton;
     42  Box* pKeysBox;
     43 
     44  Box* pKeyBox[10];
     45  Button* pKeyButton[10];
     46  Label* pKeyLabel[10];
     47
     48
     49 public:
     50  Player(char* player);
     51
     52  Widget* addKey (KEYS key, char* name);
     53
     54  Button* getOpenButton();
     55
     56  static gint openWindowEvent(GtkWidget* widget, GdkEvent* event, void* player);
     57  static gint closeWindowEvent(GtkWidget* widget, GdkEvent* event, void* player);
     58  static gint key_cb(GtkWidget* w, GdkEventKey* event, void* widget);
     59  void setkey(KEYS key);
     60 
     61};
    6562
    6663
Note: See TracChangeset for help on using the changeset viewer.