help.cpp

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

CPP
59
字号
#include"Help.h"

CHelp::CHelp()
{
	//↑↓→←
	
	backColor=15;//黑底白字
	charColor=10;//绿色
	buttonColor=240;//白底黑字
	strcpy(help[0],"上(变形):");
	strcpy(help[1],"下:");
	strcpy(help[2],"左:");
	strcpy(help[3],"右:");
	strcpy(help[4],"到底:");
	strcpy(help[5],"按Enter返回");
	strcpy(button[0],"↑");
	strcpy(button[1],"↓");
	strcpy(button[2],"←");
	strcpy(button[3],"→");
	strcpy(button[4],"W");
	strcpy(button[5],"S");
	strcpy(button[6],"A");
	strcpy(button[7],"D");
	strcpy(button[8],"space");
	ClearBuffer(2,1,20,20,backColor);
	for(int i=0;i<5;i++)
	{	
		DrawText( 7-strlen(help[i])/2, 4+i*2, charColor,help[i] );
	}
	for(int i=0;i<4;i++)
	{	
		DrawText( 14, 4+i*2, buttonColor,button[i]);
		DrawText( 14+3, 4+i*2, buttonColor,button[i+4]);
	}
	DrawText( 14, 12, buttonColor,button[8]);
	DrawText( 5, 16, charColor,help[5] );
}

CHelp::~CHelp()
{
}

GameState CHelp::Logic(bool goOn)
{
	fflush( stdin );
	if(_kbhit())
	{
		int key=_getch();
		if(key<0)
		{
			key=_getch();
		}
		if(key==KEY_ENTER)
		{
			return MENU;
		}
	}
	return HELP;
}

⌨️ 快捷键说明

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