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

📄 downboxes.h

📁 俄罗斯方块
💻 H
字号:
#include "Afxwin.h"
#define BOXSIZE 15
#define TYPE_COUNT  2 //种类个数,目前共有L,L',I,N,N',T6种

///////////////////////////////////////////////////////////
class SingleBox:public CObject
{
private:
	RECT rectBoxBorder;
	long lBoxSize;
public:
	SingleBox();
	SingleBox(RECT & rectBorder);
	void SetBoxBorder(RECT & rectBorder);
	RECT *GetBoxBorder();
	void Draw(CDC * pDC);
	void Erase(CDC *pDC);
	void MoveBox(long lDx,long lDy);
};
///////////////////////////////////////////////////////////
class DownBoxes:public CObject
{
protected:
//	DownBoxesGame *p;
	long lShapeType;
	long lBoxSize;
	POINT pointBasePoint;
	POINT pointOffset;
	long lCurrentDirection;//store the rotation state ,value:{1,2,3,4}   
	CObArray obBoxArray;
	CObArray * pAllBoxesArray;
	virtual void SetBoxOfSpecificDirection(long lDirection)=0;//设置特定方向时候的各个Box,在Initialize()中被调用
private:
	long IsCanDown(void);
	long IsOverlappedSingleBox(SingleBox * pSingleBoxA,SingleBox * pSingelBoxB);//judge whether two boxes are overlapped
protected:
	void SetSingleBox(long lIndex,long lLeft,long lTop); //is used in SetBoxOfSpecificDirection(long)
public:
	DownBoxes();
	void SetBasePoint(POINT pointBasePoint);
	long GetShapeType(void);
    void Draw(CDC *pDC);
	long GetCurrentDirection(void);
	CObArray *GetObArray();
	virtual void ClockWiseRotation()=0;
	virtual void CounterClockWiseRotation()=0;
	void Initialize();
	void SetAllBoxesPointer(CObArray *);
	void MoveLeft();
	void MoveRight();
	void MoveDown();
	void MoveUp();
	void Move(long lDx,long lDy);

	
};
//////////////////////////////////////////////////
class DownBoxes1 :public DownBoxes
{
public:
	//void GetCertainDirectionBoxes(long lDirection);
	void SetBoxOfSpecificDirection(long lDirection);//override the virtual function
public:
	DownBoxes1();
//	void Initialize();
	void ClockWiseRotation();  //此处是在数据结构(文档类)上旋转,而视觉上的旋转要通过UpdateAllView进而调用OnDraw重画来实现
	void CounterClockWiseRotation();
};
//////////////////////////////////////////////////
class DownBoxes2 :public DownBoxes
{
public:
	void SetBoxOfSpecificDirection(long lDirection);//override the virtual function
public:
	DownBoxes2( );
//	void Initialize();
	void ClockWiseRotation();  //此处是在数据结构(文档类)上旋转,而视觉上的旋转要通过UpdateAllView进而调用OnDraw重画来实现
	void CounterClockWiseRotation();
};
//////////////////////////////////////////////////
class DownBoxesGame:public CObject
{
private:
	RECT rectBirthArea;
	RECT rectPlayArea;
	long lSpeed;
	DownBoxes * pDownBoxes;
	DownBoxes * CreateRandomBoxes();
	CObArray obAllBoxesArray;
public:
	DownBoxesGame();
	void SetFrame();
	void OnTimer(UINT nIDEvent);
	void Draw(CDC * pDC);
	void DrawFrame(CDC * pDC);
	long IsOverFrame(DownBoxes * pDownBoxes);
	DownBoxes *GetDownBoxes();
};
//////////////////////////////////////////////////
class ScoreBoard
{
};

⌨️ 快捷键说明

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