Click here to Skip to main content
15,881,172 members
Articles / Programming Languages / C++

A Fast Version of Conway's Game of Life with Thread and DirectX Draw

Rate me:
Please Sign up or sign in to vote.
4.42/5 (14 votes)
14 Apr 2009CPOL4 min read 57K   903   30  
A fast version of Conway's Game of Life with thread and DirectX draw
// DDrawSystem.h: interface for the CDirectXDraw class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_DIRECTXDRAW_H__1E152EB4_ED1D_4079_BDD4_773383DD98C8__INCLUDED_)
#define AFX_DIRECTXDRAW_H__1E152EB4_ED1D_4079_BDD4_773383DD98C8__INCLUDED_

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

#include "ddraw.h"


#define _CHARACTORBUILDER_
//#include "../GameLib/Image.h"

class CDirectXDraw  
{
public:
	CDirectXDraw();
	virtual ~CDirectXDraw();

	BOOL Init(HWND hWnd);
	void Terminate();
	void Clear();
	void BarDraw(int *m_nNumberArray, COLORREF barColor,CRect &rectView);
	void CellDraw(char *m_nNumberArray, COLORREF cellColor,CRect &rectView,BOOL bGrid = FALSE);
	void Display();
	int  nFullClientWidth; 
	int  nFullClientHeight;
	CBrush m_redBrush;
	BOOL	m_bInitial;


protected:
	LPDIRECTDRAW7 m_pDD;
	LPDIRECTDRAWSURFACE7 m_pddsFrontBuffer;
	LPDIRECTDRAWSURFACE7 m_pddsStoreBuffer;
    LPDIRECTDRAWCLIPPER pcClipper;

	HWND hWnd;
};

#endif // !defined(AFX_DIRECTXDRAW_H__1E152EB4_ED1D_4079_BDD4_773383DD98C8__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
Founder SmartTick Software Inc.
Canada Canada
Jerry Jiang(BOLIANG JIANG)

A passionate software developer since 1992

Education:Master of Computer Science.

jerry@smarttick.com

Comments and Discussions