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