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 | |
---|
39 | /* project includes */ |
---|
40 | #include <OrxonoxPrereqs.h> |
---|
41 | #include <core/BaseObject.h> |
---|
42 | #include <core/PathConfig.h> |
---|
43 | |
---|
44 | #include "core/input/InputBuffer.h" |
---|
45 | #include "core/input/InputManager.h" |
---|
46 | #include "core/input/InputState.h" |
---|
47 | |
---|
48 | #include "../libraries/network/Host.h" |
---|
49 | #include <util/Singleton.h> |
---|
50 | |
---|
51 | |
---|
52 | namespace orxonox |
---|
53 | { |
---|
54 | /* class to handle chat using an InputBuffer */ |
---|
55 | class _OrxonoxExport ChatInputHandler : public Singleton<ChatInputHandler>, |
---|
56 | public OrxonoxClass |
---|
57 | { |
---|
58 | private: |
---|
59 | /** Input buffer, to be used to catch input from the |
---|
60 | * keyboard |
---|
61 | */ |
---|
62 | InputBuffer *inpbuf; |
---|
63 | |
---|
64 | /** input state */ |
---|
65 | InputState *inputState; |
---|
66 | |
---|
67 | /** setup input buffer, the constructor calls this */ |
---|
68 | void configureInputBuffer(); |
---|
69 | |
---|
70 | /* singleton pointer */ |
---|
71 | static ChatInputHandler* singletonPtr_s; |
---|
72 | |
---|
73 | public: |
---|
74 | /** constructor */ |
---|
75 | ChatInputHandler(); |
---|
76 | friend class Singleton<ChatInputHandler>; |
---|
77 | |
---|
78 | /* start listening, stop listening */ |
---|
79 | static void activate_static(); |
---|
80 | void activate(); |
---|
81 | void deactivate(); |
---|
82 | |
---|
83 | /* callbacks for input handler */ |
---|
84 | |
---|
85 | void inputChanged(); |
---|
86 | void addline(); |
---|
87 | void backspace(); |
---|
88 | void deleteChar(); |
---|
89 | void cursorRight(); |
---|
90 | void cursorLeft(); |
---|
91 | void cursorEnd(); |
---|
92 | void cursorHome(); |
---|
93 | void exit(); |
---|
94 | }; |
---|
95 | |
---|
96 | |
---|
97 | } |
---|
98 | |
---|
99 | |
---|
100 | #endif /*_ChatInputHandler_H__*/ |
---|