forked from ClemensLode/Wars
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathGdi.cpp
72 lines (63 loc) · 1.61 KB
/
Gdi.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
#include "engine.h"
HBRUSH Farbe;
BOOL Engine_Graphics::DrawRect(IDirectDrawSurface *Oberflaeche,int x1,
int y1,int x2,int y2,BOOL filled)
{
if (FAILED(Oberflaeche->GetDC(&info.hdc)))
{
return Fail("Engine::DrawRect = GetDC");
}
SetBkMode(info.hdc,TRANSPARENT);
//Farbe = CreateSolidBrush(RGB(tR,tG,tB));
//SetDCBrushColor(info.hdc,RGB(0,0,255));
//SelectObject( info.hdc, GetStockObject(DC_BRUSH));
Rectangle( info.hdc, x1, y1, x2, y2 );
if (FAILED(Oberflaeche->ReleaseDC(info.hdc)))
{
return Fail("Engine::DrawRect = ReleaseDC");
}
return TRUE;
}
BOOL Engine_Graphics::DrawEllipse(IDirectDrawSurface *Oberflaeche, int x1,
int y1,int x2,int y2)
{
if (FAILED(Oberflaeche->GetDC(&info.hdc)))
{
return Fail("Engine::DrawEllipse = GetDC");
}
Farbe = CreateSolidBrush(RGB(tR,tG,tB));
SelectObject( info.hdc, Farbe );
Ellipse( info.hdc, x1, y1, x2, y2 );
if (FAILED(Oberflaeche->ReleaseDC(info.hdc)))
{
return Fail("Engine::DrawEllipse = ReleaseDC");
}
return TRUE;
}
void Engine_Graphics::SetColor(int R,int G,int B)
{
tR = R;
tG = G;
tB = B;
}
void Engine_Graphics::SetBackgroundColor(int R,int G,int B)
{
bR = R;
bG = G;
bB = B;
}
BOOL Engine_Graphics::DrawPolygon(IDirectDrawSurface *Oberflaeche,const POINT Ecken,int WievieleEcken)
{
if (FAILED(Oberflaeche->GetDC(&info.hdc)))
{
return Fail("Engine::DrawEllipse = GetDC");
}
Farbe = CreateSolidBrush(RGB(tR,tG,tB));
SelectObject( info.hdc, Farbe );
Polygon(info.hdc,&Ecken,WievieleEcken);
if (FAILED(Oberflaeche->ReleaseDC(info.hdc)))
{
return Fail("Engine::DrawEllipse = ReleaseDC");
}
return TRUE;
}