PixelLightAPI
.
|
00001 /*********************************************************\ 00002 * File: Console.h * 00003 * 00004 * Copyright (C) 2002-2012 The PixelLight Team (http://www.pixellight.org/) 00005 * 00006 * This file is part of PixelLight. 00007 * 00008 * PixelLight is free software: you can redistribute it and/or modify 00009 * it under the terms of the GNU Lesser General Public License as published by 00010 * the Free Software Foundation, either version 3 of the License, or 00011 * (at your option) any later version. 00012 * 00013 * PixelLight is distributed in the hope that it will be useful, 00014 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00015 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00016 * GNU Lesser General Public License for more details. 00017 * 00018 * You should have received a copy of the GNU Lesser General Public License 00019 * along with PixelLight. If not, see <http://www.gnu.org/licenses/>. 00020 \*********************************************************/ 00021 00022 00023 #ifndef __PLCORE_CONSOLE_H__ 00024 #define __PLCORE_CONSOLE_H__ 00025 #pragma once 00026 00027 00028 //[-------------------------------------------------------] 00029 //[ Includes ] 00030 //[-------------------------------------------------------] 00031 #include "PLCore/PLCore.h" 00032 00033 00034 //[-------------------------------------------------------] 00035 //[ Namespace ] 00036 //[-------------------------------------------------------] 00037 namespace PLCore { 00038 00039 00040 //[-------------------------------------------------------] 00041 //[ Forward declarations ] 00042 //[-------------------------------------------------------] 00043 class String; 00044 00045 00046 //[-------------------------------------------------------] 00047 //[ Classes ] 00048 //[-------------------------------------------------------] 00049 /** 00050 * @brief 00051 * Abstract base class for platform specific 'Console' implementations 00052 */ 00053 class Console { 00054 00055 00056 //[-------------------------------------------------------] 00057 //[ Public virtual Console functions ] 00058 //[-------------------------------------------------------] 00059 public: 00060 /** 00061 * @brief 00062 * Print a string to the console 00063 * 00064 * @param[in] sString 00065 * String that shall be printed 00066 */ 00067 virtual void Print(const String &sString) const = 0; 00068 00069 /** 00070 * @brief 00071 * Checks whether or not there's some keyboard input waiting on the console ('_kbhit()') 00072 * 00073 * @return 00074 * 0 if no key has been pressed, else not null 00075 */ 00076 virtual int IsKeyHit() const = 0; 00077 00078 /** 00079 * @brief 00080 * Reads a single character from the console ('_getch()') 00081 * 00082 * @param[in] bEcho 00083 * Echo on the console? 00084 * 00085 * @return 00086 * The read character - note that there's no error code 00087 */ 00088 virtual int GetCharacter(bool bEcho = false) const = 0; 00089 00090 /** 00091 * @brief 00092 * Clears the console screen ('clrscr()') 00093 */ 00094 virtual void ClearScreen() const = 0; 00095 00096 /** 00097 * @brief 00098 * Gets the absolute console cursor position ('wherex()' and 'wherey()') 00099 * 00100 * @param[out] nX 00101 * Receives the absolute x position of the console cursor, (0,0)=(left,top) 00102 * @param[out] nY 00103 * Receives the absolute y position of the console cursor, (0,0)=(left,top) 00104 */ 00105 virtual void GetCursorPosition(uint16 &nX, uint16 &nY) const = 0; 00106 00107 /** 00108 * @brief 00109 * Sets the absolute console cursor position ('gotoxy()') 00110 * 00111 * @param[in] nX 00112 * New x absolute position of the console cursor, (0,0)=(left,top) 00113 * @param[in] nY 00114 * New y absolute position of the console cursor, (0,0)=(left,top) 00115 */ 00116 virtual void SetCursorPosition(uint16 nX, uint16 nY) const = 0; 00117 00118 00119 //[-------------------------------------------------------] 00120 //[ Protected functions ] 00121 //[-------------------------------------------------------] 00122 protected: 00123 /** 00124 * @brief 00125 * Constructor 00126 */ 00127 Console(); 00128 00129 /** 00130 * @brief 00131 * Destructor 00132 */ 00133 virtual ~Console(); 00134 00135 00136 //[-------------------------------------------------------] 00137 //[ Private functions ] 00138 //[-------------------------------------------------------] 00139 private: 00140 /** 00141 * @brief 00142 * Copy constructor 00143 * 00144 * @param[in] cSource 00145 * Source to copy from 00146 */ 00147 Console(const Console &cSource); 00148 00149 /** 00150 * @brief 00151 * Copy operator 00152 * 00153 * @param[in] cSource 00154 * Source to copy from 00155 * 00156 * @return 00157 * Reference to this instance 00158 */ 00159 Console &operator =(const Console &cSource); 00160 00161 00162 }; 00163 00164 00165 //[-------------------------------------------------------] 00166 //[ Namespace ] 00167 //[-------------------------------------------------------] 00168 } // PLCore 00169 00170 00171 #endif // __PLCORE_CONSOLE_H__
|