game.h

来自「对游戏编程感兴趣的 朋友可以 下载下来看看 对DX讲解的很很详细」· C头文件 代码 · 共 91 行

H
91
字号
// Game.h: interface for the CGame class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_GAME_H__687221F3_ACFF_4D66_97DB_88AB70E0CA59__INCLUDED_)
#define AFX_GAME_H__687221F3_ACFF_4D66_97DB_88AB70E0CA59__INCLUDED_

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

#include "Base.h"

#include "Cuboid.h"
#include "Terrain.h"
#include "Sphere.h"
#include "Cone.h"
#include "Cylinder.h"
#include "Mesh.h"
#include "Font.h"
#include "Panel.h"
#include "Sound.h"

class CGame : public CBase
{
public:
	bool Initialise(HWND hWnd, HINSTANCE hInst, UINT nWidth, UINT nHeight);
	void GameLoop();
	LPDIRECT3DDEVICE8 GetDevice();
	CGame();
	virtual ~CGame();

private:
	void CleanUpDirectAudio();
	bool InitialiseDirectAudio(HWND hWnd);
	void CleanUpGame();
	void CleanUpDirect3D();
	void ProcessMouse();
	void CleanUpDirectInput();
	void ProcessKeyboard();
	bool InitialiseDirectInput(HWND hWnd, HINSTANCE hInst);
	void RenderText();
	void Render2D();
	void Render3D();
	bool InitialiseLights();
	D3DFORMAT CheckDisplayMode(UINT nWidth, UINT nHeight, UINT nDepth);
	bool InitialiseGame();
	bool InitialiseDirect3D(HWND hWnd, UINT nWidth, UINT nHeight);
	void Render();
	void Setup3DCamera();
	void Setup2DCamera();

	LPDIRECT3D8 m_pD3D;
	LPDIRECT3DDEVICE8 m_pD3DDevice;
	LPDIRECTINPUT8 m_pDirectInput; 
	LPDIRECTINPUTDEVICE8 m_pKeyboard;
	LPDIRECTINPUTDEVICE8 m_pMouse; 

	IDirectMusicPerformance8* m_pDirectAudioPerformance;	
	IDirectMusicLoader8* m_pDirectAudioLoader;

	DWORD m_dwFrames;
	DWORD m_dwStartTime;
	DWORD m_dwEndTime;
	DWORD m_dwTotalPolygons;
	int m_nScreenWidth;
	int m_nScreenHeight;
	bool m_fQuit;

	int m_nMouseLeft;
	int m_nMouseRight;
	int m_nMouseX;
	int m_nMouseY;

	CFont* m_pFont;
	CSound* m_pSound1;
	CSound* m_pSound2;
	CSound* m_pSound3;
	CSound* m_pSound4;
	CSound* m_pSoundFailed;
	CSound* m_pSoundBG;

	CPanel* m_pPanelMouse;
	CPanel* m_pPanel1;
	CPanel* m_pPanel2;
	CPanel* m_pPanel3;
	CPanel* m_pPanel4;
};

#endif // !defined(AFX_GAME_H__687221F3_ACFF_4D66_97DB_88AB70E0CA59__INCLUDED_)

⌨️ 快捷键说明

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