This repository has been archived by the owner on Aug 10, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Controller.cpp
144 lines (138 loc) · 5.22 KB
/
Controller.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
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
#include "Controller.h"
void Controller::welcome()
{
play_music("welcome");
while(true)
{
show_ui("welcome");
if(GetAsyncKeyState(VK_RETURN))
break;
if(GetAsyncKeyState(VK_ESCAPE))
exit(0);
}
}
void Controller::win()
{
play_music("win");
show_ui("win");
while(!GetAsyncKeyState(VK_RETURN));
}
void Controller::lose()
{
play_music("lose");
show_ui("lose");
while(!GetAsyncKeyState(VK_RETURN));
}
void Controller::play_music(string type)
{
if(type == "welcome") {
mciSendString(_T("close all"), NULL, 0, NULL);//界岺杰唐稜있
mciSendString(_T("open \"assets\\audios\\bg.mp3\" alias welcome"), NULL, 0, NULL);//뻑短稜있
mciSendString(_T("play welcome repeat"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "gaming") {
mciSendString(_T("close all"), NULL, 0, NULL);//界岺杰唐稜있
mciSendString(_T("open \"assets\\audios\\bg.mp3\" alias gaming"), NULL, 0, NULL);//교쒼稜있
mciSendString(_T("play gaming"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "accele") {
mciSendString(_T("stop gaming"), NULL, 0, NULL);//界岺杰唐稜있
mciSendString(_T("open \"assets\\audios\\bg_accele.mp3\" alias accele"), NULL, 0, NULL);//교쒼稜있속醵
mciSendString(_T("play accele"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "jump") {
mciSendString(_T("close jump"), NULL, 0, NULL);
mciSendString(_T("open \"assets\\audios\\jump.mp3\" alias jump"), NULL, 0, NULL);//契禿稜있
mciSendString(_T("play jump"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "win") {
mciSendString(_T("close all"), NULL, 0, NULL);//界岺杰唐稜있
mciSendString(_T("open \"assets\\audios\\win.mp3\" alias win"), NULL, 0, NULL);//價적稜있
mciSendString(_T("play win"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "lose") {
mciSendString(_T("close all"), NULL, 0, NULL);//界岺杰唐稜있
mciSendString(_T("open \"assets\\audios\\mario_death.mp3\" alias lose"), NULL, 0, NULL);//呵겨稜있
mciSendString(_T("play lose"), NULL, 0, NULL);//琦뻔꺄렴
}
else if(type == "killenemy") {
mciSendString(_T("close killenemy"), NULL, 0, NULL);
mciSendString(_T("open \"assets\\audios\\enemy_death.mp3\" alias killenemy"), NULL, 0, NULL);//柰밍价空稜있
mciSendString(_T("play killenemy"), NULL, 0, NULL);//琦뻔꺄렴
}
}
void Controller::show_ui(string type)
{
if(type == "welcome") {
IMAGE bg;
loadimage(&bg, _T("assets\\images\\map1.png"));
putimage(0, 0 , &bg);
setfillcolor(RGB(191, 120, 16));
setlinecolor(RGB(123, 61, 0));
setlinestyle(PS_SOLID, 3);
fillroundrect(60, 60, WINDOWS_WIDTH - 60, WINDOWS_HEIGHT - 120, 16, 16);
setbkmode(TRANSPARENT);
settextcolor(WHITE);
LOGFONT f;
gettextstyle(&f);
f.lfHeight = 64;
f.lfWidth = 0;
f.lfWeight = FW_BOLD;
f.lfQuality = ANTIALIASED_QUALITY;
wcscpy_s(f.lfFaceName, _T("붚竟"));
settextstyle(&f);
RECT r = {60,60,WINDOWS_WIDTH - 60,WINDOWS_HEIGHT - 240};
drawtext(_T("낚섬쯩쟁걔"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
f.lfHeight = 18;
settextstyle(&f);
r = {60,280,WINDOWS_WIDTH - 60,WINDOWS_HEIGHT - 240};
drawtext(_T("객Enter숩역迦"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
r = {60,360,WINDOWS_WIDTH - 60,WINDOWS_HEIGHT - 240};
drawtext(_T("객Esc숩藁놔"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
else if(type == "lose") {
setfillcolor(RGB(191, 120, 16));
setlinecolor(RGB(123, 61, 0));
setlinestyle(PS_SOLID, 3);
fillroundrect(60, 60, WINDOWS_WIDTH - 60, WINDOWS_HEIGHT - 240, 16, 16);
setbkmode(TRANSPARENT);
settextcolor(WHITE);
LOGFONT f;
gettextstyle(&f);
f.lfHeight = 64;
f.lfWidth = 0;
f.lfWeight = FW_BOLD;
f.lfQuality = ANTIALIASED_QUALITY;
wcscpy_s(f.lfFaceName, _T("붚竟"));
settextstyle(&f);
RECT r = {60,60,WINDOWS_WIDTH - 60,180};
drawtext(_T("You Lose!"), &r, DT_CENTER | DT_BOTTOM | DT_SINGLELINE);
f.lfHeight = 18;
settextstyle(&f);
r = {60,180,WINDOWS_WIDTH - 60,WINDOWS_HEIGHT - 240};
drawtext(_T("객Enter숩럿쀼"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
else if(type == "win") {
setfillcolor(RGB(191, 120, 16));
setlinecolor(RGB(123, 61, 0));
setlinestyle(PS_SOLID, 3);
fillroundrect(60, 60, WINDOWS_WIDTH - 60, WINDOWS_HEIGHT - 240, 16, 16);
setbkmode(TRANSPARENT);
settextcolor(WHITE);
LOGFONT f;
gettextstyle(&f);
f.lfHeight = 64;
f.lfWidth = 0;
f.lfWeight = FW_BOLD;
f.lfQuality = ANTIALIASED_QUALITY;
wcscpy_s(f.lfFaceName, _T("붚竟"));
settextstyle(&f);
RECT r = {60,60,WINDOWS_WIDTH - 60,180};
drawtext(_T("You Win!"), &r, DT_CENTER | DT_BOTTOM | DT_SINGLELINE);
f.lfHeight = 18;
settextstyle(&f);
r = {60,180,WINDOWS_WIDTH - 60,WINDOWS_HEIGHT - 240};
drawtext(_T("객Enter숩럿쀼"), &r, DT_CENTER | DT_VCENTER | DT_SINGLELINE);
}
FlushBatchDraw();
}