[2613] | 1 | /*! |
---|
| 2 | \file orxonox_gui_keys.h |
---|
| 3 | \brief File that holds the class that creates the Keyboard-Options. |
---|
| 4 | */ |
---|
| 5 | |
---|
| 6 | #ifndef _ORXONOX_GUI_KEYS_H |
---|
| 7 | #define _ORXONOX_GUI_KEYS_H |
---|
| 8 | |
---|
| 9 | #include "orxonox_gui.h" |
---|
[3165] | 10 | #ifdef HAVE_GTK2 |
---|
[2733] | 11 | #include <gdk/gdkkeysyms.h> |
---|
[3165] | 12 | #endif /* HAVE_GTK2 */ |
---|
[3187] | 13 | |
---|
[2613] | 14 | /** |
---|
[3187] | 15 | \brief defines the Possible Player Keys |
---|
| 16 | */ |
---|
[3315] | 17 | enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT}; |
---|
[2613] | 18 | |
---|
[3152] | 19 | class Player; |
---|
| 20 | //! Class that creates the Keys-Options. |
---|
| 21 | class OrxonoxGuiKeys |
---|
| 22 | { |
---|
| 23 | private: |
---|
[3187] | 24 | Frame* keysFrame; //!< The Frame that holds the keyOptions. |
---|
| 25 | Box* keysBox; //!< The Frame that holds the keyOptions. |
---|
| 26 | Player* player1; //!< The first Player's keys. |
---|
| 27 | Player* player2; //!< The seconds Player's keys. |
---|
| 28 | Button* misc; //!< Other keyboeard options come here. \todo include some like pause, quit and so on. |
---|
[3152] | 29 | |
---|
| 30 | public: |
---|
[3315] | 31 | OrxonoxGuiKeys(void); |
---|
| 32 | ~OrxonoxGuiKeys(void); |
---|
[3152] | 33 | |
---|
[3315] | 34 | Widget* getWidget(void); |
---|
[3152] | 35 | }; |
---|
| 36 | |
---|
[2735] | 37 | //! Class to hold infos about a Player |
---|
[3187] | 38 | /** |
---|
| 39 | \todo split into subclass and superclass ButtonConfigurator |
---|
| 40 | */ |
---|
[2613] | 41 | class Player |
---|
| 42 | { |
---|
| 43 | private: |
---|
[3187] | 44 | Window* pKeyWindow; //!< The Window for a new Key-setting. |
---|
| 45 | Frame* pKeyFrame; //!< The Frame for a new Key-setting. |
---|
| 46 | Button* openButton; //!< The OpenButton for this key-settings. |
---|
| 47 | Button* closeButton; //!< The CloseButton for this key-settings. |
---|
| 48 | Box* pKeysBox; //!< The Box that holds the Key-settings. |
---|
[2736] | 49 | |
---|
[3187] | 50 | //! One KeyOption has one InputKey |
---|
[3156] | 51 | struct InputKey |
---|
| 52 | { |
---|
[3187] | 53 | Box* pKeyBox; //!< One Box that holds the Keys |
---|
| 54 | Button* pKeyButton; //!< The Button for changing the Key. |
---|
| 55 | OptionLabel* pKeyOLabel;//!< The Label for displaying the Key-setting. |
---|
[3156] | 56 | }; |
---|
[2735] | 57 | |
---|
[3187] | 58 | InputKey* inputKey[10]; //!< Buttons-array. \todo make it dynamic. |
---|
[2735] | 59 | |
---|
[3187] | 60 | static Window* inputWindow; //!< A Window that gets keyboard clicks. Static, because only one needed. |
---|
| 61 | static Button* inputButton; //!< A Button that gets keyboard clicks. Static, because only one needed. |
---|
| 62 | static long keySignal; //!< A keySignal that handles keyboard clicks. Static, because only one needed. |
---|
[2613] | 63 | public: |
---|
| 64 | Player(char* player); |
---|
| 65 | |
---|
[3315] | 66 | Widget* addKey(KEYS key, char* name); |
---|
[2736] | 67 | |
---|
[3315] | 68 | Button* getOpenButton(void); |
---|
[2613] | 69 | |
---|
[3165] | 70 | #ifdef HAVE_GTK2 |
---|
[3156] | 71 | static gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget); |
---|
| 72 | static gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey); |
---|
[3165] | 73 | #endif /* HAVE_GTK2 */ |
---|
[2613] | 74 | void setkey(KEYS key); |
---|
| 75 | |
---|
| 76 | }; |
---|
| 77 | |
---|
| 78 | |
---|
| 79 | |
---|
| 80 | #endif /* _ORXONOX_GUI_KEYS_H */ |
---|