www.pudn.com > russion_vc.zip > Player.h


// Player.h: interface for the Player class. 
// 
////////////////////////////////////////////////////////////////////// 
 
#if !defined(AFX_PLAYER_H__BF03034E_AA8E_11D3_A32D_0000210063B5__INCLUDED_) 
#define AFX_PLAYER_H__BF03034E_AA8E_11D3_A32D_0000210063B5__INCLUDED_ 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#define MAXX    10 
#define MAXY    18 
#define PANE_LENGTH 12 //将一个小方块分为若干个小格 
#define MICRO_PANE_LENGTH 2 //每个小格占的象素数 
#define MAX(a,b) (a) >= (b) ? (a) : (b) 
#define MIN(a,b) (a) <= (b) ? (a) : (b) 
 
struct Pane 
{ 
	int list; //方块种类 
	int x,y; //方块位置 
	int offset; //垂直细微偏移量 
	int lastx,lasty,lastoffset; //上一时刻位置 
	int matrix[4][4]; //方块矩阵 
	bool Active; //数据有效 
}; 
 
 
class Player   
{ 
public: 
	Player(); 
	virtual ~Player(); 
 
public: 
	int Back[MAXX+2][MAXY+2]; 
	Pane pre; 
	Pane mPane; 
	int Step; 
	int speed; 
	unsigned long Marks; 
	CPoint lu,rd; //边界 
	bool Active; //正在游戏中 
public: 
	void InitGame(); 
	void GameOver(); 
	void InitNewPane(); 
 
	bool Turn(); //转向 
	bool TurnCheck(); //是否能转向 
	bool DownStep(); //下降一个象素 
	bool DownLine(); 
	bool Drop(); //降落到最底端 
	bool Left(); //向左移动 
	bool Right(); //向右移动 
	void Stop(); //方块固定在背景上 
	int	 Clear(); //消去 
	void GetPoint(int PaneX,int PaneY,int& PixX,int& PixY); //得到在屏幕上的绝对象素坐标 
 
}; 
 
#endif // !defined(AFX_PLAYER_H__BF03034E_AA8E_11D3_A32D_0000210063B5__INCLUDED_)