mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-16 01:54:38 +02:00
Debug text font setup for Linux
This commit is contained in:
21
src/debug.h
21
src/debug.h
@@ -11,6 +11,7 @@ namespace Debug {
|
|||||||
static GLuint font;
|
static GLuint font;
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
|
#ifdef WIN32
|
||||||
font = glGenLists(256);
|
font = glGenLists(256);
|
||||||
HDC hdc = GetDC(0);
|
HDC hdc = GetDC(0);
|
||||||
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
||||||
@@ -20,6 +21,26 @@ namespace Debug {
|
|||||||
SelectObject(hdc, hfont);
|
SelectObject(hdc, hfont);
|
||||||
wglUseFontBitmaps(hdc, 0, 256, font);
|
wglUseFontBitmaps(hdc, 0, 256, font);
|
||||||
DeleteObject(hfont);
|
DeleteObject(hfont);
|
||||||
|
#elif LINUX
|
||||||
|
XFontStruct *fontInfo;
|
||||||
|
Font id;
|
||||||
|
unsigned int first, last;
|
||||||
|
fontInfo = XLoadQueryFont(glXGetCurrentDisplay(), "-adobe-times-medium-r-normal--17-120-100-100-p-88-iso8859-1");
|
||||||
|
|
||||||
|
if (fontInfo == NULL) {
|
||||||
|
LOG("no font found\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
id = fontInfo->fid;
|
||||||
|
first = fontInfo->min_char_or_byte2;
|
||||||
|
last = fontInfo->max_char_or_byte2;
|
||||||
|
|
||||||
|
font = glGenLists(last + 1);
|
||||||
|
if (font == 0) {
|
||||||
|
LOG("out of display lists\n");
|
||||||
|
}
|
||||||
|
glXUseXFont(id, first, last - first + 1, font + first);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
void free() {
|
void free() {
|
||||||
|
Reference in New Issue
Block a user