src/render/rConsole.h

Go to the documentation of this file.
00001 /*
00002 
00003 *************************************************************************
00004 
00005 ArmageTron -- Just another Tron Lightcycle Game in 3D.
00006 Copyright (C) 2000  Manuel Moos (manuel@moosnet.de)
00007 
00008 **************************************************************************
00009 
00010 This program is free software; you can redistribute it and/or
00011 modify it under the terms of the GNU General Public License
00012 as published by the Free Software Foundation; either version 2
00013 of the License, or (at your option) any later version.
00014 
00015 This program is distributed in the hope that it will be useful,
00016 but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018 GNU General Public License for more details.
00019 
00020 You should have received a copy of the GNU General Public License
00021 along with this program; if not, write to the Free Software
00022 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00023   
00024 ***************************************************************************
00025 
00026 */
00027 
00028 #ifndef ArmageTron_CONSOLE_H
00029 #define ArmageTron_CONSOLE_H
00030 
00031 #include "defs.h"
00032 #include "tString.h"
00033 #include "tConsole.h"
00034 #include "tCallback.h"
00035 #include "tArray.h"
00036 
00037 extern REAL rCWIDTH_CON;
00038 extern REAL rCHEIGHT_CON;
00039 
00040 class rConsole:public tConsole{
00041     tArray<tString> lines;
00042 
00043     int currentTop; // the line currently at top of the screen
00044     int currentIn;  // the line currently written into
00045 
00046     double lastTimeout; // the time the last message dissapeared
00047     double lastCustomTimeout; // the time the last custom key was pressed
00048 
00049     // the following Variables are only of interest in non-fullscreen mode:
00050     int height; // the maximum height of the console in lines
00051     REAL timeout;  // the time until one message dissapears
00052 
00053     static int MaxHeight(); // max height
00054 
00055     void DisplayAtNewline();
00056 public:
00057     bool fullscreen; // should the con be displayed fullscreen or
00058     // be limited to the upper edge of the screen?
00059 
00060     bool autoDisplayAtSwap; // do we need to call GL_Display manually?
00061     bool autoDisplayAtNewline;
00062 
00063     rConsole();
00064 
00065     int Height();
00066     REAL Timeout();
00067 
00068     void SetHeight(int h,bool stop_scroll=true);
00069     void SetTimeout(REAL to);
00070 
00071     void Render();
00072 
00073     //  rConsole & operator<<(const tString &s);
00074     virtual tConsole & DoPrint( const tString& s );
00075 
00076     void Scroll(int dir);
00077 
00078     virtual void DoCenterDisplay(const tString &s,REAL timeout=2,REAL r=1,REAL g=1,REAL b=1);
00079 
00080     virtual tString ColorString(REAL r, REAL g, REAL b) const;
00081 };
00082 
00083 
00084 extern rConsole sr_con; // where all the output is directed to
00085 
00086 #ifdef DEDICATED
00087 // read from stdin
00088 void sr_Unblock_stdin();
00089 void sr_Read_stdin();
00090 #endif
00091 
00092 class rForceTextCallback:public tCallbackOr{
00093 public:
00094     rForceTextCallback(BOOLRETFUNC *f);
00095     static bool ForceText();
00096 };
00097 
00098 class rSmallConsoleCallback:public tCallbackOr{
00099 public:
00100     rSmallConsoleCallback(BOOLRETFUNC *f);
00101     static bool SmallColsole();
00102 };
00103 
00104 class rCenterDisplayCallback:public tCallback{
00105 public:
00106     rCenterDisplayCallback(AA_VOIDFUNC *f);
00107     static void CenterDisplay();
00108 };
00109 
00110 // if one of those callbacks returns true, auto display at newline is disabled.
00111 class rNoAutoDisplayAtNewlineCallback:public tCallbackOr{
00112 public:
00113     rNoAutoDisplayAtNewlineCallback(BOOLRETFUNC *f);
00114     static bool NoAutoDisplayAtNewline();
00115 };
00116 
00117 #endif

Generated on Sat Mar 15 22:55:52 2008 for Armagetron Advanced by  doxygen 1.5.4