#include <console.h>
Collaboration diagram for Console:

Public Member Functions | |
| void | begin () |
| Console (int _nRows, int _nColumns) | |
| void | end () |
| int | getColumn () const |
| int | getHeight () const |
| int | getRow () const |
| int | getWidth () const |
| int | getWindowRow () const |
| void | newline () |
| void | print (char *) |
| void | print (wchar_t) |
| void | render (int rowHeight) |
| void | setFont (TextureFont *) |
| void | setScale (int, int) |
| void | setWindowHeight (int) |
| void | setWindowRow (int) |
| ~Console () | |
Private Attributes | |
| bool | autoScroll |
| int | column |
| TextureFont * | font |
| int | nColumns |
| int | nRows |
| int | row |
| ConsoleStreamBuf | sbuf |
| wchar_t * | text |
| int | windowHeight |
| int | windowRow |
| int | xscale |
| int | yscale |
|
||||||||||||
|
Definition at line 27 of file console.cpp. References nColumns, nRows, sbuf, ConsoleStreamBuf::setConsole(), and text. 00027 : 00028 ostream(&sbuf), 00029 text(NULL), 00030 nRows(_nRows), 00031 nColumns(_nColumns), 00032 row(0), 00033 column(0), 00034 windowRow(0), 00035 windowHeight(10), 00036 xscale(1), 00037 yscale(1), 00038 font(NULL), 00039 autoScroll(true) 00040 { 00041 sbuf.setConsole(this); 00042 text = new wchar_t[(nColumns + 1) * nRows]; 00043 for (int i = 0; i < nRows; i++) 00044 text[(nColumns + 1) * i] = '\0'; 00045 }
|
|
|
Definition at line 48 of file console.cpp. References text. 00049 {
00050 if (text != NULL)
00051 delete[] text;
00052 }
|
|
|
Definition at line 55 of file console.cpp. References xscale, and yscale. Referenced by CelestiaCore::draw(). 00056 {
00057 glMatrixMode(GL_PROJECTION);
00058 glPushMatrix();
00059 glLoadIdentity();
00060 gluOrtho2D(0, xscale, 0, yscale);
00061 glMatrixMode(GL_MODELVIEW);
00062 glPushMatrix();
00063 glLoadIdentity();
00064 glTranslatef(0.125f, 0.125f, 0);
00065
00066 glDisable(GL_LIGHTING);
00067 glDisable(GL_TEXTURE_2D);
00068 glEnable(GL_BLEND);
00069 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00070 }
|
|
|
Definition at line 73 of file console.cpp. Referenced by CelestiaCore::draw(). 00074 {
00075 glMatrixMode(GL_PROJECTION);
00076 glPopMatrix();
00077 glMatrixMode(GL_MODELVIEW);
00078 glPopMatrix();
00079 }
|
|
|
Definition at line 194 of file console.cpp. References column. 00195 {
00196 return column;
00197 }
|
|
|
Definition at line 224 of file console.cpp. References nRows. 00225 {
00226 return nRows;
00227 }
|
|
|
Definition at line 188 of file console.cpp. References row. 00189 {
00190 return row;
00191 }
|
|
|
Definition at line 218 of file console.cpp. References nColumns. 00219 {
00220 return nColumns;
00221 }
|
|
|
Definition at line 200 of file console.cpp. References windowRow. 00201 {
00202 return windowRow;
00203 }
|
|
|
Definition at line 127 of file console.cpp. References autoScroll, column, nColumns, nRows, row, text, windowHeight, and windowRow. Referenced by print(). 00128 {
00129 assert(column <= nColumns);
00130 assert(row < nRows);
00131
00132 text[row * (nColumns + 1) + column] = '\0';
00133 row = (row + 1) % nRows;
00134 column = 0;
00135
00136 if (autoScroll)
00137 windowRow = -windowHeight;
00138 }
|
|
|
Definition at line 157 of file console.cpp. References print(), UTF8Decode(), and UTF8EncodedSize(). 00158 {
00159 int length = strlen(s);
00160 bool validChar = true;
00161 int i = 0;
00162
00163 while (i < length && validChar)
00164 {
00165 wchar_t ch = 0;
00166 validChar = UTF8Decode(s, i, length, ch);
00167 i += UTF8EncodedSize(ch);
00168 print(ch);
00169 }
00170 }
|
|
|
Definition at line 140 of file console.cpp. References column, nColumns, newline(), row, and text. Referenced by ConsoleStreamBuf::overflow(), and print(). 00141 {
00142 switch (c)
00143 {
00144 case '\n':
00145 newline();
00146 break;
00147 default:
00148 if (column == nColumns)
00149 newline();
00150 text[row * (nColumns + 1) + column] = c;
00151 column++;
00152 break;
00153 }
00154 }
|
|
|
Definition at line 82 of file console.cpp. References TextureFont::bind(), font, TextureFont::getHeight(), nColumns, nRows, pmod(), TextureFont::render(), row, text, and windowRow. Referenced by CelestiaCore::draw(). 00083 {
00084 if (font == NULL)
00085 return;
00086
00087 glEnable(GL_TEXTURE_2D);
00088 font->bind();
00089 glPushMatrix();
00090 for (int i = 0; i < rowHeight; i++)
00091 {
00092 //int r = (nRows - rowHeight + 1 + windowRow + i) % nRows;
00093 int r = pmod(row + windowRow + i, nRows);
00094 for (int j = 0; j < nColumns; j++)
00095 {
00096 wchar_t ch = text[r * (nColumns + 1) + j];
00097 if (ch == '\0')
00098 break;
00099 font->render(ch);
00100 }
00101
00102 // advance to the next line
00103 glPopMatrix();
00104 glTranslatef(0.0f, -(1.0f + font->getHeight()), 0.0f);
00105 glPushMatrix();
00106 }
00107 glPopMatrix();
00108 }
|
|
|
Definition at line 118 of file console.cpp. References font. Referenced by CelestiaCore::draw(). 00119 {
00120 if (f != font)
00121 {
00122 font = f;
00123 }
00124 }
|
|
||||||||||||
|
Definition at line 111 of file console.cpp. References xscale, and yscale. Referenced by CelestiaCore::resize().
|
|
|
Definition at line 212 of file console.cpp. References windowHeight. Referenced by CelestiaCore::CelestiaCore(). 00213 {
00214 windowHeight = _height;
00215 }
|
|
|
Definition at line 206 of file console.cpp. References windowRow. Referenced by scrollConsole(). 00207 {
00208 windowRow = _row;
00209 }
|
|
|
Definition at line 90 of file console.h. Referenced by newline(). |
|
|
Definition at line 78 of file console.h. Referenced by getColumn(), newline(), and print(). |
|
|
|
|
|
Definition at line 76 of file console.h. Referenced by Console(), getWidth(), newline(), print(), and render(). |
|
|
Definition at line 75 of file console.h. Referenced by Console(), getHeight(), newline(), and render(). |
|
|
|
|
|
Definition at line 88 of file console.h. Referenced by Console(). |
|
|
Definition at line 74 of file console.h. Referenced by Console(), newline(), print(), render(), and ~Console(). |
|
|
Definition at line 82 of file console.h. Referenced by newline(), and setWindowHeight(). |
|
|
Definition at line 80 of file console.h. Referenced by getWindowRow(), newline(), render(), and setWindowRow(). |
|
|
Definition at line 84 of file console.h. Referenced by begin(), and setScale(). |
|
|
Definition at line 85 of file console.h. Referenced by begin(), and setScale(). |
1.4.1