Merge pull request #11592 from fusijie/add_EaseRateAction_create_method

Add EaseRateAction::create() method.
This commit is contained in:
minggo 2015-04-27 10:16:38 +08:00
commit 033cfaa30b
2 changed files with 26 additions and 0 deletions

View File

@ -90,6 +90,24 @@ ActionInterval* ActionEase::getInnerAction()
// EaseRateAction // EaseRateAction
// //
EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
{
EaseRateAction *easeRateAction = new (std::nothrow) EaseRateAction();
if (easeRateAction)
{
if (easeRateAction->initWithAction(action, rate))
{
easeRateAction->autorelease();
}
else
{
CC_SAFE_RELEASE_NULL(easeRateAction);
}
}
return easeRateAction;
}
bool EaseRateAction::initWithAction(ActionInterval *action, float rate) bool EaseRateAction::initWithAction(ActionInterval *action, float rate)
{ {
if (ActionEase::initWithAction(action)) if (ActionEase::initWithAction(action))

View File

@ -97,6 +97,14 @@ private:
class CC_DLL EaseRateAction : public ActionEase class CC_DLL EaseRateAction : public ActionEase
{ {
public: public:
/**
@brief Creates the action with the inner action and the rate parameter.
@param action A given ActionInterval
@param rate A given rate
@return An autoreleased EaseRateAction object.
**/
static EaseRateAction* create(ActionInterval* action, float rate);
/** /**
@brief Set the rate value for the ease rate action. @brief Set the rate value for the ease rate action.
@param rate The value will be set. @param rate The value will be set.