[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: |
---|
[5975] | 55 | |
---|
[5971] | 56 | void setTerminalMode(); |
---|
| 57 | static void resetTerminalMode(); |
---|
[5995] | 58 | int getTerminalSize(int* x, int* y); |
---|
[5971] | 59 | |
---|
[5998] | 60 | void printLogText(const std::string& line); |
---|
[5971] | 61 | void printInputLine(); |
---|
[5995] | 62 | void printStatusLines(); |
---|
[5971] | 63 | |
---|
| 64 | // Methods from ShellListener |
---|
| 65 | void linesChanged(); |
---|
| 66 | void onlyLastLineChanged(); |
---|
| 67 | void lineAdded(); |
---|
| 68 | void inputChanged(); |
---|
| 69 | void cursorChanged(); |
---|
[5983] | 70 | void executed(); |
---|
[5971] | 71 | void exit(); |
---|
| 72 | Shell& shell_; |
---|
| 73 | InputBuffer* buffer_; |
---|
| 74 | static termios* originalTerminalSettings_; |
---|
[5995] | 75 | bool bPrintStatusLine_; |
---|
| 76 | bool bStatusPrinted_; |
---|
| 77 | std::vector<unsigned> statusLineWidths_; |
---|
[5971] | 78 | |
---|
| 79 | static IOConsole* singletonPtr_s; |
---|
| 80 | }; |
---|
| 81 | } |
---|
| 82 | |
---|
| 83 | #endif /* _IOConsole_H__ */ |
---|