Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 4088 in orxonox.OLD for orxonox/trunk/src/lib/gui


Ignore:
Timestamp:
May 6, 2005, 5:02:14 PM (20 years ago)
Author:
bensch
Message:

orxonox/trunk/gui: cleanup

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  
    3333GuiKeys::GuiKeys(void)
    3434{
    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.
    4758  this->inputWindow = new Window("inputWindow");
    4859  this->inputButton = new Button("test");
     
    5263#endif /* HAVE_GTK2 */
    5364  this->inputWindow->fill(inputButton);
    54 
     65 
    5566  this->setMainWidget(keysFrame);
    5667}
     
    7889Player::Player(char* player)
    7990{
    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: ");
    8295  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 
    107131  this->openButton = new Button(player);
    108132#ifdef HAVE_GTK2
    109   this->openButton->connectSignal("button_press_event", this->pKeyWindow, Window::windowOpen);
     133  this->openButton->connectSignal("button_press_event", pKeyWindow, Window::windowOpen);
    110134#endif /* HAVE_GTK2 */
    111135}
  • orxonox/trunk/src/lib/gui/gui/gui_keys.h

    r4086 r4088  
    2828};
    2929
    30 
    31 class Player;
    3230//! Class that creates the Keys-Options.
    3331class GuiKeys : public GuiElement
    3432{
    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 
    4233 public:
    4334  GuiKeys(void);
     
    4738  static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed.
    4839  static long keySignal;      //!< A keySignal that handles keyboard clicks. Static, because only one needed.
    49 
    5040};
    5141
    5242//! Class to hold infos about a Player
    53 /**
    54    \todo split into subclass and superclass ButtonConfigurator
    55 */
    5643class Player
    5744{
    5845 private:
    59   Window* pKeyWindow;     //!< The Window for a new Key-setting.
    60   Frame* pKeyFrame;       //!< The Frame for a new Key-setting.
    6146  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.
    6647
    6748 public:
Note: See TracChangeset for help on using the changeset viewer.