[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 | |
---|
[5693] | 32 | #include "gamestates/GameStatesPrereqs.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 | { |
---|
[5693] | 46 | |
---|
| 47 | class _GameStatesExport 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(); |
---|
[5693] | 63 | |
---|
[3198] | 64 | void insertCharacter( unsigned int position, char c ); |
---|
| 65 | void deleteCharacter( unsigned int position ); |
---|
[5693] | 66 | |
---|
[3198] | 67 | Server* server_; |
---|
[5693] | 68 | |
---|
[3198] | 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_; |
---|
[5693] | 78 | |
---|
[3198] | 79 | unsigned int cursorX_; |
---|
| 80 | unsigned int cursorY_; |
---|
[1694] | 81 | }; |
---|
| 82 | } |
---|
| 83 | |
---|
| 84 | #endif /* _GSDedicated_H__ */ |
---|