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

📄 game.h

📁 一个wince操作系统下面的俄罗斯方块的小游戏
💻 H
字号:
// Game.h: interface for the CGame class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GAME_H__56B3156E_EA05_11D4_9FE2_00D0590D4CE7__INCLUDED_)
#define AFX_GAME_H__56B3156E_EA05_11D4_9FE2_00D0590D4CE7__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

class CGame  
{
public:
	CDC* m_pMemDC;		//内存DC
	CDC* m_pInitialMemDC;	//
	CBitmap* m_pBitmap;		//存放上一次移动时的外观
	CBitmap* m_pInitialBitmap;	//存放游戏未开始时的外观
	int Left;
	int Top;
	int m_Score;
	int m_RowCount,m_ColCount;

	//颜色设置
	COLORREF m_clrCube;//运动方块颜色
	COLORREF m_clrDeclareCube;//声明区域的方块颜色
	COLORREF m_clrMaxRect;//最大区域颜色
	COLORREF m_clrDeclareRect;//声明区域颜色
	COLORREF m_clrDiamondsRect;//运行区域颜色
	COLORREF m_clrLine;//方格线颜色
	COLORREF m_clrDeclareFont;	//声明区域的字体颜色
	COLORREF m_clrGameOverFont;	//游戏结束字体的颜色
	BOOL	m_bRandomCubeColor;	//运动方块颜色随即产生
private:
	BOOL m_Music;	//声音开关
	int m_Level;	//级别
	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;					//每一个格的高度和宽度
	void Move(int direction);
	int m_StepScore;

public:
	void PlayMusic(BOOL flag);
	int GetLevel();
	void ReadGame(CString filename);
	void SaveGame(CString filename);
	int GetSpeed();
	bool EndFlag;
	void DrawDeclareNode(int a[][4],bool IsErase);
	bool Rotatable(int a[][4],CPoint p,int  b[][100]);
	void LineDelete();
	bool MeetBorder(int a[][4],int direction,CPoint p);
	void DrawNode(int a[4][4],bool IsErase,CPoint position);
	void DrawNode(int i,int j,bool IsErase);
	void SetPosition(int x,int y);
	void DrawDeclaration(int score,int speed,int level);

	void Draw(CDC *pDC);
	void Start();
	void GameInit(CDC* pDC);
	void DrawDiamonds();
	void MoveRotate();
	void MoveNext();
	void MoveRight();
	void MoveLeft();
	void SetSpeed(int speed);
	void SetLevel(int level);

	CGame();
	virtual ~CGame();

private:
	COLORREF GetRunCubeColor();//得到运动方块的颜色
	void CubeAssign(int a[][4],int b[][4]);	//把叔祖a赋给数组b
	void GenerateDiamond();	//随机产生方块数组,存入CubeMatrix中.


};

#endif // !defined(AFX_GAME_H__56B3156E_EA05_11D4_9FE2_00D0590D4CE7__INCLUDED_)

⌨️ 快捷键说明

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