Game.h(2)

#include<windows.h>
#include<stdlib.h>
#include<fstream>
#include<stdio.h>
#include<conio.h>
#include<time.h>
namespace std{
	#define KEY 224
	#define KEY_UP 72
	#define KEY_DOWN 80
	#define KEY_LEFT 75
	#define KEY_RIGHT 77
	#define UP ((KEY<<8)|KEY_UP)
	#define DOWN ((KEY<<8)|KEY_DOWN)
	#define LEFT ((KEY<<8)|KEY_LEFT)
	#define RIGHT ((KEY<<8)|KEY_RIGHT)
	int getin(){
		int __t__return__ch__;
		int __t__in__ch__first__=getch();
		int __t__in__ch__second__=0;
		if(__t__in__ch__first__==KEY){
			__t__in__ch__second__=getch();
			__t__return__ch__=(__t__in__ch__first__<<8)|__t__in__ch__second__;
		}else{
			__t__return__ch__=__t__in__ch__first__;
		}
		return __t__return__ch__;
	}
	void game_init(){
		srand(time(NULL));
		return;
	}
	void cls(){
		system("cls");
		return;
	}
	void pause(){
		system("pause");
		return;
	}
	void sleep(unsigned long __t__wait__time__){
		_sleep(__t__wait__time__);
		return;
	}
	void color(unsigned int __t__color__){
		SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE),__t__color__);
		return;
	}
	void setxy(unsigned int __t__xx__,unsigned int __t__yy__){
	    COORD __t__position__={__t__yy__*2,__t__xx__};
	    SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE),__t__position__);
	    return;
	}
	void T(const char* __t__words__,unsigned int __t__set__words__color__=15){
		color(__t__set__words__color__);
		printf(__t__words__);
		return;
	}
	void T(const char* __t__words__,unsigned int __t__words__xx__,unsigned int __t__words__yy__,unsigned int __t__set__words__color__=15){
		color(__t__set__words__color__);
		setxy(__t__words__xx__,__t__words__yy__);
		printf(__t__words__);
	}
	int random(int __t__left__,int __t__right__){
		int __t__lenght__=__t__right__-__t__left__+1;
		int __t__rand__number__=rand()%__t__lenght__+__t__left__;
		return __t__rand__number__;
	}
	void title(char __t__title__[]){
		unsigned int __t__title__size__=sizeof(__t__title__);
		char __t__set__title__[__t__title__size__+7];
		__t__set__title__[0]='t';
		__t__set__title__[1]='i';
		__t__set__title__[2]='t';
		__t__set__title__[3]='l';
		__t__set__title__[4]='e';
		__t__set__title__[5]=' ';
		for(unsigned int __t__cont__=0;__t__cont__<__t__title__size__;__t__cont__++)
			__t__set__title__[__t__cont__+6]=__t__title__[__t__cont__];
		__t__set__title__[__t__title__size__+6]='\0';
		system(__t__set__title__);
	}
}

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值