-
Notifications
You must be signed in to change notification settings - Fork 0
/
debug.cpp
83 lines (59 loc) · 2.29 KB
/
debug.cpp
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
76
77
78
79
80
81
82
83
#include "debug.h"
#include "dxfunc.h"
Debug::Debug()
: FPS_SPACE(20){
}
Debug::~Debug(){}
float Debug::CalcFPS() const{
static int cnt = 0;
static DWORD curr_time = 0, prev_time = 0, elapsed = 0;
static float fps = 0.0f;
prev_time = curr_time;
curr_time = timeGetTime();
cnt++;
elapsed += curr_time - prev_time;
if(elapsed >= 1000) {
fps = cnt * 1000.0f / elapsed;
elapsed = 0;
cnt = 0;
}
return fps;
}
void Debug::PrintFPS(RECT rc) const{
rc.top += FPS_SPACE;
rc.right -= FPS_SPACE;
Font->DrawTextA(Sprite, sz_fps, -1, &rc, DT_RIGHT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(0, 0, 0));
rc.top += 2;
rc.right -= 2;
Font->DrawTextA(Sprite, sz_fps, -1, &rc, DT_RIGHT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 255, 0));
return;
}
void Debug::PrintValue(RECT rc) const{
if (!DEBUG)
return;
rc.top += 200;
Font->DrawTextA(Sprite, sz_cturn, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 40;
Font->DrawTextA(Sprite, sz_pxl_x, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_pxl_y, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_loc_x, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_loc_y, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_locits_x, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_locits_y, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 40;
Font->DrawTextA(Sprite, sz_mstat, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 40;
Font->DrawTextA(Sprite, sz_temp1, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_temp2, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_temp3, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
rc.top += 20;
Font->DrawTextA(Sprite, sz_temp4, -1, &rc, DT_LEFT | DT_SINGLELINE | DT_NOCLIP, D3DCOLOR_XRGB(255, 0, 0));
return;
}