PuzzleSDK
ParallaxTest.h
浏览该文件的文档.
1/****************************************************************************
2 Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
3
4 http://www.cocos2d-x.org
5
6 Permission is hereby granted, free of charge, to any person obtaining a copy
7 of this software and associated documentation files (the "Software"), to deal
8 in the Software without restriction, including without limitation the rights
9 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 copies of the Software, and to permit persons to whom the Software is
11 furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 THE SOFTWARE.
23 ****************************************************************************/
24
25#ifndef _PARALLAX_TEST_H_
26#define _PARALLAX_TEST_H_
27
28#include "../BaseTest.h"
29
30DEFINE_TEST_SUITE(ParallaxTests);
31
32class ParallaxDemo : public TestCase
33{
34protected:
35 cocos2d::TextureAtlas* _atlas;
36};
37
38class Parallax1 : public ParallaxDemo
39{
40protected:
41 cocos2d::Node* _root;
42 cocos2d::Node* _target;
43 cocos2d::MotionStreak* _streak;
44
45public:
47 Parallax1();
48 virtual std::string title() const override;
49};
50
51class Parallax2 : public ParallaxDemo
52{
53protected:
54 cocos2d::Node* _root;
55 cocos2d::Node* _target;
56 cocos2d::MotionStreak* _streak;
57
58public:
60 Parallax2();
61
62 void onTouchesMoved(const std::vector<cocos2d::Touch*>& touches, cocos2d::Event* event);
63
64 virtual std::string title() const override;
65};
66
67class Issue2572 : public ParallaxDemo
68{
69protected:
70 cocos2d::ParallaxNode* _paraNode;
72 float _addTimer;
73 cocos2d::Vector<cocos2d::Sprite*> _childList;
74 ssize_t _preListSize;
76
79 cocos2d::Vec2 _wholeMoveSize;
80
81 virtual void update(float dt) override;
82
83public:
85 Issue2572();
86
87 virtual std::string title() const override;
88 virtual std::string subtitle() const override;
89};
90
91#endif
DEFINE_TEST_SUITE(ParallaxTests)
cocos2d::Vector< cocos2d::Sprite * > _childList
Definition: ParallaxTest.h:73
virtual std::string subtitle() const override
CREATE_FUNC(Issue2572)
virtual std::string title() const override
cocos2d::Vec2 _wholeMoveSize
Definition: ParallaxTest.h:79
float _moveTimer
Definition: ParallaxTest.h:71
float _addChildStep
Definition: ParallaxTest.h:77
cocos2d::ParallaxNode * _paraNode
Definition: ParallaxTest.h:70
float _wholeMoveTime
Definition: ParallaxTest.h:78
ssize_t _preListSize
Definition: ParallaxTest.h:74
int _printCount
Definition: ParallaxTest.h:75
virtual void update(float dt) override
float _addTimer
Definition: ParallaxTest.h:72
cocos2d::Node * _root
Definition: ParallaxTest.h:41
CREATE_FUNC(Parallax1)
cocos2d::Node * _target
Definition: ParallaxTest.h:42
virtual std::string title() const override
cocos2d::MotionStreak * _streak
Definition: ParallaxTest.h:43
CREATE_FUNC(Parallax2)
virtual std::string title() const override
cocos2d::Node * _target
Definition: ParallaxTest.h:55
cocos2d::MotionStreak * _streak
Definition: ParallaxTest.h:56
cocos2d::Node * _root
Definition: ParallaxTest.h:54
void onTouchesMoved(const std::vector< cocos2d::Touch * > &touches, cocos2d::Event *event)
cocos2d::TextureAtlas * _atlas
Definition: ParallaxTest.h:35