Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/libraries/core/IOConsole.h @ 6692

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

Merged presentation2 branch back to trunk.
Major new features:

  • Actual GUI with settings, etc.
  • Improved space ship steering (human interaction)
  • Rocket fire and more particle effects
  • Advanced sound framework
  • Property svn:eol-style set to native
File size: 3.9 KB
RevLine 
[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
[6037]35#include <sstream>
[6015]36#include <string>
37#include <vector>
[5971]38#include "util/Singleton.h"
39#include "core/Shell.h"
40
[6015]41#ifdef ORXONOX_PLATFORM_UNIX
[5971]42struct termios;
[6417]43#elif defined(ORXONOX_PLATFORM_WINDOWS)
44#define WIN32_LEAN_AND_MEAN
45#ifndef NOMINMAX
46#define NOMINMAX
[6015]47#endif
[6417]48#include <windows.h>
49#endif
[5971]50
51namespace orxonox
52{
53    class _CoreExport IOConsole : public Singleton<IOConsole>, public ShellListener
54    {
55        friend class Singleton<IOConsole>;
56
57    public:
58        IOConsole();
59        ~IOConsole();
60
[6417]61        void preUpdate(const Clock& time);
[5971]62
63    private:
64        void setTerminalMode();
[6013]65        void getTerminalSize();
[5995]66        void printStatusLines();
[6417]67        static int extractLogLevel(std::string* text);
[5971]68
69        // Methods from ShellListener
70        void linesChanged();
71        void onlyLastLineChanged();
72        void lineAdded();
73        void inputChanged();
74        void cursorChanged();
[5983]75        void executed();
[5971]76        void exit();
[6417]77
[6004]78        Shell*                  shell_;
[5971]79        InputBuffer*            buffer_;
[6037]80        std::ostream            cout_;
81        std::ostringstream      origCout_;
[6417]82        int                     terminalWidth_;
83        int                     terminalHeight_;
84        int                     lastTerminalWidth_;
85        int                     lastTerminalHeight_;
[6010]86        const std::string       promptString_;
[5971]87
[6015]88#ifdef ORXONOX_PLATFORM_UNIX
[6417]89        bool willPrintStatusLines();
90        void printInputLine();
91        void printOutputLine(const std::string& line, Shell::LineType type);
92        static void resetTerminalMode();
93
94        bool                    bPrintStatusLine_;
95        bool                    bStatusPrinted_;
96        std::vector<int>        statusLineWidths_;
97        int                     statusLineMaxWidth_;
98        static const int        minOutputLines_ = 3;
[6015]99        termios*                originalTerminalSettings_;
[6417]100
101#elif defined(ORXONOX_PLATFORM_WINDOWS)
102        void resetTerminalMode();
103        void moveCursor(int dx, int dy);
104        void writeText(const std::string& text, const COORD& pos, WORD attributes = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED);
105        void createNewOutputLines(int lines);
106        void printOutputLine(const std::string& line, Shell::LineType type, const COORD& pos);
107
108        static inline COORD makeCOORD(int x, int y)
109        {
110            COORD val = {x, y};
111            return val;
112        }
113
114        DWORD                   originalTerminalSettings_;
115        HANDLE                  stdInHandle_;
116        HANDLE                  stdOutHandle_;
117        int                     inputLineRow_;
118        int                     inputLineHeight_;
119        const int               statusLines_;
120        int                     lastOutputLineHeight_;
121        uint64_t                lastRefreshTime_;
[6015]122#endif
123
[5971]124        static IOConsole* singletonPtr_s;
125    };
126}
127
128#endif /* _IOConsole_H__ */
Note: See TracBrowser for help on using the repository browser.