mainmenu.h

来自「吃豆子游戏源码」· C头文件 代码 · 共 106 行

H
106 行
字号
/**
 *	File	:	MainMenu.h
 *  Author	:	Kevin Lynx
 *	Date	:	2007/8/3
 */
#ifndef _MAIN_MENU_H_
#define _MAIN_MENU_H_

#include "Singleton.h"

/**
 * MainMenu
 *
 * Implements the main menu in the game
 */
class MainMenu : public Singleton<MainMenu>
{
public:
	/**
	 * gui controls id
	 *
	 */
	enum
	{
		BTN_START_ID = 1,
		BTN_HELP_ID,
		BTN_CREDITS_ID,
		BTN_EXIT_ID,
		BTN_HELP_BACK_ID,
		BTN_CREDITS_BACK_ID
	};
	enum
	{
		TV_TEX_COUNT = 3,
		TVNOISE_TEX_COUNT = 3,
		TV_CHANGE_TIME = 3000,
		TVNOISE_CHANGE_TIME = 100,
	};
	enum
	{
		MENU_STATE_MAIN,
		MENU_STATE_HELP,
		MENU_STATE_CREDITS
	};
public:
	/**
	 * Constructor
	 *
	 */
	MainMenu( IrrlichtDevice *device );

	/**
	 * Destructor
	 *
	 */
	~MainMenu();

	/**
	 * init
	 *
	 * it will create all the gui elements
	 */
	bool	init();

	/**
	 * update
	 *
	 */
	void	update( float dt );

	/**
	 * render
	 *
	 */
	void	render();

	/**
	 * enter
	 *
	 * when enter the main menu , call this function
	 */
	void	enter();

	/**
	 * OnEvent
	 *
	 */
	bool	OnEvent( SEvent event );
private:
	void	setButtonPro( IGUIButton *button );
	void	changeState( int state );
private:
	IrrlichtDevice *mDevice;

	ITexture	*mTV[TV_TEX_COUNT];
	int			mCurTV;
	u32			mTVLastTime;

	ITexture	*mTVNoise[TVNOISE_TEX_COUNT];
	int			mCurTVNoise;
	u32			mTVNoiseLastTime;

	int			mState;
};

#endif //end _MAIN_MENU_H_

⌨️ 快捷键说明

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