Click here to Skip to main content
15,881,687 members
Articles / Multimedia / DirectX

Falling Blocks

Rate me:
Please Sign up or sign in to vote.
4.95/5 (11 votes)
17 Apr 2008CPOL 270.1K   9.2K   72  
A game written using Visual C++ and DirectX.
// FlooredBlocks.h: interface for the CFlooredBlocks class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_FLOOREDBLOCKS_H__E4FB0140_C598_4061_A528_8D863FFCDB14__INCLUDED_)
#define AFX_FLOOREDBLOCKS_H__E4FB0140_C598_4061_A528_8D863FFCDB14__INCLUDED_

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

//////////////////////////////////////////////////////////////////////
// The CFlooredBlocks maintains the list of blocks that have been placed 
// on the floor. All the shapes that fall down are added to this list.
//////////////////////////////////////////////////////////////////////
class CFlooredBlocks: public CBlockList  
{
public:
	bool IsGameOver();

	void IncrementYabove(short nY); // Helper function for CheckAndRemoveContinuousBlocks 
	                                // used to drop the blocks above the removed line.
	bool IsOccupied(CBlockList& BlockList, short nX, short nY);
	bool Insert(CBlockList& BlockList);
	void Display();
	short CheckAndRemoveContinuousBlocks(); // Returns the number of lines removed. 
	                                        // This can be used to calculate the score. 
	                                        // This function also adjust the coordinates 
	                                        // of all the other blocks so that they fall.
	                                        
	bool IsOccupied(short X, short Y);
	CFlooredBlocks(RECT rcBoundary);
	virtual ~CFlooredBlocks();
	RECT m_rcBoundary;
};

#endif // !defined(AFX_FLOOREDBLOCKS_H__E4FB0140_C598_4061_A528_8D863FFCDB14__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)


Written By
Software Developer
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions