1 /* 2 3 ************************************************************************* 4 5 ArmageTron -- Just another Tron Lightcycle Game in 3D. 6 Copyright (C) 2000 Manuel Moos (manuel@moosnet.de) 7 8 ************************************************************************** 9 10 This program is free software; you can redistribute it and/or 11 modify it under the terms of the GNU General Public License 12 as published by the Free Software Foundation; either version 2 13 of the License, or (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 GNU General Public License for more details. 19 20 You should have received a copy of the GNU General Public License 21 along with this program; if not, write to the Free Software 22 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 23 24 *************************************************************************** 25 26 */ 27 28 #ifndef ArmageTron_CONSOLE_H 29 #define ArmageTron_CONSOLE_H 30 31 #include "defs.h" 32 #include "tString.h" 33 #include "tConsole.h" 34 #include "tCallback.h" 35 36 37 extern REAL rCWIDTH_CON; 38 extern REAL rCHEIGHT_CON; 39 40 class rConsole:public tConsole{ 41 tArray<tString> lines; 42 43 int currentTop; // the line currently at top of the screen 44 int currentIn; // the line currently written into 45 46 double lastTimeout; // the time the last message dissapeared 47 double lastCustomTimeout; // the time the last custom key was pressed 48 49 // the following Variables are only of interest in non-fullscreen mode: 50 int height; // the maximum height of the console in lines 51 REAL timeout; // the time until one message dissapears 52 53 static int MaxHeight(); // max height 54 55 void DisplayAtNewline(); 56 public: 57 bool fullscreen; // should the con be displayed fullscreen or 58 // be limited to the upper edge of the screen? 59 60 bool autoDisplayAtSwap; // do we need to call GL_Display manually? 61 bool autoDisplayAtNewline; 62 63 rConsole(); 64 65 int Height(); 66 REAL Timeout(); 67 68 void SetHeight(int h,bool stop_scroll=true); 69 void SetTimeout(REAL to); 70 71 void Render(); 72 73 // rConsole & operator<<(const tString &s); 74 virtual tConsole & DoPrint( const tString& s ); 75 76 void Scroll(int dir); 77 78 virtual void DoCenterDisplay(const tString &s,REAL timeout=2,REAL r=1,REAL g=1,REAL b=1); 79 80 virtual tString ColorString(REAL r, REAL g, REAL b) const; 81 }; 82 83 84 extern rConsole sr_con; // where all the output is directed to 85 86 #ifdef DEDICATED 87 // read from stdin 88 void sr_Unblock_stdin(); 89 void sr_Read_stdin(); 90 #endif 91 92 class rForceTextCallback:public tCallbackOr{ 93 public: 94 rForceTextCallback(BOOLRETFUNC *f); 95 static bool ForceText(); 96 }; 97 98 class rSmallConsoleCallback:public tCallbackOr{ 99 public: 100 rSmallConsoleCallback(BOOLRETFUNC *f); 101 static bool SmallColsole(); 102 }; 103 104 class rCenterDisplayCallback:public tCallback{ 105 public: 106 rCenterDisplayCallback(VOIDFUNC *f); 107 static void CenterDisplay(); 108 }; 109 110 // if one of those callbacks returns true, auto display at newline is disabled. 111 class rNoAutoDisplayAtNewlineCallback:public tCallbackOr{ 112 public: 113 rNoAutoDisplayAtNewlineCallback(BOOLRETFUNC *f); 114 static bool NoAutoDisplayAtNewline(); 115 }; 116 117 #endif 118