PuzzleSDK
ActionCatmullRom类 参考

#include <ActionsTest.h>

+ 类 ActionCatmullRom 继承关系图:
+ ActionCatmullRom 的协作图:

Public 成员函数

 CREATE_FUNC (ActionCatmullRom)
 
 ~ActionCatmullRom ()
 
virtual void onEnter () override
 
virtual std::string subtitle () const override
 
virtual std::string title () const override
 
- Public 成员函数 继承自 ActionsDemo
virtual void onExit () override
 
void centerSprites (unsigned int numberOfSprites)
 
void alignSpritesLeft (unsigned int numberOfSprites)
 
- Public 成员函数 继承自 TestCase
 TestCase ()
 
 ~TestCase ()
 
virtual Type getTestType () const
 
virtual float getDuration () const
 
virtual std::string getExpectedOutput () const
 
virtual std::string getActualOutput () const
 
virtual void restartTestCallback (cocos2d::Ref *sender)
 
virtual void nextTestCallback (cocos2d::Ref *sender)
 
virtual void priorTestCallback (cocos2d::Ref *sender)
 
virtual void onBackCallback (cocos2d::Ref *sender)
 
void setTestSuite (TestSuite *testSuite)
 
TestSuitegetTestSuite () const
 
float getRunTime () const
 
void setTestCaseName (const std::string &name)
 
std::string getTestCaseName () const
 
const cocos2d::Label * getSubtitleLable () const
 
const cocos2d::MenuItemImage * getRestartTestItem () const
 

额外继承的成员函数

- Public 类型 继承自 TestCase
enum class  Type { ROBUSTNESS , UNIT , GRAPHICAL_STATIC , MANUAL }
 
- Public 属性 继承自 TestCase
CC_CONSTRUCTOR_ACCESS __pad0__: virtual bool init() override
 
- Protected 属性 继承自 ActionsDemo
cocos2d::Sprite * _grossini
 
cocos2d::Sprite * _tamara
 
cocos2d::Sprite * _kathia
 
- Protected 属性 继承自 TestCase
cocos2d::MenuItemImage * _priorTestItem
 
cocos2d::MenuItemImage * _restartTestItem
 
cocos2d::MenuItemImage * _nextTestItem
 
cocos2d::Label * _titleLabel
 
cocos2d::Label * _subtitleLabel
 

详细描述

在文件 ActionsTest.h544 行定义.

构造及析构函数说明

◆ ~ActionCatmullRom()

ActionCatmullRom::~ActionCatmullRom ( )

在文件 ActionsTest.cpp2078 行定义.

2079{
2080}

成员函数说明

◆ CREATE_FUNC()

ActionCatmullRom::CREATE_FUNC ( ActionCatmullRom  )

◆ onEnter()

void ActionCatmullRom::onEnter ( )
overridevirtual

ActionCatmullRom

重载 ActionsDemo .

在文件 ActionsTest.cpp2012 行定义.

2013{
2015
2016 this->centerSprites(2);
2017
2018 auto s = Director::getInstance()->getWinSize();
2019
2020 //
2021 // sprite 1 (By)
2022 //
2023 // startPosition can be any coordinate, but since the movement
2024 // is relative to the Catmull Rom curve, it is better to start with (0,0).
2025 //
2026
2027 _tamara->setPosition(50, 50);
2028
2029 auto array = PointArray::create(20);
2030
2031 array->addControlPoint(Vec2(0.0f, 0.0f));
2032 array->addControlPoint(Vec2(80.0f, 80.0f));
2033 array->addControlPoint(Vec2(s.width - 80, 80.0f));
2034 array->addControlPoint(Vec2(s.width - 80, s.height - 80));
2035 array->addControlPoint(Vec2(80.0f, s.height - 80.0f));
2036 array->addControlPoint(Vec2(80.0f, 80.0f));
2037 array->addControlPoint(Vec2(s.width / 2, s.height / 2));
2038
2039 auto action = CatmullRomBy::create(3, array);
2040 auto reverse = action->reverse();
2041
2042 auto seq = Sequence::create(action, reverse, nullptr);
2043
2044 _tamara->runAction(seq);
2045
2046 auto drawNode1 = DrawNode::create();
2047 drawNode1->setPosition(Vec2(50.0f,50.0f));
2048 drawNode1->drawCatmullRom(array, 50, Color4F(1.0f, 0.0f, 1.0f, 1.0f));
2049 this->addChild(drawNode1);
2050
2051 //
2052 // sprite 2 (To)
2053 //
2054 // The startPosition is not important here, because it uses a "To" action.
2055 // The initial position will be the 1st point of the Catmull Rom path
2056 //
2057
2058 auto array2 = PointArray::create(20);
2059
2060 array2->addControlPoint(Vec2(s.width / 2, 30.0f));
2061 array2->addControlPoint(Vec2(s.width -80, 30.0f));
2062 array2->addControlPoint(Vec2(s.width - 80, s.height - 80));
2063 array2->addControlPoint(Vec2(s.width / 2, s.height - 80));
2064 array2->addControlPoint(Vec2(s.width / 2, 30.0f));
2065
2066 auto action2 = CatmullRomTo::create(3, array2);
2067 auto reverse2 = action2->reverse();
2068
2069 auto seq2 = Sequence::create(action2, reverse2, nullptr);
2070
2071 _kathia->runAction(seq2);
2072
2073 auto drawNode2 = DrawNode::create();
2074 drawNode2->drawCatmullRom(array2, 50, Color4F(0.0f, 1.0f, 1.0f, 1.0f));
2075 this->addChild(drawNode2);
2076}
void centerSprites(unsigned int numberOfSprites)
virtual void onEnter() override
cocos2d::Sprite * _tamara
Definition: ActionsTest.h:38
cocos2d::Sprite * _kathia
Definition: ActionsTest.h:39

引用了 ActionsDemo::_kathia, ActionsDemo::_tamara, ActionsDemo::centerSprites() , 以及 ActionsDemo::onEnter().

+ 函数调用图:

◆ subtitle()

std::string ActionCatmullRom::subtitle ( ) const
overridevirtual

重载 TestCase .

在文件 ActionsTest.cpp2087 行定义.

2088{
2089 return "Catmull Rom spline paths. Testing reverse too";
2090}

◆ title()

std::string ActionCatmullRom::title ( ) const
overridevirtual

重载 ActionsDemo .

在文件 ActionsTest.cpp2082 行定义.

2083{
2084 return "CatmullRomBy / CatmullRomTo";
2085}

该类的文档由以下文件生成: