#pragma once

#include "CProcessBase.h"
#include "CTweenNode.h"
#include "CFrameNodeList.h"
#include <math.h>

using namespace cocos2d;

#define  HALF_PI  (M_PI * 0.5f)

//ƣؼ֡ݲȾ
class CCTween : public CCProcessBase
{
public:
	/* Tween ʵTween Ϊõʵöع*/
	static CCTween* create();

	static void removePoolObject();
private:
	static void recycle(CCTween* _tween);

public:
	CCTween(void);
	~CCTween(void);

	virtual bool init();
	
	/*ɾ*/
	void remove();
	/* mNode*/
	void setNode(CCTweenNode* _node);
	/**
	* Ų䶯
	* @param _to FrameNodeList ʵ
	* @param _toFrames ɵ FrameNodeList Ҫѵ֡
	* @param _listFrames FrameNodeList ų֡
	* @param _loop Ƿѭ
	* @param _ease FrameNodeList ؼĻʽ-1:SineOut0:Line1:SineIn2:SineInOut
	*/
	void playTo(void * _to, int _toFrames, int _listFrames = 0, bool _loop = false, int _ease = 0);
	/* mNode*/
	void updateHandler();
	
	void setActive(bool _active);
	bool getActive();

private:

	void updateCurrentPrecent();

private:
	/* Bone.tweenNode  */
	CCTweenNode* mNode;

	CCTweenNode* mFrom;

	CCTweenNode* mTo;

	CCFrameNodeList* mTweenList;

	bool mActive;
private:	
	static CCArray	*sObjectPool;

	static int		sPoolIndex;
};

