Paste: no
Author: | no |
Mode: | factor |
Date: | Mon, 15 May 2023 02:30:47 |
Plain Text |
MOUSEMSG test;
test = GetMouseMsg();
while (true)
{
FlushMouseMsgBuffer();
BeginBatchDraw();
if (test.x >= 480 && test.x <= 600 && test.y >= 330 && test.y <= 360)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(235, 153, 0));;
fillrectangle(480, 330, 600, 360);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(255,255,255));
outtextxy(480, 330, "开始游戏");
if (test.uMsg == WM_LBUTTONDOWN)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(255, 98, 0));;
fillrectangle(480, 330, 600, 360);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(200,200,200));
outtextxy(480, 330, "开始游戏");
}
if (test.uMsg == WM_LBUTTONUP)
{
MessageBox(NULL, "进入游戏后使用方向键控制车移动,按下esc暂停,撞到障碍物触发事件:\n金币:加3分\n石头:扣两分\n油桶:游戏结束", "游戏玩法", MB_SETFOREGROUND);
game(head);
}
}
else
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(255, 128, 0));;
fillrectangle(480, 330, 600, 360);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(250, 250, 250));
outtextxy(480, 330, "开始游戏");
}
if (test.x >= 480 && test.x <= 600 && test.y >= 390 && test.y <= 420)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(235, 153, 0));
fillrectangle(480, 390, 600, 420);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(255,255,255));
outtextxy(495, 390, "排行榜");
if (test.uMsg == WM_LBUTTONDOWN)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 98, 18));
setfillcolor(RGB(255, 128, 0));
fillrectangle(480, 390, 600, 420);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(200,200,200));
outtextxy(495, 390, "排行榜");
}
if (test.uMsg == WM_LBUTTONUP)
showlist(head);
}
else
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(255, 128, 0));
fillrectangle(480, 390, 600, 420);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(250, 250, 250));
outtextxy(495, 390, "排行榜");
}
if (test.x >= 480 && test.x <= 600 && test.y >= 450 && test.y <= 480)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(235, 153, 0));;
fillrectangle(480, 450, 600, 480);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(255,255,255));
outtextxy(480, 450, "退出游戏");
if (test.uMsg == WM_LBUTTONDOWN)
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(255, 98, 0));;
fillrectangle(480, 450, 600, 480);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(200,200,200));
outtextxy(480, 450, "退出游戏");
}
if (test.uMsg == WM_LBUTTONUP)
{
closegraph();
fp = fopen(".\\textures\\data.dat", "w");
head=sort(head);
for (; head != NULL; head = head->next)
fprintf(fp, "%s %d %s\n", head->name, head->score, head->pass);
fclose(fp);
exit(0);
}
}
else
{
setlinestyle(PS_SOLID, 3);
setlinecolor(RGB(255, 153, 18));
setfillcolor(RGB(255, 128, 0));;
fillrectangle(480, 450, 600, 480);
settextstyle(30, 0, "黑体");
setbkmode(TRANSPARENT);
settextcolor(RGB(250, 250, 250));
outtextxy(480, 450, "退出游戏");
}
EndBatchDraw();
test = GetMouseMsg();
}
New Annotation