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

📄 cblockpool.h

📁 俄罗斯方块3D 程序+源码俄罗斯方块3D(程序+源码
💻 H
字号:
#ifndef CBlockPool_h
#define CBlockPool_h

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


#include "CDynamicArray.h"
#include "CPoolCell.h"
#include "Struct.h"

class CGameRender;


/////////////////////////////////////////////////////////////////////////////
//方块池类,描述下落后的方块堆。一个二维数组描述方块池,每个元素是方块的元素。
//0表示没有任何方块
/////////////////////////////////////////////////////////////////////////////
class CBlockPool  
{

public:
	friend class CGameRender;
	CBlockPool();
	~CBlockPool();

	bool Init( int row, int col );
	void Free();
	bool ReSet( int row, int col );

	bool IsAvailable( int row, int col );			//判断一个位置是否为空
	bool IsAvailable( const POSITION &position )	
	{ return IsAvailable( position.row, position.col ); }

	void SetCell( const POSITION &position, 
					int iValue );					//设置一个格子
						
	void UpdateHighestLine( int row );				//更新最高行

	void CheckFullLine();							//检测已满的行
	void AdjustPool();								//调整方块堆
	void OnFinishAdjust();
	bool IsPoolFull()
	{ return m_iHighestLine >= m_iRow - 1; }

private:
	int GetNumOfLine( int row );					//获取一行的方块数
	void ClearLine( int row );						//清空一行
	bool GetAdjustBlock();							//获取边界方块

private:
	int	m_iRow, m_iColumn;							//数组的行数,列数
	int m_iHighestLine;								//方块堆的最高行
	int m_iFirstFullLine;							//第一个满行,为-1时没有满行

	CDoubleArray<CPoolCell>	m_BlockPool;			//二维数组的方块池

};

#endif 

⌨️ 快捷键说明

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