只借助DEV-C++、CSDN、作者聪明的大脑做一款3A大作 (1)

代码

#include <bits/stdc++.h>
#include <windows.h>
#define KEY_DOWN(VK_NONAME) ((GetAsyncKeyState(VK_NONAME) & 0x8000) ? 1:0)
using namespace std;
HANDLE han = GetStdHandle(-11);
void hide(),printstr(char *buf, int startY, int startX),color(int a),Start(),Zhuym(),ksyx();
void hide(){
	CONSOLE_CURSOR_INFO cursor;
	cursor.bVisible = 0;
	cursor.dwSize = 1;
	SetConsoleCursorInfo(han,&cursor);
}

void printstr(char *buf, int startY, int startX)
{
	HANDLE hd;
	COORD pos;
	pos.X = startX;
	pos.Y = startY;
	hd = GetStdHandle(STD_OUTPUT_HANDLE);
	SetConsoleCursorPosition(hd, pos);
	cout<<buf;
}
void color(int a){
	SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),a);
}
void Start()
{
	system("mode con cols=71 lines=30");
	hide();
	cout<<"loading.......\n";
	for (int i=1;i<=71;i++)cout<<"-",Sleep(100);
	system("cls");
	system("color FF");
	system("color FF");
	
	color(255);
	for (int i=1;i<=71*30;i++)cout<<' ';
	system("color FF");
	Sleep(1000);
	printstr("■■■    ■    ■■■      ■■■  ■  ■  ■■■",10,12);
	printstr("■      ■  ■    ■        ■      ■  ■  ■    ",11,11);
	printstr("■      ■■■    ■        ■■■    ■    ■■■",12,10);
	printstr("■      ■  ■    ■        ■      ■  ■  ■    ",13,9);
	printstr("■■■  ■  ■    ■    ■  ■■■  ■  ■  ■■■",14,8);
	Sleep(3000);
	system("color F7");
	Sleep(250);
	system("color F8");
	Sleep(250);
	system("color F0");
	Sleep(1500);
	printstr("抵制不良游戏,拒绝盗版游戏。注意自我保护,谨防受骗上当。\n适度游戏益脑,沉迷游戏伤身。合理安排时间,享受健康生活。",26,0);
	Sleep(2000);
}

HWND h=GetForegroundWindow();
void Zhuym()
{
	printstr("■■■    ■    ■■■      ■■■  ■  ■  ■■■",3,12);
	printstr("■      ■  ■    ■        ■      ■  ■  ■    ",4,11);
	printstr("■      ■■■    ■        ■■■    ■    ■■■",5,10);
	printstr("■      ■  ■    ■        ■      ■  ■  ■    ",6,9);
	printstr("■■■  ■  ■    ■    ■  ■■■  ■  ■  ■■■",7,8);
	Sleep(1000);
	color(248); 
	printstr("┌────────┐",13,25);
	printstr("│    开始游戏    │",14,25);
	printstr("└────────┘",15,25);
	while(1)
	{
		POINT p;
		GetCursorPos(&p);
		ScreenToClient(h,&p);   
		if (KEY_DOWN(VK_LBUTTON)&&207<=p.x&&p.x<=351&&214<=p.y&&p.y<=245)
		{
			color(120); 
			printstr("┌────────┐",13,25);
			printstr("│    开始游戏    │",14,25);
			printstr("└────────┘",15,25);
			color(248);
			while(KEY_DOWN(VK_LBUTTON));
			printstr("┌────────┐",13,25);
			printstr("│    开始游戏    │",14,25);
			printstr("└────────┘",15,25);
			ksyx();
		}
		Sleep(20);
	}
	while(1); 
}
void ksyx()
{
	exit(0);
	//待开发……………………; 
}
int main()
{
	Start();
	system("cls");
	Zhuym();
}

引用

  1. 在控制台指定位置输出
  2. (C++)光标的设置与隐藏
  3. system调整控制台大小的问题
  4. 【题目讲解】c++怎么判断键盘按下?
  5. C++ 获取鼠标点击位置
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值