forked from LemonHaze420/DCMoHo
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathconsole.cpp
More file actions
77 lines (61 loc) · 1.7 KB
/
Copy pathconsole.cpp
File metadata and controls
77 lines (61 loc) · 1.7 KB
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
#include "Common.h"
#include "Globals.h"
//******************************************************************************************
CConsole::CConsole()
{
SINT c0;
for(c0 = 0; c0 < CONSOLE_MAX_LINES; c0++)
{
mStrings[c0][0] = 0;
}
mCurrentString = 0;
mLastTextTime = -100;
}
//******************************************************************************************
void CConsole::AddString(char *s)
{
mCurrentString++;
if (mCurrentString > CONSOLE_MAX_LINES - 1)
mCurrentString = 0;
my_strncpy(mStrings[mCurrentString], s, CONSOLE_LINE_SIZE);
mStrings[mCurrentString][CONSOLE_LINE_SIZE - 1] = 0; // security
mLastTextTime = GAME.GetGameTurn();
}
//******************************************************************************************
char *CConsole::GetString(SINT n)
{
SINT v = mCurrentString - n;
while (v < 0)
{
v += CONSOLE_MAX_LINES;
};
return mStrings[v];
}
//******************************************************************************************
//******************************************************************************************
void CConsole::Render()
{
return;
#if TARGET == PC
// draw?
if (mLastTextTime < GAME.GetGameTurn() - 50)
{
mLastTextTime = -100;
return;
}
HDC hdc = PLATFORM.GetDPWin()->GetDC(); // ####!!!!
SetBkMode(hdc, TRANSPARENT);
SINT c0;
for (c0 = 0; c0 < 4; c0++)
{
SINT size = strlen(CONSOLE.GetString(c0));
SetTextColor(hdc, RGB(0,0,0));
TextOut(hdc, 10 + 2, 440 - 15*c0 + 2, CONSOLE.GetString(c0), size);
SetTextColor(hdc, RGB(30, 200, 100));
TextOut(hdc, 10 , 440 - 15*c0 , CONSOLE.GetString(c0), size);
}
PLATFORM.GetDPWin()->ReleaseDC(hdc); //####!!!!
#elif TARGET == PSX
//!PSX draw console here
#endif
}