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