common.h

来自「一个控制台VC++2005版的俄罗斯方块源码」· C头文件 代码 · 共 47 行

H
47
字号
#ifndef __COMMON_H__
#define __COMMON_H__

#include <conio.h>
#include <iostream>
#include <windows.h>
#include <stdio.h>
#include <string.h>
#include <time.h>

enum GameState
{
	LOGO,
	MENU,
	GAME,
	EXIT,
	PAUSE,
	HELP,
	OVER,
};

#define WIDTH 40	//输出缓冲宽
#define HEIGHT 22   //输出缓冲高

#define KEY_ENTER  13 
#define KEY_ESC	   27 
#define KEY_UP	   72 
#define KEY_DOWN   80
#define KEY_RIGHT  77
#define KEY_LEFT   75 

// 清屏
void ClearBuffer(int x,int y,int w,int h,int color);

// 画窗口边框
void DrawFrame(int x,int y,int w,int h,int color);

// 设置控制台属性
void SetConsoleInfo();

// 输出文本
void DrawText( short x, short y, WORD color,const char* str );

//读取控制台字符(2个字节)
void readbufchar(int x,int y,char* c,WORD* cs=NULL);

#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?