www.pudn.com > DirectX的游戏代码.rar > Game.h


// Game.h: interface for the CGame class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_GAME_H__5C9B5A3C_CDFF_478B_85EF_09F62410BCA2__INCLUDED_) 
#define AFX_GAME_H__5C9B5A3C_CDFF_478B_85EF_09F62410BCA2__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "GameInfo.h" 
#include "BlackBox.h" 
 
/************************************************************************************ 
*游戏函数 
************************************************************************************/ 
 
class CGame   
{ 
public: 
	CGame(); 
	virtual ~CGame(); 
public: 
	int			Game_Main();	//游戏主循环函数 
private: 
	int			m_game_state; 
	CBlackBox	m_black_box; 
	 
	int m_paddle_x; 
	int m_paddle_y; 
	int m_ball_x; 
	int m_ball_y; 
	int m_ball_dx;		//小球的速度 
	int m_ball_dy; 
	int m_score;		//得分 
	int m_level;		//级别 
	int m_blocks_hit;	//已经撞了多少个方法 
	 
	UCHAR m_blocks[NUM_BLOCK_ROWS][NUM_BLOCK_COLUMNS]; 
 
	char m_temp_buf[256]; 
private: 
	int		Game_Exit(); 
	int		Game_Shut_Down(); 
	int		Game_Run(); 
	int		Game_Update_Level(); 
	int		Game_Init(); 
private: 
	void	UpdateText(); 
	void	UpdatePaddlePalce(); 
	//计算代码 
	void	Process_Ball(); 
	bool	BallHitPaddle(); 
	bool	BallHitBlock(); 
	//初始化代码 
	void	InitScore(); 
	void	InitBall(); 
	void	InitPaddle(); 
	void	InitBlocks(); 
	//画图代码 
	void	DrawBall(); 
	void	DrawPaddle(); 
	void	DrawBlocks(); 
}; 
 
#endif // !defined(AFX_GAME_H__5C9B5A3C_CDFF_478B_85EF_09F62410BCA2__INCLUDED_)