#include <overlay.h>
Collaboration diagram for Overlay:

Public Member Functions | |
| void | begin () |
| void | beginText () |
| void | end () |
| void | endText () |
| Overlay () | |
| void | print (char *) |
| void | print (char) |
| void | print (wchar_t) |
| void | printf (const char *,...) |
| void | rect (float x, float y, float w, float h, bool fill=true) |
| void | setFont (TextureFont *) |
| void | setWindowSize (int, int) |
| ~Overlay () | |
Private Attributes | |
| TextureFont * | font |
| bool | fontChanged |
| OverlayStreamBuf | sbuf |
| int | textBlock |
| bool | useTexture |
| int | windowHeight |
| int | windowWidth |
|
|
Definition at line 20 of file overlay.cpp. References sbuf, and OverlayStreamBuf::setOverlay(). 00020 : 00021 ostream(&sbuf), 00022 windowWidth(1), 00023 windowHeight(1), 00024 font(NULL), 00025 useTexture(false), 00026 fontChanged(false), 00027 textBlock(0) 00028 { 00029 sbuf.setOverlay(this); 00030 }
|
|
|
Definition at line 32 of file overlay.cpp. 00033 {
00034 }
|
|
|
Definition at line 37 of file overlay.cpp. References useTexture, windowHeight, and windowWidth. Referenced by CelestiaCore::renderOverlay(). 00038 {
00039 glMatrixMode(GL_PROJECTION);
00040 glPushMatrix();
00041 glLoadIdentity();
00042 gluOrtho2D(0, windowWidth, 0, windowHeight);
00043 glMatrixMode(GL_MODELVIEW);
00044 glPushMatrix();
00045 glLoadIdentity();
00046 glTranslatef(0.125f, 0.125f, 0);
00047
00048 glDisable(GL_LIGHTING);
00049 glDisable(GL_TEXTURE_2D);
00050 glEnable(GL_BLEND);
00051 glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
00052
00053 useTexture = false;
00054 }
|
|
|
Definition at line 81 of file overlay.cpp. References textBlock. Referenced by CelestiaCore::renderOverlay(). 00082 {
00083 glPushMatrix();
00084 textBlock++;
00085 }
|
|
|
Definition at line 56 of file overlay.cpp. Referenced by CelestiaCore::renderOverlay(). 00057 {
00058 glMatrixMode(GL_PROJECTION);
00059 glPopMatrix();
00060 glMatrixMode(GL_MODELVIEW);
00061 glPopMatrix();
00062 }
|
|
|
Definition at line 87 of file overlay.cpp. References textBlock. Referenced by CelestiaCore::renderOverlay(). 00088 {
00089 if (textBlock > 0)
00090 {
00091 textBlock--;
00092 glPopMatrix();
00093 }
00094 }
|
|
|
Definition at line 156 of file overlay.cpp. References print(), UTF8Decode(), and UTF8EncodedSize(). 00157 {
00158 #if 0
00159 while (*s != '\0')
00160 print(*s++);
00161 #else
00162 int length = strlen(s);
00163 bool validChar = true;
00164 int i = 0;
00165 while (i < length && validChar)
00166 {
00167 wchar_t ch = 0;
00168 validChar = UTF8Decode(s, i, length, ch);
00169 i += UTF8EncodedSize(ch);
00170 print(ch);
00171 }
00172 #endif
00173 }
|
|
|
Definition at line 127 of file overlay.cpp. References TextureFont::bind(), font, fontChanged, TextureFont::getHeight(), TextureFont::render(), textBlock, and useTexture. 00128 {
00129 if (font != NULL)
00130 {
00131 if (!useTexture || fontChanged)
00132 {
00133 glEnable(GL_TEXTURE_2D);
00134 font->bind();
00135 useTexture = true;
00136 fontChanged = false;
00137 }
00138
00139 switch (c)
00140 {
00141 case '\n':
00142 if (textBlock > 0)
00143 {
00144 glPopMatrix();
00145 glTranslatef(0, -(1 + font->getHeight()), 0);
00146 glPushMatrix();
00147 }
00148 break;
00149 default:
00150 font->render(c);
00151 break;
00152 }
00153 }
00154 }
|
|
|
Definition at line 97 of file overlay.cpp. References TextureFont::bind(), font, fontChanged, TextureFont::getHeight(), TextureFont::render(), textBlock, and useTexture. Referenced by OverlayStreamBuf::overflow(), print(), and printf(). 00098 {
00099 if (font != NULL)
00100 {
00101 if (!useTexture || fontChanged)
00102 {
00103 glEnable(GL_TEXTURE_2D);
00104 font->bind();
00105 useTexture = true;
00106 fontChanged = false;
00107 }
00108
00109 switch (c)
00110 {
00111 case '\n':
00112 if (textBlock > 0)
00113 {
00114 glPopMatrix();
00115 glTranslatef(0, -(1 + font->getHeight()), 0);
00116 glPushMatrix();
00117 }
00118 break;
00119 default:
00120 font->render(c);
00121 break;
00122 }
00123 }
00124 }
|
|
||||||||||||
|
Definition at line 176 of file overlay.cpp. References print(). Referenced by CelestiaCore::renderOverlay(). 00177 {
00178 va_list args;
00179 va_start(args, format);
00180
00181 char buf[1024];
00182 vsprintf(buf, format, args);
00183 print(buf);
00184
00185 va_end(args);
00186 }
|
|
||||||||||||||||||||||||
|
Definition at line 189 of file overlay.cpp. References useTexture. Referenced by CelestiaCore::renderOverlay(). 00190 {
00191 if (useTexture)
00192 {
00193 glDisable(GL_TEXTURE_2D);
00194 useTexture = false;
00195 }
00196
00197 if (fill)
00198 {
00199 glRectf(x, y, x + w, y + h);
00200 }
00201 else
00202 {
00203 glBegin(GL_LINE_LOOP);
00204 glVertex3f(x, y, 0);
00205 glVertex3f(x + w, y, 0);
00206 glVertex3f(x + w, y + h, 0);
00207 glVertex3f(x, y + h, 0);
00208 glEnd();
00209 }
00210 }
|
|
|
Definition at line 71 of file overlay.cpp. References font, and fontChanged. Referenced by CelestiaCore::renderOverlay(). 00072 {
00073 if (f != font)
00074 {
00075 font = f;
00076 fontChanged = true;
00077 }
00078 }
|
|
||||||||||||
|
Definition at line 65 of file overlay.cpp. References windowHeight, and windowWidth. Referenced by CelestiaCore::initRenderer(), and CelestiaCore::resize(). 00066 {
00067 windowWidth = w;
00068 windowHeight = h;
00069 }
|
|
|
|
|
|
|
|
|
Definition at line 77 of file overlay.h. Referenced by Overlay(). |
|
|
Definition at line 75 of file overlay.h. Referenced by beginText(), endText(), and print(). |
|
|
|
|
|
Definition at line 71 of file overlay.h. Referenced by begin(), and setWindowSize(). |
|
|
Definition at line 70 of file overlay.h. Referenced by begin(), and setWindowSize(). |
1.4.1