game_statehandler.h

来自「开放源码分布式开发包」· C头文件 代码 · 共 48 行

H
48
字号
// Class automatically generated by Dev-C++ New Class wizard

#ifndef GAME_STATEHANDLER_H
#define GAME_STATEHANDLER_H

#include <irrlicht.h>
//using namespace irr;

#include "../game_states.h"

class game_State;

//typedef enum tGAME_STATE;

// BASE CLASS 
// provides game_tetris with neccesary functionality to handle game_State derivatives
class game_StateHandler
{
	public:
		// class constructor
		game_StateHandler();
		// class destructor
		~game_StateHandler();
		
protected:
    tGAME_STATE m_GameState;  //enum of the current state
    game_State *m_pCurrState; //pointer to the current state
    bool destroyMe;           //set by requestDestroy, will call Destroy() if true

    irr::IrrlichtDevice       *m_device;    //irrlicht device pointer
    irr::video::IVideoDriver  *m_driver;    //irrlicht video driver pointer
    irr::scene::ISceneManager *m_smgr;      //irrlicht scene manager ptr
		
public:		
    irr::IrrlichtDevice       *getDevice() {return m_device; } 
    irr::video::IVideoDriver  *getDriver() {return m_driver; } 	
    irr::scene::ISceneManager *getSceneMgr() { return m_smgr; }
    
    //passively tell game to quit (will be handled next loop)
    void RequestDestroy() { destroyMe = true; }
    //ask the handler to transition to a different state
    //(the hanlder can decide not to, or call other functions first)
    virtual void RequestStateChange(tGAME_STATE newState) = 0;
};

#endif // GAME_STATEHANDLER_H

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?