Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

IOConsole: Resolved flickering problem and moved status line below input line

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