?? gsanimation.h
字號(hào):
// GsAnimation.h: interface for the CGsAnimation class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_GSANIMATION_H__22A4012B_9B74_4DFE_B1AE_776B9DE5C487__INCLUDED_)
#define AFX_GSANIMATION_H__22A4012B_9B74_4DFE_B1AE_776B9DE5C487__INCLUDED_
#include "GSLib.h" // Added by ClassView
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#define GS_ANI_UPDATE_FINISH -1
#define GS_ANI_UPDATE_NORMAL 0
#define GS_ANI_UPDATE_END 1
#define GS_ANI_UPDATE_BEGIN 2
//#define GS_ANI_
#define GS_ANI_PLAY_NONE 0L
#define GS_ANI_PLAY_LOOP 1L
#define GS_ANI_PLAY_LOOP_BACK 2L
#define GS_ANI_PLAY_ROTATE 3L
#define GS_ANI_PLAY_ROTATE_BACK 4L
struct GSLIB_API sGSANI_FRAME
{
int index;
FLAG flag;
};
typedef sGSANI_FRAME GSANI_FRAME;
class GSLIB_API CGsAnimation
{
public:
int SetCurrentUse(BOOL use=TRUE);
float GetAngleFaceToDegree();
VOID SetFaceToDegree(float degree);
BOOL TestByPercent(float per);
float GetFinishPercent();
void AttachAni(GSANI* pAni);
int SetDirectionFrame(int frame_in_direction, int direction = GSANI_DIRECTION_NOCHANGE);
LPCSTR GetImage();
VOID SetCurrentFrame(int index);
BOOL Export(LPCSTR strFile=NULL);
BOOL Save(CConfig& cfg);
//編輯器使用,用于編輯播放序列
//當(dāng)pframe==NULL時(shí),
// 當(dāng)index>0時(shí),把播放幀數(shù)改為index+1(插入幀);
// 當(dāng)index==0時(shí),從后面插入幀;
// 當(dāng)index<0時(shí),從后面刪除幀;
BOOL SetAniFrame(int index =0, GSANI_FRAME* pframe=NULL);
GSANI_FRAME GetAniFrame(int index);
FLAG GetFlag() {return m_flag;}
VOID SetFlag(FLAG flag) {m_flag = flag;}
VOID AddFlag(FLAG flag) {m_flag |= flag;}
VOID ClearFlag(FLAG flag) {m_flag &= !flag;}
BOOL TestFlag(FLAG flag) {return m_flag&flag;}
VOID SetDirection(int nDirection = -1);
VOID SetFaceTo(float fAngle);//角度單位為弧度
VOID SetCache(int cache = 0);
HRESULT ReleaseObjects();
virtual HRESULT Draw(LONG x, LONG y,
FLOAT fZValue = 0.0f,
FLOAT fScaleW = 1.0f,
FLOAT fScaleH = 1.0f,
FLOAT fAlpha = 1.0f,
FLOAT fAngle = 0.0f,
D3DCOLOR cMix = D3DRGBA(0.5f, 0.5f, 0.5f, 1.0f));
virtual HRESULT DrawFast(LONG x, LONG y,
FLOAT fZValue = 0.0f,
FLOAT fScaleW = 1.0f,
FLOAT fScaleH = 1.0f,
FLOAT fAlpha = 1.0f,
D3DCOLOR cMix = D3DRGBA(0.5f, 0.5f, 0.5f, 1.0f));
VOID SetFrameDelay(DWORD dwDelayTick) {_m_frame_delay = dwDelayTick;}
DWORD GetFrameDelay() {return _m_frame_delay;}
VOID SetPos(int pos=-1);
VOID SetGsEngine(CGsEngine* pEngine);
virtual VOID Cleanup();
virtual void Play(FLAG style=GS_ANI_PLAY_LOOP, BOOL bReset=FALSE, float loop=0, float time=0, float delay=0);
virtual VOID PlayToStart(BOOL bReset=FALSE, float delay=0);
virtual VOID PlayToEnd(BOOL bReset=FALSE, float delay=0);
virtual FLAG Update();
virtual BOOL Create(const char* strDesc);
const char* GetKey() {return m_key.c_str();}
CGsTextureGroup* GetTextureGroup() {return m_texture_group;}
int GetFrameCount();
CGsTexture* GetCurrentFrame(int frame_move=0);
CGsTexture* GetCurrentShadow(int frame_move=0);
CGsTexture* GetFrame(int frame_index=0);
CGsTexture* GetShadow(int frame_index=0);
BOOL IsPlaying() {return _m_play_flag!=GS_ANI_PLAY_NONE;}
BOOL IsReady() {return NULL!=m_texture_group;}
float GetAngleFaceTo() {return m_angle_face_to;}
CGsAnimation(CGsEngine* pEngine = NULL);
virtual ~CGsAnimation();
protected:
CGsEngine* m_pEngine;
CGsTextureGroup* m_texture_group;
GSANI_FRAME* m_apFrameData;
FLAG m_flag;
int m_current_frame;
int m_start_frame;
int m_end_frame;
int m_num_frame;
int m_num_direction;
int m_base_frame;
float m_angle_base;
float m_angle_face_to;
float m_percent_by;
DWORD _m_frame_delay;
DWORD _m_base_tick;
DWORD _m_pass_tick;
DWORD _m_play_tick;
// DWORD _m_base_loop;
// DWORD _m_play_loop;
BOOL _m_is_frame_up;
FLAG _m_play_flag;
KEY m_key;
KEY m_key_config;
};
#endif // !defined(AFX_GSANIMATION_H__22A4012B_9B74_4DFE_B1AE_776B9DE5C487__INCLUDED_)
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -