Click here to Skip to main content
15,896,154 members
Articles / Desktop Programming / MFC

State Pattern in C++ Applications

Rate me:
Please Sign up or sign in to vote.
4.68/5 (31 votes)
13 Sep 20014 min read 178.9K   2.6K   85  
Small game framework based on the state pattern
// IntroductionState.h: interface for the CIntroductionState class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_INTRODUCTIONSTATE_H__AB04DC09_BB05_11D4_87CB_00C04F73BBBB__INCLUDED_)
#define AFX_INTRODUCTIONSTATE_H__AB04DC09_BB05_11D4_87CB_00C04F73BBBB__INCLUDED_

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

#include "StarfieldSimulator.h"
#include "GameState.h"

class CIntroductionState : public CGameState
{
public:
	virtual void Init();
	virtual void Resize();
	virtual void Draw(CGameManager * pManager, CDC * pDC);
	virtual void Update(CGameManager * pManager);
	virtual void KeyboardEvent(CGameManager* pManager, char nKey);

	static CIntroductionState* Instance();
	
	virtual ~CIntroductionState();

protected:
	CFont m_TextFont;
	CIntroductionState();

private:
	static CIntroductionState m_IntroductionState; // singleton...
};

#endif // !defined(AFX_INTRODUCTIONSTATE_H__AB04DC09_BB05_11D4_87CB_00C04F73BBBB__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.


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

Comments and Discussions