mirror of
https://github.com/XProger/OpenLara.git
synced 2025-08-15 01:24:35 +02:00
43
src/debug.h
43
src/debug.h
@@ -11,15 +11,36 @@ namespace Debug {
|
|||||||
static GLuint font;
|
static GLuint font;
|
||||||
|
|
||||||
void init() {
|
void init() {
|
||||||
font = glGenLists(256);
|
#ifdef WIN32
|
||||||
HDC hdc = GetDC(0);
|
font = glGenLists(256);
|
||||||
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
HDC hdc = GetDC(0);
|
||||||
0, 0, FW_BOLD, 0, 0, 0,
|
HFONT hfont = CreateFontA(-MulDiv(10, GetDeviceCaps(hdc, LOGPIXELSY), 72), 0,
|
||||||
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
|
0, 0, FW_BOLD, 0, 0, 0,
|
||||||
ANTIALIASED_QUALITY, DEFAULT_PITCH, "Courier New");
|
ANSI_CHARSET, OUT_TT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||||
SelectObject(hdc, hfont);
|
ANTIALIASED_QUALITY, DEFAULT_PITCH, "Courier New");
|
||||||
wglUseFontBitmaps(hdc, 0, 256, font);
|
SelectObject(hdc, hfont);
|
||||||
DeleteObject(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() {
|
void free() {
|
||||||
@@ -557,10 +578,10 @@ namespace Debug {
|
|||||||
uint32 data;
|
uint32 data;
|
||||||
uint32 dataSize;
|
uint32 dataSize;
|
||||||
} header = {
|
} header = {
|
||||||
FOURCC("RIFF"), sizeof(Header) - 8 + dataSize,
|
FOURCC("RIFF"), (uint32) sizeof(Header) - 8 + dataSize,
|
||||||
FOURCC("WAVE"), FOURCC("fmt "), 16,
|
FOURCC("WAVE"), FOURCC("fmt "), 16,
|
||||||
{ 1, 1, 44100, 44100 * 16 / 8, 0, 16 },
|
{ 1, 1, 44100, 44100 * 16 / 8, 0, 16 },
|
||||||
FOURCC("data"), dataSize
|
FOURCC("data"), (uint32) dataSize
|
||||||
};
|
};
|
||||||
|
|
||||||
fwrite(&header, sizeof(header), 1, f);
|
fwrite(&header, sizeof(header), 1, f);
|
||||||
|
@@ -7,7 +7,12 @@
|
|||||||
#include <float.h>
|
#include <float.h>
|
||||||
|
|
||||||
#ifdef _DEBUG
|
#ifdef _DEBUG
|
||||||
#define debugBreak() _asm { int 3 }
|
#ifdef LINUX
|
||||||
|
#define debugBreak() raise(SIGTRAP);
|
||||||
|
#else
|
||||||
|
#define debugBreak() _asm { int 3 }
|
||||||
|
#endif
|
||||||
|
|
||||||
#define ASSERT(expr) if (expr) {} else { LOG("ASSERT %s in %s:%d\n", #expr, __FILE__, __LINE__); debugBreak(); }
|
#define ASSERT(expr) if (expr) {} else { LOG("ASSERT %s in %s:%d\n", #expr, __FILE__, __LINE__); debugBreak(); }
|
||||||
|
|
||||||
#ifndef ANDROID
|
#ifndef ANDROID
|
||||||
|
Reference in New Issue
Block a user