www.pudn.com > Tetris.rar > TGrid.h


#ifndef __GRID_H 
#define __GRID_H 
 
#include  
 
#include "TBlock.h" 
 
const int KGridX=10; 
const int KGridY=20; 
 
 
// A Grid is used to put a Block's type to its Content and detect if there's a Collide. 
class TGrid 
{ 
// Constuct 
public: 
	TGrid(); 
	static TGrid NewGrid(); 
 
/////////////////////////////////////////////////////////////////////// 
// Other Method 
public: 
	bool DoesCollide(const TBlock& aBlock, const TPoint& aPoint) const; 
 
	void PutBlock(const TBlock& aBlock, const TPoint& aPoint); 
 
	void Clear(); 
 
 
////////////////////////////////////////////////////////////////////////// 
// Data 
public: 
	TFixedArray iMask; 
 
	TFixedArray, KGridY> iContent; 
}; 
 
 
#endif