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