This repository has been archived by the owner on Apr 19, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Painter.h
173 lines (148 loc) · 3.87 KB
/
Painter.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
#include<Windows.h>
class Painter
{
private:
HANDLE hCon;
HWND hWnd;
HDC hDCDisplay;
HDC hDCDraw;
public:
//no public variables
private:
Painter();
//private copy constructors to prevent copies
Painter(Painter const& copy);
Painter& operator=(Painter const& copy);
public:
/*
Returns the Painter Instance. If none exists yet it is created;
*/
static Painter& getInstance()
{
static Painter instance;
return instance;
}
/*
Draws a single Bitmap into hDC, 1:1 stretch.
hDC: Drawing DC,
fX: x-Pos,
fY: y-Pos,
fWidth: x-Dimensions,
fWidth: y-Dimensions,
hbm: Handle of Bitmap,
bm: Loaded Bitmap,
clrAlphaChannel: Which color should be transparent;
*/
void drawBitmap(float fX, float fY, float fWidth, float fHeight, HBITMAP hbm, BITMAP bm, COLORREF clrAlphaChannel);
/*
Draws a single Bitmap into hDC, includes scaling.
hDC: Drawing DC,
fX: x-Pos,
fY: y-Pos,
fWidth: x-Dimensions,
fWidth: y-Dimensions,
hbm: Handle of Bitmap,
bm: Loaded Bitmap,
fInBitmap... = part of Bitmap rectangle.
clrAlphaChannel: Which color should be transparent;
*/
void drawBitmapEx(float fX, float fY, float fWidth, float fHeight, float fInbitmapX, float fInBitmapY, float fInBitmapWidth, float fInBitmapHeight, HBITMAP hbm, BITMAP bm, COLORREF clrAlphaChannel);
/*
MessageBox:
TYPE: MB_...
Declared in "Windows.h"
MB_DEFBUTTON1 LAYOUT !!!
*/
int msgBox(char * CAPTION, char * TEXT, int TYPE);
class console{
private:
friend class Painter;
HANDLE* hCon;
public:
class chars{
private:
chars();
public:
class uml{
private:
uml();
public:
static const char cauml = '„';
static const char cAuml = 'Ž';
static const char cuuml = '';
static const char cUuml = 'š';
static const char couml = '”';
static const char cOuml = '™';
static const char csharps = 'á';
};
class border_single{
private:
border_single();
public:
static const char cLeftUpperCorner = 'Ú';
static const char cLeftMiddleCorner = 'Ã';
static const char cLeftLowerCorner = 'Ù';
static const char cVerticalLine = '³';
static const char cHorizontalLine = 'Ä';
static const char cRightUpperCorner = 'Ú';
static const char cRightMiddleCorner = '´';
static const char cRightLowerCorner = 'Ù';
static const char cUpperMiddleCorner = 'Â';
static const char cLowerMiddleCorner = 'Á';
static const char cCenterCross = 'Å';
};
class border_double{
private:
border_double();
public:
static const char cLeftUpperCorner = 'É';
static const char cLeftMiddleCorner = 'Ì';
static const char cLeftLowerCorner = 'È';
static const char cVerticalLine = 'º';
static const char cHorizontalLine = 'Í';
static const char cRightUpperCorner = '»';
static const char cRightMiddleCorner = '¹';
static const char cRightLowerCorner = '¼';
static const char cUpperMiddleCorner = 'Ë';
static const char cLowerMiddleCorner = 'Ê';
static const char cCenterCross = 'Î';
};
class block{
private:
block();
public:
static const char cBlockDensity0 = ' ';
static const char cBlockDensity1 = '°';
static const char cBlockDensity2 = '±';
static const char cBlockDensity3 = '²';
static const char cBlockDensity4 = 'Û';
static const char cUpperHalfBlock = 'Ü';
static const char cLowerHalfBlock = 'ß';
};
};
private:
console();
console(HANDLE* p_hCon);
console(console const& copy); //dont allow copies -> not implemented
public:
/*
COLORRANGE: HEX: 0x00 to 0xFF
First digit: Backgroundcolor
Last digit: Foregroundcolor
f.ex: 0x0A == black-green (typical matrix style)
*/
void color(int const iColor);
/*
Hide Caret (visible(true)/invisible(false))
*/
void caretVisibility(bool const bVisible);
/*
Move Cursor to (x|y)
*/
void gotoxy(int const x, int const y);
/*
Set Title of Console.
*/
void title(char const * TITLE);
};
};