1 | /*! |
---|
2 | \file gui_keys.h |
---|
3 | \brief File that holds the class that creates the Keyboard-Options. |
---|
4 | */ |
---|
5 | |
---|
6 | #ifndef _GUI_KEYS_H |
---|
7 | #define _GUI_KEYS_H |
---|
8 | |
---|
9 | #include "gui.h" |
---|
10 | #include "gui_element.h" |
---|
11 | #include "gui_gtk.h" |
---|
12 | |
---|
13 | #ifdef HAVE_GTK2 |
---|
14 | #include <gdk/gdkkeysyms.h> |
---|
15 | #endif /* HAVE_GTK2 */ |
---|
16 | |
---|
17 | /** |
---|
18 | \brief defines the Possible Player Keys |
---|
19 | */ |
---|
20 | enum KEYS {UP, DOWN, LEFT, RIGHT, SHOOT}; |
---|
21 | |
---|
22 | class Player; |
---|
23 | //! Class that creates the Keys-Options. |
---|
24 | class OrxonoxGuiKeys : public OrxonoxGuiElement |
---|
25 | { |
---|
26 | private: |
---|
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. |
---|
32 | |
---|
33 | public: |
---|
34 | OrxonoxGuiKeys(void); |
---|
35 | ~OrxonoxGuiKeys(void); |
---|
36 | }; |
---|
37 | |
---|
38 | //! Class to hold infos about a Player |
---|
39 | /** |
---|
40 | \todo split into subclass and superclass ButtonConfigurator |
---|
41 | */ |
---|
42 | class Player |
---|
43 | { |
---|
44 | private: |
---|
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. |
---|
50 | |
---|
51 | //! One KeyOption has one InputKey |
---|
52 | struct InputKey |
---|
53 | { |
---|
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. |
---|
57 | }; |
---|
58 | |
---|
59 | InputKey* inputKey[10]; //!< Buttons-array. \todo make it dynamic. |
---|
60 | |
---|
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. |
---|
64 | public: |
---|
65 | Player(char* player); |
---|
66 | |
---|
67 | Widget* addKey(KEYS key, char* name); |
---|
68 | |
---|
69 | Button* getOpenButton(void); |
---|
70 | |
---|
71 | #ifdef HAVE_GTK2 |
---|
72 | static gint inputWindowEvent(GtkWidget* w, GdkEventKey* event, void* widget); |
---|
73 | static gint key_cb(GtkWidget* w, GdkEventKey* event, void* inputKey); |
---|
74 | #endif /* HAVE_GTK2 */ |
---|
75 | void setkey(KEYS key); |
---|
76 | |
---|
77 | }; |
---|
78 | |
---|
79 | |
---|
80 | |
---|
81 | #endif /* _GUI_KEYS_H */ |
---|