-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommonMacroFunction.h
More file actions
63 lines (51 loc) · 1.56 KB
/
commonMacroFunction.h
File metadata and controls
63 lines (51 loc) · 1.56 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
#pragma once
//============================================
// ## 21.04.23 ## commonMacroFunction ##
//============================================
// 선긋기함수(그려줄DC, 시작좌표X, 시작좌표Y, 끝좌표 X, 끝좌표Y)
inline void LineMake(HDC hdc, int x1, int y1, int x2, int y2)
{
MoveToEx(hdc, x1, y1, NULL);
LineTo(hdc, x2, y2);
}
//RECT
inline RECT RectMake(int x, int y, int width, int height)
{
RECT rc = { x, y, x + width, y + height };
return rc;
}
inline RECT RectMakeCenter(int x, int y, int width, int height)
{
RECT rc = { x - (width / 2), y - (height / 2), x + (width / 2), y + (height/ 2) };
return rc;
}
//사각형
inline void Rectangle(HDC hdc, RECT& rc)
{
Rectangle(hdc, rc.left, rc.top, rc.right, rc.bottom);
}
//x, y축을 기준으로 하는 사각형이 생성됨
inline void RectangleMake(HDC hdc, int x, int y, int width, int height)
{
Rectangle(hdc, x, y, x + width, y + height);
}
//x, y 좌표를 중점으로 크기만큼의 사각형이 생성됨
inline void RectangleMakeCenter(HDC hdc, int x, int y, int width, int height)
{
Rectangle(hdc, x - (width / 2), y - (height / 2), x + (width / 2), y + (height / 2));
}
//원
inline void Ellipse(HDC hdc, RECT& rc)
{
Ellipse(hdc, rc.left, rc.top, rc.right, rc.bottom);
}
//x, y축을 기준으로 하는 원이 생성됨
inline void EllipseMake(HDC hdc, int x, int y, int width, int height)
{
Ellipse(hdc, x, y, x + width, y + height);
}
//x, y 좌표를 중점으로 크기만큼의 원이 생성됨
inline void EllipseMakeCenter(HDC hdc, int x, int y, int width, int height)
{
Ellipse(hdc, x - (width / 2), y - (height / 2), x + (width / 2), y + (height / 2));
}