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 | * Reto Grieder |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #ifndef _GSDedicated_H__ |
---|
30 | #define _GSDedicated_H__ |
---|
31 | |
---|
32 | #include "OrxonoxPrereqs.h" |
---|
33 | |
---|
34 | #include <cstring> |
---|
35 | #include <queue> |
---|
36 | #include <boost/thread/thread.hpp> |
---|
37 | #include <boost/thread/mutex.hpp> |
---|
38 | #include <boost/thread/recursive_mutex.hpp> |
---|
39 | |
---|
40 | #include "core/GameState.h" |
---|
41 | #include "network/NetworkPrereqs.h" |
---|
42 | |
---|
43 | struct termios; |
---|
44 | |
---|
45 | namespace orxonox |
---|
46 | { |
---|
47 | |
---|
48 | class _OrxonoxExport GSDedicated : public GameState |
---|
49 | { |
---|
50 | public: |
---|
51 | GSDedicated(const GameStateInfo& info); |
---|
52 | ~GSDedicated(); |
---|
53 | |
---|
54 | void activate(); |
---|
55 | void deactivate(); |
---|
56 | void update(const Clock& time); |
---|
57 | |
---|
58 | private: |
---|
59 | void inputThread(); |
---|
60 | void printLine(); |
---|
61 | void processQueue(); |
---|
62 | void setTerminalMode(); |
---|
63 | static void resetTerminalMode(); |
---|
64 | |
---|
65 | void insertCharacter( unsigned int position, char c ); |
---|
66 | void deleteCharacter( unsigned int position ); |
---|
67 | |
---|
68 | Server* server_; |
---|
69 | |
---|
70 | boost::thread *inputThread_; |
---|
71 | boost::recursive_mutex inputLineMutex_; |
---|
72 | boost::recursive_mutex inputQueueMutex_; |
---|
73 | bool closeThread_; |
---|
74 | bool cleanLine_; |
---|
75 | unsigned char* commandLine_; |
---|
76 | unsigned int inputIterator_; |
---|
77 | std::queue<std::string> commandQueue_; |
---|
78 | static termios* originalTerminalSettings_; |
---|
79 | |
---|
80 | unsigned int cursorX_; |
---|
81 | unsigned int cursorY_; |
---|
82 | }; |
---|
83 | } |
---|
84 | |
---|
85 | #endif /* _GSDedicated_H__ */ |
---|