1 | /* |
---|
2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
3 | * > www.orxonox.net < |
---|
4 | * |
---|
5 | * |
---|
6 | * License notice: |
---|
7 | * |
---|
8 | * This program is free software; you can redistribute it and/or |
---|
9 | * modify it under the terms of the GNU General Public License |
---|
10 | * as published by the Free Software Foundation; either version 2 |
---|
11 | * of the License, or (at your option) any later version. |
---|
12 | * |
---|
13 | * This program is distributed in the hope that it will be useful, |
---|
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
16 | * GNU General Public License for more details. |
---|
17 | * |
---|
18 | * You should have received a copy of the GNU General Public License |
---|
19 | * along with this program; if not, write to the Free Software |
---|
20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
---|
21 | * |
---|
22 | * Author: |
---|
23 | * Sandro 'smerkli' Merkli |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _ChatInputHandler_H__ |
---|
30 | #define _ChatInputHandler_H__ |
---|
31 | |
---|
32 | /* std includes */ |
---|
33 | #include <deque> |
---|
34 | #include <string> |
---|
35 | #include <fstream> |
---|
36 | #include <iostream> |
---|
37 | #include <cassert> |
---|
38 | #include <CEGUIForwardRefs.h> |
---|
39 | |
---|
40 | /* project includes */ |
---|
41 | #include <OrxonoxPrereqs.h> |
---|
42 | #include <core/BaseObject.h> |
---|
43 | #include <core/PathConfig.h> |
---|
44 | |
---|
45 | #include "core/input/InputBuffer.h" |
---|
46 | #include "core/input/InputManager.h" |
---|
47 | #include "core/input/InputState.h" |
---|
48 | |
---|
49 | #include "../libraries/network/Host.h" |
---|
50 | #include <util/Singleton.h> |
---|
51 | |
---|
52 | |
---|
53 | namespace orxonox |
---|
54 | { |
---|
55 | /* class to handle chat using an InputBuffer */ |
---|
56 | class _OrxonoxExport ChatInputHandler : public Singleton<ChatInputHandler>, |
---|
57 | public OrxonoxClass |
---|
58 | { |
---|
59 | private: |
---|
60 | /** Input buffer, to be used to catch input from the |
---|
61 | * keyboard |
---|
62 | */ |
---|
63 | InputBuffer *inpbuf; |
---|
64 | |
---|
65 | /** input state */ |
---|
66 | InputState *inputState; |
---|
67 | |
---|
68 | /** setup input buffer, the constructor calls this */ |
---|
69 | void configureInputBuffer(); |
---|
70 | |
---|
71 | /* singleton pointer */ |
---|
72 | static ChatInputHandler* singletonPtr_s; |
---|
73 | |
---|
74 | /* cegui stuff */ |
---|
75 | CEGUI::Window *input; |
---|
76 | CEGUI::Listbox *lb_history; |
---|
77 | |
---|
78 | public: |
---|
79 | /** constructor */ |
---|
80 | ChatInputHandler(); |
---|
81 | friend class Singleton<ChatInputHandler>; |
---|
82 | |
---|
83 | /* start listening, stop listening */ |
---|
84 | static void activate_static(); |
---|
85 | void activate(); |
---|
86 | void deactivate(); |
---|
87 | |
---|
88 | /* callbacks for input handler */ |
---|
89 | void inputChanged(); |
---|
90 | void addline(); |
---|
91 | void backspace(); |
---|
92 | void deleteChar(); |
---|
93 | void cursorRight(); |
---|
94 | void cursorLeft(); |
---|
95 | void cursorEnd(); |
---|
96 | void cursorHome(); |
---|
97 | void exit(); |
---|
98 | }; |
---|
99 | |
---|
100 | |
---|
101 | } |
---|
102 | |
---|
103 | |
---|
104 | #endif /*_ChatInputHandler_H__*/ |
---|