文件名称:打字游戏,vs环境
文件大小:3KB
文件格式:VCXPROJ
更新时间:2021-11-03 03:19:56
11111
#include"head.h" void PlayMusic(const char* FileName) { char cmdString[50] = "open "; strcat_s(cmdString, FileName); strcat_s(cmdString, " alias bkmusic"); mciSendString(cmdString, NULL, 0, NULL); //打开音乐 mciSendString("play bkmusic repeat", NULL, NULL, NULL); //循环播放次音乐 } int main() { PlayMusic("111.mp3 ");//播放 initgraph(600,480); int Easy = 0, General = 0, Hard = 0, *EasyScore = &Easy;, *GeneralScore = &General;, *HardScore = &Hard; Enter_Interface(EasyScore,GeneralScore,HardScore); system("pause"); return 0; } //开始界面 void Enter_Interface(int*EasyScore, int*GeneralScore, int*HardScore) { char s[5]; cleardevice();//清屏 IMAGE bk; loadimage(&bk;,"sk1.jpg",600,480); putimage(0,0,&bk;); setbkmode(TRANSPARENT); int r = rand() % 256; int g = rand() % 256; int b = rand() % 256; settextstyle(48, 0, "楷体"); setcolor(RGB(r, g, b)); // outtextxy(125, 130, "按对应数字进入游戏"); setcolor(RED); settextstyle(64, 0, "新宋体"); BeginBatchDraw(); IMAGE bk; for(int y=0;y<40;y++) { putimage(0,0,&bk;); outtextxy(172, y, "字"); outtextxy(172+64, y, "母"); outtextxy(172+64+64, y, "游"); outtextxy(172+64+64+64, y, "戏"); FlushBatchDraw(); Sleep(50);//设置延时 } EndBatchDraw(); //outtextxy(172, 40, "字母游戏"); setcolor(WHITE); settextstyle(40, 0, "宋体"); outtextxy(125, 130, "按对应字母进入游戏"); settextstyle(30, 0, "宋体"); outtextxy(202, 194, "1、简单"); outtextxy(202, 283, "2、一般"); outtextxy(202, 372, "3、困难"); settextstyle(24, 0, "新宋体"); outtextxy(334, 259, "最高分:"); _itoa_s(*EasyScore, s, 10);//将整形数据转为字符串 outtextxy(440, 259, s); outtextxy(334, 348, "最高分:"); _itoa_s(*GeneralScore, s, 10); outtextxy(440, 348, s); outtextxy(334, 437, "最高分:"); _itoa_s(*HardScore, s, 10); outtextxy(440, 437, s); char choose;