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