Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

Last change on this file since 6011 was 6010, checked in by rgrieder, 15 years ago

Sorted out some small stuff in the Shell and hopefully fixed IOConsole problems (flickering and too much output).

  • Property svn:eol-style set to native
File size: 2.4 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
56        void setTerminalMode();
57        void resetTerminalMode();
58        int getTerminalSize(int* x, int* y);
59
60        void printLogText(const std::string& line);
61        void printInputLine();
62        void printStatusLines();
63
64        // Methods from ShellListener
65        void linesChanged();
66        void onlyLastLineChanged();
67        void lineAdded();
68        void inputChanged();
69        void cursorChanged();
70        void executed();
71        void exit();
72        Shell*                  shell_;
73        InputBuffer*            buffer_;
74        termios*                originalTerminalSettings_;
75        bool                    bPrintStatusLine_;
76        bool                    bStatusPrinted_;
77        std::vector<unsigned>   statusLineWidths_;
78        unsigned int            statusLineMaxWidth_;
79        const std::string       promptString_;
80        static const unsigned   minOutputLines_ = 3;
81
82        static IOConsole* singletonPtr_s;
83    };
84}
85
86#endif /* _IOConsole_H__ */
Note: See TracBrowser for help on using the repository browser.