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

📄 shape.h

📁 一个完整的俄罗斯方块游戏
💻 H
字号:
// Shape.h: interface for the CShape class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_SHAPE_H__B3B18BF2_FC20_47EF_83D0_196C3FE26760__INCLUDED_)
#define AFX_SHAPE_H__B3B18BF2_FC20_47EF_83D0_196C3FE26760__INCLUDED_

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

#define NUM_COLORS   5
////////////////////////////////////////////////////////////////////////
// CShape class creates the shapes from the given array. It helps with 
// moving the shape and checks if it had gone outside the boundary or 
// hit any other blocks.
///////////////////////////////////////////////////////////////////////

class CShape:public CBlockList  
{
     CFlooredBlocks* m_pFlooredBlocks;
	 static const short m_pStockShapes[];
	 static short s_nNoOfShapes;   // Number of shapes in the array.
	 static short s_cShapesArrayUsage;  // No of shapes using the array
	                                    // when it becomes 0 the array is deleted
 	 static const short** s_pShapes;    // Pointer to the array of shapes
	 static short s_nMaxNoOfShapesAllowed; // Max No Of shapes allowed. This number can 
	 // be changed to limit the shapes that will be used from the array. 
	 // This way some crazy shapes can be added to the end of the array and only 
	 // be used if the user switches to the crazy mode.

 	 short m_nColor;

   
public:
	static bool SetMaxNoOfShapesAllowed(short nMax = s_nNoOfShapes);
	void NextShape();
	bool Rotate();
	bool CreateShape();
	bool MoveUp();
	bool MoveDown();
	bool MoveRight();
	bool MoveLeft();
	void dbgDisplay();
	bool MoveTo(short nX, short nY);
	void Display();
	bool CreateRandShape(short nX = 0, short nY = 0); // Creates a shape from the build in shapes at random. 
	                        // This function creates the blocks and gives it the color;
	void ConvertToSpaceCoord();
	bool IsContained(RECT rcBoundary, short nX, short nY);
	CShape(CFlooredBlocks* pFlooredBlocks, const short* pShape = m_pStockShapes);
	virtual ~CShape();

private:
	short m_nY;
	short m_nX;
	short m_nRotate; // Current orientation
	short m_nTotalRotate; // Total Number of orientations this shape has.
	short m_nShape;
};

#endif // !defined(AFX_SHAPE_H__B3B18BF2_FC20_47EF_83D0_196C3FE26760__INCLUDED_)

⌨️ 快捷键说明

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