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

📄 animmanager.h

📁 吃豆子游戏源码
💻 H
字号:
/**
 * AnimManager , manages the animation in Irrlicht
 *
 * Author	:	Kevin Lynx
 * History  :
 *     2007.7.31  : First version
 */
#ifndef	_ANIM_MANAGER_H_
#define _ANIM_MANAGER_H_

#include <map>

using std::map;

/**
 * AnimManager class, 
 *
 * Implements an easy animation controller  
 */
class AnimManager
{
public:
	/**
	 * animation properties
	 *
	 */
	struct AnimState
	{
		AnimState( int begin = 0, int end = 0, 
				   float fps = 0.0f, bool loop = true )
		{
			mBeginFrame = begin;
			mEndFrame = end;
			mFPS = fps;
			mLoop = loop;
		}

		int	mBeginFrame;
		int mEndFrame;
		float mFPS;
		bool mLoop;
	};

	/**
	 * animstion state container
	 *
	 */
	typedef map<int, AnimState*> tAnimStates;

public:
	/**
	 * Constructor
	 *
	 * @param node the animation mesh node 
	 */
	AnimManager( IAnimatedMeshSceneNode *node );

	/**
	 * Destructor
	 *
	 */
	~AnimManager();

	/**
	 * add animation state
	 *
	 * @param state the state id
	 * @param begin the begin frame of this state
	 * @param end the end frame of this state
	 * @param fps the frames per seconde
	 * @param bLoop whether a loop animation
	 *
	 */
	bool	addState( int state, int begin, int end, float fps, bool bLoop = true );

	/**
	 * release
	 *
	 */
	void	release();

	/**
	 * setState , 
	 * 
	 * it will set the current animation , and apply this state properties
	 *
	 * @param state state id
	 * @return if sets successfully return true
	 */
	bool	setCurrentState( int state );
	
	/**
	 * getState
	 *
	 * get current animation state
	 */
	int		getCurrentState();

private:
	tAnimStates		mAnimStates;
	IAnimatedMeshSceneNode *mNode;
	int	mFrameCount;
	int mCurrentState;
};


#endif // end _ANIM_MANAGER_H_

⌨️ 快捷键说明

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