⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gameobjectanim.h

📁 游戏框架
💻 H
字号:
// ***************************************************************
//  GameObjectAnim   version:  1.0
//  -------------------------------------------------------------
//	File Name:	GameObjectAnim.h
//	Created:	2007/07/18
//	Modified:	2007/07/18   15:44
//	Author:		ben
//  Msn:		
//  Email:		
//	Description:
//
//	Purpose:	
//  -------------------------------------------------------------
//  license:
//
//  The contents of this file are subject to the Mozilla Public
//  License Version 1.1 (the "License"); you may not use this file
//  except in compliance with the License. You may obtain a copy
//  of the License at http://www.mozilla.org/MPL/ Software dis-
//  tributed under the License is distributed on an "AS IS" 
//  basis, WITHOUT WARRANTY OF ANY KIND, either express or im-
//  plied. See the License for the specific language governing
//  rights and limitations under the License.
//
//  The Initial Developer of the Original Code is Ben .
//  Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#ifndef GAME_OBJECT_ANIM_HEAD_FILE
#define GAME_OBJECT_ANIM_HEAD_FILE

#pragma once
#include "gameobject.h"
//***************************************************************
//	动画对象。
//***************************************************************
class OBJECT_COM_CLASS CGameObjectAnim :
	public IGameObjectAnim,public CGameObject
{
private:
	hgeAnimation*	m_hgeAnim;						//动画指针
	DWORD			m_dwFrames;						//总帧数
	DWORD			m_dwCols;						//列数
	DWORD			m_dwRows;						//行数
	float			m_fSpeed;						//播放速度
	WORD			m_wCurrentRow;					//当前动画行

public:
	//构造函数
	CGameObjectAnim(void);
	//析构函数
	virtual ~CGameObjectAnim(void);

	//公共相关方法
public:
	//创建
	virtual bool __cdecl Create(LPCTSTR lpName,_SIZE sSize,CResource* pResource,DWORD nFrames,float FPS,DWORD nCols,DWORD nRows);
	//渲染
	virtual void __cdecl Render(WPARAM wParam);
public:
	//设置纹理
	virtual void __cdecl SetTexture(HTEXTURE hTexture);
	//返回纹理
	virtual HTEXTURE __cdecl GetTexture();
	//设置动画总帧数
	virtual void __cdecl SetFrames(DWORD dwFrames);
	//返回动画总帧数
	virtual DWORD __cdecl GetFrames();
	//设置播放到第n帧
	virtual void __cdecl SetFrame(DWORD dwFrame);
	//返回当前播放的行
	virtual WORD __cdecl GetRow();
	//设置播放的行
	virtual void __cdecl SetRow(WORD wRow);
	//返回当前动画播放的第n帧
	virtual DWORD __cdecl GetFrame();
	//设置播放速度
	virtual void __cdecl SetSpeed(float fFps);
	//返回当前动画播放速度
	virtual float __cdecl GetSpeed();	
	//设置播放模式
	virtual void __cdecl SetMode(DWORD dwType);
	//返回播放模式
	virtual DWORD __cdecl GetMode();
	//判断动画是否在播放
	virtual bool __cdecl IsPlaying();
	//更改动画纹理
	virtual void __cdecl SetType(DWORD dwType,DWORD dwFrames,float fFps,bool bIsRow=true);
	//播放动画
	virtual void __cdecl Play();
	//转至下一帧
	virtual void __cdecl NextFrame();
	//停止播放
	virtual void __cdecl Stop();

	//模拟方法
public:
	//是否有效
	virtual bool __cdecl IsValid() { return AfxIsValidAddress(this,sizeof(CGameObjectAnim))?true:false;};
	//释放对象
	virtual bool __cdecl Release() { if (IsValid()) delete this; return true; };
	//接口查询
	virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer);

public:
	//操作重载
	CGameObjectAnim& operator=(CGameObjectAnim& GamoObject);
};
#endif

⌨️ 快捷键说明

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