diff --git a/src/debug.h b/src/debug.h index 58a3c7f..ebce4f0 100644 --- a/src/debug.h +++ b/src/debug.h @@ -11,15 +11,36 @@ namespace Debug { static GLuint font; void init() { - font = glGenLists(256); - HDC hdc = GetDC(0); - HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0, - 0, 0, FW_BOLD, 0, 0, 0, - ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, - ANTIALIASED_QUALITY, DEFAULT_PITCH, "Courier New"); - SelectObject(hdc, hfont); - wglUseFontBitmaps(hdc, 0, 256, font); - DeleteObject(hfont); + #ifdef WIN32 + font = glGenLists(256); + HDC hdc = GetDC(0); + HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0, + 0, 0, FW_BOLD, 0, 0, 0, + ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS, + ANTIALIASED_QUALITY, DEFAULT_PITCH, "Courier New"); + SelectObject(hdc, hfont); + wglUseFontBitmaps(hdc, 0, 256, font); + 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() {