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

📄 game.h

📁 一个类似坦克大战的小小游戏
💻 H
字号:

/**************************************************************************************
	Project  Name			: Pirates of the Caribbean
	Module Name				: Game
	File Name				: Game.h: interface for the CGame class.
	Create					: 2007-7-16, by Vigame
	Update					: 2007-7-27, Added the fuction ProcessEvent() to get events
	                          of the mp3 graph and process it.
	Copyright				: 
	Reference				: 
	Abstrct					: Game process
 **************************************************************************************/

#ifndef __H_Game__
#define __H_Game__

#pragma once

#include "GameResource.h"
#include "Graphics.h"
#include "GameInput.h"
#include "GameSound.h"
#include "GameMp3.h"
#include "GameObject.h"
#include "PlayerShip.h"
#include "ComputerShip.h"
#include "GameMap.h"
#include "Fireworks.h"
#include "Bonus.h"

#include <list>
using namespace std;

typedef enum _GAME_STATE
{
	GS_Title = 0,
	GS_Over,
	GS_Win,
	GS_Run,
	GS_Exit
} Game_State;

typedef enum _GAME_TYPE
{
	GT_SinglePlayer,	// One player play with computer
	GT_MultiPlayer,		// Two player play with computer
	GT_FreeForAll		// Free for all
} Game_Type;


const int MAX_ENEMY = 5;
const int ENEMY_KILLED_PASSED = 20;
const int MAX_BONUS = 3;

class CGame
{
public:
	CGame(void);
	virtual ~CGame(void);

public:
	// About systems
	BOOL Init(HWND hWnd, HINSTANCE hInstance);
	void Release();
	BOOL Run();
	void ResetMap();
	void ResetGame();
	BOOL LoadMap();
	BOOL LoadLevel();
	void Render();
	void ProcessInput();
	void ProcessBullet();
	void ProcessScenery();
	void ProcessEnemy();
	void DrawBackground();
	void DrawGameState(int inState);
	void Sort();

	// About sound
	BOOL LoadBackgroundMusic();
	void PlayBackgroundMusic();
	void StopBackgroundMusic();
	void ProcessEvent();

	// About Ships
	void CreatePlayer1();
	void CreatePlayer2();
	void PlayerReborn(int inIndex);
	void CreateEnemy();
	void CreateBonus(int &x, int &y);

public:
	Game_State m_gameState;
	Game_Type m_gameType;
	CGameMap *m_pMap;

private:
	HWND m_hWnd;
	CPlayerShip m_playerShip[2];		// Player's warship
	CGameObject m_backGround;			// Texture -- sea
	CBonus m_bonus[MAX_BONUS];
	list<CComputerShip> m_listEnemy;	// List of the computer ships
	list<CGameObject> m_listScenery;	// List of the scenery
	list<CFireworks> m_listFireworks;	// List of the fireworks
	list<CGameObject> m_listSort;
	CGameResource *m_pResource;
	CGraphics *m_pGraphics;
	CGameInput *m_pInput;
	CGameSound *m_pSound;
	CGameMp3 *m_pMp3;
	
	int m_nEnemyCount;
	int m_nLevel;
	int m_nEnemyKilled;

	char m_sLevelPath[256];

private:
	DWORD m_timeCreateEnemy;
};

#endif

⌨️ 快捷键说明

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