⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 game.h

📁 一个CDMA手机BREW的3D游戏的源代码
💻 H
字号:
// ==========================================================================================================
//
// BREW v2.0+ OPENGLES MICROENGINE
// Sample application
//
// -------------------------------------------------------------
// Please note that this is a general use 3D engine, best suited
// for 3D games development. Nevertheless, the core engine tries
// to provide only low-to-mid-level features, so that it is the
// developer responsibility to implement high-level features.
// The core is built in a way to turn it into an easy task to do.
// -------------------------------------------------------------
//
// Written by Vander Nunes
//
// ==========================================================================================================

#ifndef __GAME_H__

	#define __GAME_H__

	#include "game.bid"
	#include "../../../engine/torus.h"
	#include "../../../engine/scenegraph/scenegraph.h"
	#include "../../../engine/sprite.h"
	#include "../../../engine/music.h"

	// --------------------------------------------------------------------------
	//
	// USER-DEFINED GAME CLASS
	//
	// --------------------------------------------------------------------------
	class CGame
	{

		public:

			CGame();
			~CGame();

			// ---------------------------------------------------------------------------------------
			//
			// Mandatory declarations
			//
			// ---------------------------------------------------------------------------------------

			// Application, Shell, and Display
			// ***IMPORTANT***: MUST BE THE FIRST CLASS MEMBER...
			AEEApplet										m_applet;

			// engine pointer
			CEngine*										m_pEngine;

			// camera
			CCamera*										m_pCam;

			boolean											Init();
			void												CleanUp();

			static void									Destroy(CGame* pGame);
			static boolean							HandleInitEvent(CGame* pGame, AEEEvent eCode, uint16 wParam, uint32 dwParam);
			boolean											HandleEvent(AEEEvent eCode, uint16 wParam, uint32 dwParam);
			boolean											KeyPressEvent(uint16 wParam);
			boolean											KeyReleaseEvent(uint16 wParam);

			static void									NextFrame(CGame* pGame);
			void												RenderFrame();

			// ---------------------------------------------------------------------------------------
			//
			// Game specific extensions
			//
			// ---------------------------------------------------------------------------------------

			#define STATUS_START		1
			#define STATUS_LOADING	2
			#define STATUS_PLAYING	3

			// key Variables
			int													m_key_state;
			uint16											m_key_wParam;
			boolean											m_kSELECT, m_kLEFT, m_kRIGHT, m_kUP, m_kDOWN, m_kCLEAR;
			boolean											m_klastSELECT;

			byte												m_jGameStatus;
			dword												m_dwFrame;

			CSceneGraph*								m_pScene;
			CSceneItem*									m_pModel;
			CSprite*										m_pSpr8x13;

			boolean											LoadResources();
			void												RenderStart();
			void												RenderPlaying();
	};

	// --------------------------------------------------------------------------
	//
	// overloads
	//
	// --------------------------------------------------------------------------

	void *operator new(size_t dwSize) throw()
	{
		return MALLOC(dwSize);
	}

	void operator delete(void *po) throw()
	{
		FREE(po);
	}

	void *operator new [] (size_t dwSize) throw()
	{
		return MALLOC(dwSize);
	}

	void operator delete [] (void *po) throw()
	{
		FREE(po);
	}

#endif

⌨️ 快捷键说明

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