www.pudn.com > GameEngine_src.rar > CPictureGroup.h


#ifndef CPictureGroup_h 
#define CPictureGroup_h 
 
 
#if _MSC_VER > 1000 
#pragma once 
#endif // _MSC_VER > 1000 
 
#include "CEasyDraw.h" 
#include "CDynamicArray.h" 
#include "struct.h" 
 
 
 
//#define ALPHA_SHADOW	1 
 
 
 
 
///////////////////////////////////////////////////////////////////////////// 
//图片组合 
///////////////////////////////////////////////////////////////////////////// 
class CPictureGroup 
{ 
 
public: 
	CPictureGroup(); 
	~CPictureGroup(); 
 
	bool Init();		 
	void Free(); 
	void Clear(); 
 
	void GetRect( int frame, const POINT &base, RECT &rc ); 
	void GetRenderPoint( int frame, const POINT &base, POINT &render ); 
 
	void UpdateFrame( int &frame, unsigned int &LastTick ); 
 
	int UpdateAliveSprite( bool bNextFrame, int &frame, int direction, const POINT &base, POINT &render, RECT &rc );  
	 
	void UpdateStaticSprite( int &frame, unsigned int &LastTick, const POINT &base, POINT &render, RECT &rc ); 
 
	int UpdateMagicSprite( bool bNextFrame, int &frame, const POINT &base, POINT &render, RECT &rc ); 
 
	void DrawFrame( int frame, int x_client, int y_client ); 
	void DrawFrame( int frame, const POINT &base ); 
	void DrawShadow( int frame, const POINT &base ); 
	void DrawContour( int frame, int x_client, int y_client ); 
 
	bool IsEmpty() { return GetNumFrame() == 0; } 
	int GetDelayTime() { return m_DelayTime; } 
	int GetDirection() { return m_Direction; } 
	int GetNumFrame()  { return m_SurfaceArray.GetLength(); } 
	int GetFramePerDirection() { return m_FramePerDirection; } 
	int GetLastFrame() { return m_FramePerDirection - 1; } 
	PSURFACE GetSurface(int frame) { return m_SurfaceArray[frame];} 
 
	bool LoadEPG( char *filename, bool isFromFile, CPictureGroup *pSPG,  
					CELL **ppCell, int *NumHoldCell ); 
 
	int GetMaxHeight();				//获取动作集的平均高度,用于绘制名字与血条 
private: 
	void FreeSurface(); 
 
private: 
	CDynamicArray		m_SurfaceArray; 
	CDynamicArray		m_BaseOffsetArray; 
	int							m_FramePerDirection;		//每个方向的帧数 
	int							m_DelayTime; 
	int							m_Direction; 
}; 
 
 
 
///////////////////////////////////////////////////////////////////////////// 
//带阴影的图片组合 
///////////////////////////////////////////////////////////////////////////// 
struct EPG_DATA 
{ 
	EPG_DATA(){} 
	~EPG_DATA(){} 
 
	CPictureGroup *GetAnimation() { return &m_animation;} 
	CPictureGroup *GetShadow() { return &m_shadow;} 
 
	bool LoadEPGFromMemory( char *data ) 
	{ return m_animation.LoadEPG( data, false, &m_shadow, 0, 0 ); } 
 
	CPictureGroup	m_animation; 
	CPictureGroup	m_shadow; 
}; 
 
 
#endif