📄 gameapp.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 + -