[5971] | 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: |
---|
[5968] | 23 | * Oliver Scheuss |
---|
| 24 | * Reto Grieder |
---|
[5971] | 25 | * Co-authors: |
---|
| 26 | * ... |
---|
| 27 | * |
---|
| 28 | */ |
---|
| 29 | |
---|
| 30 | #ifndef _IOConsole_H__ |
---|
| 31 | #define _IOConsole_H__ |
---|
| 32 | |
---|
| 33 | #include "CorePrereqs.h" |
---|
| 34 | |
---|
| 35 | #include <queue> |
---|
| 36 | #include <boost/scoped_ptr.hpp> |
---|
| 37 | #include "util/Singleton.h" |
---|
| 38 | #include "core/Shell.h" |
---|
| 39 | |
---|
| 40 | struct termios; |
---|
| 41 | |
---|
| 42 | namespace orxonox |
---|
| 43 | { |
---|
| 44 | class _CoreExport IOConsole : public Singleton<IOConsole>, public ShellListener |
---|
| 45 | { |
---|
| 46 | friend class Singleton<IOConsole>; |
---|
| 47 | |
---|
| 48 | public: |
---|
| 49 | IOConsole(); |
---|
| 50 | ~IOConsole(); |
---|
| 51 | |
---|
| 52 | void update(const Clock& time); |
---|
| 53 | |
---|
| 54 | private: |
---|
| 55 | void setTerminalMode(); |
---|
| 56 | static void resetTerminalMode(); |
---|
| 57 | |
---|
| 58 | void printOutputLine(const std::string& line); |
---|
| 59 | void printInputLine(); |
---|
| 60 | |
---|
| 61 | // Methods from ShellListener |
---|
| 62 | void linesChanged(); |
---|
| 63 | void onlyLastLineChanged(); |
---|
| 64 | void lineAdded(); |
---|
| 65 | void inputChanged(); |
---|
| 66 | void cursorChanged(); |
---|
| 67 | void exit(); |
---|
| 68 | |
---|
| 69 | Shell& shell_; |
---|
| 70 | bool bEscapeMode_; |
---|
| 71 | std::string escapeSequence_; |
---|
| 72 | InputBuffer* buffer_; |
---|
| 73 | static termios* originalTerminalSettings_; |
---|
| 74 | |
---|
| 75 | static IOConsole* singletonPtr_s; |
---|
| 76 | }; |
---|
| 77 | } |
---|
| 78 | |
---|
| 79 | #endif /* _IOConsole_H__ */ |
---|