⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameapp.cpp

📁 一个控制台VC++2005版的俄罗斯方块源码
💻 CPP
字号:
#include"Gameapp.h"

GameApp::GameApp()
{
	/*curState=LOGO;
	oldState=LOGO;
	pCurrent=new CLogo;*/
	strcpy(scoreStr,"分数:");
	strcpy(levelStr,"等级:");
	strcpy(nextStr,"下一方块:");
	frameColor=128;
	backColor=15;
}

GameApp::~GameApp()
{
}

void GameApp::Load()
{
		if(curState!=oldState)
		{
			switch(curState) 
			{
			case MENU:
				if(oldState==LOGO)
				{
				ClearBuffer(0,0,WIDTH,HEIGHT,backColor);
				DrawFrame(0,0,20,HEIGHT-1,frameColor);
				DrawText( 27, 1, 12,nextStr);
				DrawText( 26, 10, 12,levelStr);
				DrawText( 26, 12, 12,scoreStr);	
				}
				delete pCurrent;
				pCurrent=new CMenu;
				break;
			case GAME:
				delete pCurrent;
				pCurrent=new CGame;
				break;
			case HELP:
				delete pCurrent;
				pCurrent=new CHelp;
				break;
			case OVER:
				delete pCurrent;
				pCurrent=new COver;
				break;
			}
			oldState=curState;
		}		
}

void GameApp::Run()
{
	while(true)
	{
		Sleep(40);
		curState=pCurrent->Logic(curState!=PAUSE);
		if(curState==EXIT)
		{
			break;
		}
		if(curState!=PAUSE)
		{
		Load();	
		}
	}
	delete pCurrent;
}

⌨️ 快捷键说明

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