打字小游戏(天降字母)Visual Studio+EasyX

 
#include <graphics.h>
#include <conio.h>
#include <time.h>
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<windows.h>
#pragma  comment(lib,"WinMM.Lib")
// 欢迎界面
void welcome()
{
// 输出屏幕提示
cleardevice();
IMAGE img;
loadimage(&img, L"E:\\代码\\作业\\c语言作业\\photo\\start.jpg", 1200, 800);
putimage(0, 0, &img);
setcolor(WHITE);
//setfont(16, 0, "宋体");




// 实现闪烁的“按任意键继续”
int c = 255;
TCHAR s[] = _T("黑体");
settextstyle(50, 0, s);
while (!kbhit())
{
setcolor(RGB(c, 0, 0));
TCHAR ax[] = _T("按任意键继续");
outtextxy(690, 630,ax);
c -= 8;
if (c < 0) c = 255;
Sleep(20);
}
getch();
cleardevice();
}


void regulation1()
{
cleardevice();
IMAGE img;
loadimage(&img, L"E:\\代码\\作业\\c语言作业\\photo\\规则new.jpg", 1200, 800);
putimage(0,0,&img);
/* setcolor(WHITE);
TCHAR s[] = _T("黑体");
settextstyle(50, 0, s);
TCHAR ch[] = _T("游戏规则:");
outtextxy(110, 50, ch);
TCHAR ch1[] = _T("按Esc键退出");
outtextxy(110, 110, ch1);
TCHAR ch2[] = _T("字母掉落到红线则失去一条命");
outtextxy(110, 170, ch2);
TCHAR ch3[] = _T("玩家共有三条命,用尽则游戏结束");
outtextxy(110, 230, ch3);   */
getch();
cleardevice();


}


// 退出界面   
void goodbye(time_t end,time_t start,int flag)
{
time_t timep;
int i = end - start;
char a[10] = {'\0'};
TCHAR s[100] = {0};
char ff[10] = {0};
TCHAR fff[100] = { 0 };
cleardevice();
setcolor(RED);
IMAGE img;
loadimage(&img, L"E:\\代码\\作业\\c语言作业\\photo\\GAMEOVER.jpg", 1200, 800);
putimage(0, 0, &img);
//setfont(48, 0, "黑体");
TCHAR style[] = _T("黑体");
settextstyle(40, 0, style);
TCHAR ch[] = _T("游戏时间:");
outtextxy(104, 180,ch);
TCHAR chf[] = _T("失败次数:");
outtextxy(854, 180,chf);
sprintf(a, "%d", i);
sprintf(ff, "%d", flag);
#ifdef UNICODE  
MultiByteToWideChar(CP_ACP, 0, a, -1, s, 100);
#else  
strcpy(a, s);
#endif  


#ifdef UNICODE  
MultiByteToWideChar(CP_ACP, 0, ff, -1, fff, 100);
#else  
strcpy(ff, fff);
#endif


//s = (TCHAR*)a;
outtextxy(200, 220, s);
outtextxy(950, 220, fff);
getch();
}


//键盘
void keybroad()
{
int i,k,j,m;
char one[] = {'q','w','e','r','t','y','u','i','o','p'};
char two[] = {'a','s','d','f','g','h','j','k','l'};
char three[] = { 'z', 'x', 'c', 'v', 'b', 'n', 'm' };
char four[] = {'~','!','@','#','$','%','^','&','*','(',')','_','+'};
char five[] = {'`','1','2','3','4','5','6','7','8','9','0','-','='};
char oneend[] = { '{', '}', '|' };                             //800 start
char oneend1[] = { '[', ']', '\\' };
char three1[] = {':','"'};
char three2[] = { ';','\'' };
char h1[] = {'<','>','?'};
char h2[] = {',','.','/'};
setcolor(WHITE);
rectangle(220, 600, 290, 640);  //Tab   (220,600),(290,640)
line(220, 600, 220 - 3, 603);
line(220 - 3, 603, 220 - 3, 643);
line(220, 640, 220 - 3, 643);
line(290, 640, 293, 643);
line(220 - 3, 643, 293, 643);
line(290, 600, 293, 603);
line(293, 603, 293, 643);
TCHAR ch[] = _T("Arial");
settextstyle(20, 0, ch);
TCHAR tab[]= _T("Tab");
outtextxy(230, 610, tab);


rectangle(220, 650, 300, 690);  //CapsLock   (220,650),(300,690)
line(220, 650, 220 - 3, 653);
line(220 - 3, 653, 220 - 3, 693);
line(220, 690, 220 - 3, 693);
line(300, 690, 303, 693);
line(220 - 3, 693, 303, 693);
line(300, 650, 303, 653);
line(303, 653, 303, 693);
settextstyle(17, 0, ch);
TCHAR CapsLock[] = _T("CapsLock");
outtextxy(230, 660, CapsLock);
                                              
rectangle(870, 550, 940, 590);  //Backspace   (870,550),(940,590)
line(870, 550, 870 - 3, 553);
line(870 - 3, 553, 870 - 3, 593);
line(870, 590, 870 - 3, 593);
line(940, 590, 943, 593);
line(870 - 3, 593, 943, 593);
line(940, 550, 943, 553);
line(943, 553, 943, 593);
settextstyle(16, 0, ch);
TCHAR Backspace[] = _T("Backspace");
outtextxy(875, 560, Backspace);






rectangle(220, 700, 330, 740);  //Shift   (220,700),(330,740)
line(220, 700, 220 - 3, 703);
line(220 - 3, 703, 220 - 3, 743);
line(220, 740, 220 - 3, 743);
line(330, 740, 333, 743);
line(220 - 3, 743, 333, 743);
line(330, 700, 333, 703);
line(333, 703, 333, 743);
settextstyle(20, 0, ch);
TCHAR Shift[] = _T("Shift");
outtextxy(230, 710, Shift);


for (i = 220; i < 860; i = i + 50)      //  键盘第零行13个键
{
rectangle(i, 550, i + 40, 590);    //键盘第一个字母坐标(220,550),(260,590)
line(i, 550, i - 3, 553);
line(i - 3, 553, i - 3, 593);
line(i, 590, i - 3, 593);
line(i + 40, 590, i + 43, 593);
line(i - 3
  • 7
    点赞
  • 34
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值