📄 game.h
字号:
// Game.h: interface for the CGame class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GAME_H__30472A3B_559C_452D_86DC_CFBACDBFC390__INCLUDED_)
#define AFX_GAME_H__30472A3B_559C_452D_86DC_CFBACDBFC390__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
class CGame
{
public:
bool MeetBorder(int a[][4],int direction,CPoint p);
void SetSpeed(int speed);
void MoveLeft();
void MoveRight();
void MoveNext();
void MoveRotate();
void DrawDiamonds();
void GameInit(CDC* pDC);
void Start();
void Draw(CDC *pDC);
void DrawDeclaration(int score,int speed);
void SetPosition(int x,int y);
void DrawNode(int i,int j,bool IsErase);
void DrawNode(int a[4][4],bool IsErase,CPoint position);
void LineDelete();
bool Rotatable(int a[][4],CPoint p,int b[][100]);
void DrawDeclareNode(int a[][4],bool IsErase);
bool EndFlag;
int GetSpeed();
COLORREF m_clrDeclareCube;//声明区域的方块颜色
COLORREF m_clrMaxRect;//最大区域颜色
COLORREF m_clrDeclareRect;//声明区域颜色
COLORREF m_clrDiamondsRect;//运行区域颜色
COLORREF m_clrLine;//方格线颜色
COLORREF m_clrDeclareFont; //声明区域的字体颜色
COLORREF m_clrGameOverFont; //游戏结束字体的颜色
BOOL m_bRandomCubeColor; //运动方块颜色随即产生
COLORREF m_clrCube;
int m_ColCount;
int m_RowCount;
int m_Score;
int Top;
int Left;
CBitmap* m_pInitialBitmap;
CBitmap* m_pBitmap;
CDC* m_pInitialMemDC;
CDC* m_pMemDC;
CGame();
virtual ~CGame();
private:
int m_Speed; //速度
int DiamondsA[100][100];
int DiamondsB[100][100]; //DiamondsA and DiamondsB存放着移动前和移动后的格子
int Cube[4][4]; // 当前图形
int CubeX[4][4]; //上一图形
int CubeR[4][4]; //变换后的图形
CPoint CubePosition,CubePositionX; //当前图形和上一图形的左上角位置
int CountMatrix; //当前可能出现的图形形状数,
CRect GameRect; //俄罗斯方块的区域
CRect DeclareRect; //说明区域,即上面一块的白色区域
int dx;
int dy; //每一个格的高度和宽度
int m_StepScore;
private:
void Move(int direction);
void CubeAssign(int a[][4],int b[][4]);//把叔祖a赋给数组b
COLORREF GetRunCubeColor();//得到运动方块的颜色
void GenerateDiamond();//随机产生方块数组,存入CubeMatrix中.
};
#endif // !defined(AFX_GAME_H__30472A3B_559C_452D_86DC_CFBACDBFC390__INCLUDED_)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -