📄 actionprocess.h
字号:
// ***************************************************************
// ActionProcess version: 1.0
// -------------------------------------------------------------
// File Name: ActionProcess.h
// Created: 2007/07/18
// Modified: 2007/07/18 16:54
// Author: William.Liang
// Msn: lwq49@msn.com
// Email: lwq49@21cn.com, lwq49@msn.com
// 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 William.Liang .
// Copyright (C) 2007 - All Rights Reserved.
// ***************************************************************
#ifndef ACTION_PROCESS_HEAD_FILE
#define ACTION_PROCESS_HEAD_FILE
#pragma once
/**
* 对象执行动作的方法类。
* 以移动类为例,目前只提供直线式的移动,日后可扩展出贝塞尔曲线运动轨迹的类
*/
//系统头文件
#include "ServiceEnginer.h"
//***************************************************************
// 移动动作
//***************************************************************
class SERVICE_ENGINER_CLASS CActionProcessMove : public IActionProcess
{
protected:
IGameObject* m_pIGameObject; //动作对象
_POINT m_piOriginal; //原始坐标
_POINT m_piTarget; //目标坐标
tagPoint m_piCurrent; //当前坐标
tagPoint m_piStep; //增长值
public:
//构造函数
CActionProcessMove(IGameObject* pIGameObject, DWORD dwFrames, _POINT Point);
public:
//动作处理
virtual bool __cdecl Process(bool bFlag=false);
//重置
virtual void __cdecl Reset(){m_piCurrent=m_piOriginal;};
//基础接口
public:
//释放对象
virtual bool __cdecl Release(){
if (IsValid()) delete this;
return true;
}
//是否有效
virtual bool __cdecl IsValid(){
return AfxIsValidAddress(this,sizeof(CActionProcessMove))?true:false;
}
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer){
QUERYINTERFACE(IActionProcess,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IActionProcess,Guid,dwQueryVer);
return NULL;
}
};
//轨迹动作参数
struct tagProcessTrackParam{
_POINT* pPoints; //点数组
DWORD* pFrames; //点之间间隔帧数
DWORD dwTracks; //点数
};
//***************************************************************
// 轨迹移动动作
//***************************************************************
class SERVICE_ENGINER_CLASS CActionProcessMoveTrack : public IActionProcess
{
protected:
IGameObject* m_pIGameObject; //动作对象
DWORD m_dwFrameCount; //总帧数
tagProcessTrackParam m_Params; //轨迹参数
IActionProcess* pSubProcess; //子动作
WORD m_wCurrentPoint; //当前执行点
public:
//构造函数
CActionProcessMoveTrack(IGameObject* pIGameObject, DWORD dwFrames, tagProcessTrackParam* lpParam);
public:
//动作处理
virtual bool __cdecl Process(bool bFlag=false);
//重置
virtual void __cdecl Reset(){ return;};
//基础接口
public:
//释放对象
virtual bool __cdecl Release(){
if (IsValid()) delete this;
return true;
}
//是否有效
virtual bool __cdecl IsValid(){
return AfxIsValidAddress(this,sizeof(CActionProcessMoveTrack))?true:false;
}
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer){
QUERYINTERFACE(IActionProcess,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IActionProcess,Guid,dwQueryVer);
return NULL;
}
};
//旋转动作参数
struct tagProcessAngleParam{
float fStart; //起始角度
float fEnd; //结束角度
bool bVibrating; //是否振动
};
//***************************************************************
// 旋动动作
//***************************************************************
class SERVICE_ENGINER_CLASS CActionProcessAngle : public IActionProcess
{
protected:
IGameObject* m_pIGameObject; //动作对象
float m_fOriginal; //原始角度
float m_fCurrent; //当前角度
float m_fStep; //步长角度
int m_nState; //当前状态
tagProcessAngleParam m_Params; //旋转参数
public:
//构造函数
CActionProcessAngle(IGameObject* pIGameObject, DWORD dwFrames, tagProcessAngleParam* lpParam);
public:
//动作处理
virtual bool __cdecl Process(bool bFlag=false);
//重置
virtual void __cdecl Reset(){m_fCurrent=m_fOriginal;};
//基础接口
public:
//释放对象
virtual bool __cdecl Release(){
if (IsValid()) delete this;
return true;
}
//是否有效
virtual bool __cdecl IsValid(){
return AfxIsValidAddress(this,sizeof(CActionProcessAngle))?true:false;
}
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer){
QUERYINTERFACE(IActionProcess,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IActionProcess,Guid,dwQueryVer);
return NULL;
}
};
//振动参数
struct tagProcessVibratingParam{
float fStart; //起始角度
float fEnd; //结束角度
int nFrequency; //振幅
int nAttenuation; //衰减
};
//***************************************************************
// 振动动作
//***************************************************************
class SERVICE_ENGINER_CLASS CActionProcessVibrating : public IActionProcess
{
protected:
IGameObject* m_pIGameObject; //动作对象
float m_fOriginal; //原始坐标
DWORD m_dwFrameCount; //总帧数
tagProcessVibratingParam m_Params; //振动参数
CListTemplate<IActionProcess*, DWORD> m_lstSubProcess; //子动作列表
public:
//构造函数
CActionProcessVibrating(IGameObject* pIGameObject, DWORD dwFrames, tagProcessVibratingParam* lpParam);
public:
//动作处理
virtual bool __cdecl Process(bool bFlag=false);
//重置
virtual void __cdecl Reset(){ return; };
//基础接口
public:
//释放对象
virtual bool __cdecl Release(){
if (IsValid()) delete this;
return true;
}
//是否有效
virtual bool __cdecl IsValid(){
return AfxIsValidAddress(this,sizeof(CActionProcessVibrating))?true:false;
}
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer){
QUERYINTERFACE(IActionProcess,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IActionProcess,Guid,dwQueryVer);
return NULL;
}
};
//***************************************************************
// 缩放动作
//***************************************************************
class SERVICE_ENGINER_CLASS CActionProcessScaling : public IActionProcess
{
protected:
IGameObject* m_pIGameObject; //动作对象
_SIZE m_siOriginal; //原始大小
_SIZE m_siTarget; //目标大小
tagSize m_siCurrent; //当前大小
tagSize m_siStep; //步长大小
public:
//构造函数
CActionProcessScaling(IGameObject* pIGameObject, DWORD dwFrames, _SIZE Size);
public:
//动作处理
virtual bool __cdecl Process(bool bFlag=false);
//重置
virtual void __cdecl Reset(){m_siCurrent=m_siOriginal;};
//基础接口
public:
//释放对象
virtual bool __cdecl Release(){
if (IsValid()) delete this;
return true;
}
//是否有效
virtual bool __cdecl IsValid(){
return AfxIsValidAddress(this,sizeof(CActionProcessScaling))?true:false;
}
//接口查询
virtual void * __cdecl QueryInterface(const IID & Guid, DWORD dwQueryVer){
QUERYINTERFACE(IActionProcess,Guid,dwQueryVer);
QUERYINTERFACE_IUNKNOWNEX(IActionProcess,Guid,dwQueryVer);
return NULL;
}
};
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -