Click here to Skip to main content
Click here to Skip to main content
Articles » Multimedia » DirectX » Games » Downloads
 
Add your own
alternative version

Falling Blocks

, 17 Apr 2008 CPOL
A game written using Visual C++ and DirectX.
fallingblocks.zip
FallingBlocks.exe
fallingblocksvc7.zip
FallingBlocks
Block are Falling.doc
DirectX.ico
Drowning.wav
Graphics.bmp
LineComplete.wav
Move.wav
Place.wav
Web Falling Blocks.doc
fallingblocksvs2008.zip
Block are Falling.doc
DirectX.ico
Drowning.wav
FallingBlocks.suo
Graphics.bmp
LineComplete.wav
Move.wav
Place.wav
Web Falling Blocks.doc
fallingblocks_src.zip
Block are Falling.doc
DirectX.ico
Drowning.wav
FallingBlocks.dsp
FallingBlocks.dsw
Graphics.bmp
LineComplete.wav
Move.wav
Place.wav
Web Falling Blocks.doc
// 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 Service 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.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Xavier John
Software Developer
United States United States
No Biography provided

| Advertise | Privacy | Mobile
Web01 | 2.8.141015.1 | Last Updated 17 Apr 2008
Article Copyright 2001 by Xavier John
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid