Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/console/src/libraries/core/IOConsole.h @ 5969

Last change on this file since 5969 was 5968, checked in by rgrieder, 16 years ago

Basic construct of an IOConsole for Unix, using Oli's console from GSDedicated.
MAY NOT COMPILE, PROBABLY DOESN'T RUN!
And surely does neither on Windows.

File size: 2.5 KB
Line 
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 *      Oliver Scheuss
24 *      Reto Grieder
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
40struct termios;
41
42namespace 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        void insertCharacter(unsigned int position, char c);
61        void deleteCharacter(unsigned int position);
62
63        // Methods from ShellListener
64        void linesChanged();
65        void onlyLastLineChanged();
66        void lineAdded();
67        void inputChanged();
68        void cursorChanged();
69        void exit();
70
71        Shell&                  shell_;
72        bool                    cleanLine_;
73        bool                    bEscapeMode_;
74        std::string             escapeSequence_;
75        InputBuffer*            buffer_;
76        unsigned char*          commandLine_;
77        unsigned int            inputIterator_;
78        static termios*         originalTerminalSettings_;
79
80        unsigned int            cursorX_;
81        unsigned int            cursorY_;
82
83        static IOConsole* singletonPtr_s;
84    };
85}
86
87#endif /* _IOConsole_H__ */
Note: See TracBrowser for help on using the repository browser.