// 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_)
By viewing downloads associated with this article you agree to the Terms of use and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.
This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)
Skills that self-taught computer programmers lack