-
Notifications
You must be signed in to change notification settings - Fork 0
/
Debug.h
75 lines (58 loc) · 1.72 KB
/
Debug.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
/* ===========================================================================
//
// File: Debug.h
//
// Description: Prints debug info..
//
// Written by: Mirza King, April 2001
// ======================================================================== */
#define CDXINCLUDEALL
#include <CDX.H>
/* ---------------------------------------------------------------------------
//
// Name: dprints
//
// Function: Prints debug info on the screen starting in the upper left
// corner.
//
// Remarks: Writes in red color. Screen object must exist.
//
// Usage: dprints("mirza king %d", 2001);
//
// ------------------------------------------------------------------------ */
void dprints( char *fmt, ... )
{
char buf[256];
va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
Screen->GetBack()->GetDC();
Screen->GetBack()->TextXY(0, 0,RGB(255,0,0) , buf);
Screen->GetBack()->ReleaseDC();
}
/* ---------------------------------------------------------------------------
//
// Name: dprints
//
// Function: Prints debug info to a file.
//
// Remarks: File handle must exist.
//
// Usage: dprintf("mirza king %d \n", 2001);
//
// ------------------------------------------------------------------------ */
void dprintf(FILE *fdebug, char *fmt, ... )
{
char buf[256];
if (DebugFlag == 0) return;
va_list args;
va_start(args, fmt);
vsprintf(buf, fmt, args);
va_end(args);
if (fdebug != NULL)
{
fprintf(fdebug, buf);
}
}
/* =============== End of file Debug.h ==================================== */