mirror of https://github.com/axmolengine/axmol.git
Merge remote-tracking branch 'upstream/develop' into develop
Conflicts: cocos/scripting/auto-generated tools/bindings-generator
This commit is contained in:
commit
2e8d8728ff
6
AUTHORS
6
AUTHORS
|
@ -659,6 +659,12 @@ Developers:
|
||||||
bopohaa
|
bopohaa
|
||||||
Fixed a bug that Webp test crashes.
|
Fixed a bug that Webp test crashes.
|
||||||
|
|
||||||
|
lajos
|
||||||
|
FontTest isn't rendered correctly with custom TTF font on Mac platform.
|
||||||
|
|
||||||
|
hulefei
|
||||||
|
Added gui namespace before SEL_TouchEvent.
|
||||||
|
|
||||||
Retired Core Developers:
|
Retired Core Developers:
|
||||||
WenSheng Yang
|
WenSheng Yang
|
||||||
Author of windows port, CCTextField,
|
Author of windows port, CCTextField,
|
||||||
|
|
|
@ -1,3 +1,12 @@
|
||||||
|
cocos2d-x-3.0beta0 ?? 2013
|
||||||
|
[All]
|
||||||
|
[NEW] Upgrated Box2D to 2.3.0
|
||||||
|
[NEW] Added ThreadHelper, ThreadHelper::runOnGLThread() simplify invoking engine codes and OpenGL ES commands in a thread other then gl thread.
|
||||||
|
[Android]
|
||||||
|
[NEW] build/android-build.sh: add supporting to generate .apk file
|
||||||
|
[FIX] XMLHttpRequest receives wrong binary array.
|
||||||
|
[NEW] Bindings-generator supports to bind 'unsigned long'.
|
||||||
|
[FIX] 'Test Frame Event' of TestJavascript/CocoStudioArmatureTest Crashes.
|
||||||
cocos2d-x-3.0alpha1 Nov.19 2013
|
cocos2d-x-3.0alpha1 Nov.19 2013
|
||||||
[all platforms]
|
[all platforms]
|
||||||
[DOC] Added RELEASE_NOTES and CODING_STYLE.md files
|
[DOC] Added RELEASE_NOTES and CODING_STYLE.md files
|
||||||
|
|
|
@ -15,8 +15,10 @@ ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JSB_SAMPLES
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
|
|
||||||
print """%s [-n ndk-build-parameter] target.
|
print """%s [-n ndk-build-parameter] [-p android-platform] [-b build-mode] target.
|
||||||
|
|
||||||
|
Valid android-platform are:[10|11|12|13|14|15|16|17]
|
||||||
|
Valid build-mode are:[debug|release]
|
||||||
Valid targets are: [hellocpp|testcpp|simplegame|assetsmanager|hellolua|testlua|cocosdragon
|
Valid targets are: [hellocpp|testcpp|simplegame|assetsmanager|hellolua|testlua|cocosdragon
|
||||||
|crystalcraze|moonwarriors|testjavascript|watermelonwithme]
|
|crystalcraze|moonwarriors|testjavascript|watermelonwithme]
|
||||||
|
|
||||||
|
@ -33,6 +35,18 @@ def check_environment_variables():
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
||||||
return NDK_ROOT
|
return NDK_ROOT
|
||||||
|
|
||||||
|
def check_environment_variables_sdk():
|
||||||
|
''' Checking the environment ANDROID_SDK_ROOT, which will be used for building
|
||||||
|
'''
|
||||||
|
|
||||||
|
try:
|
||||||
|
SDK_ROOT = os.environ['ANDROID_SDK_ROOT']
|
||||||
|
except Exception:
|
||||||
|
print "ANDROID_SDK_ROOT not defined. Please define ANDROID_SDK_ROOT in your environment"
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
|
return SDK_ROOT
|
||||||
|
|
||||||
def select_toolchain_version():
|
def select_toolchain_version():
|
||||||
'''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
|
'''Because ndk-r8e uses gcc4.6 as default. gcc4.6 doesn't support c++11. So we should select gcc4.7 when
|
||||||
|
@ -81,7 +95,7 @@ def caculate_built_samples(args):
|
||||||
targets = set(targets)
|
targets = set(targets)
|
||||||
return list(targets)
|
return list(targets)
|
||||||
|
|
||||||
def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param):
|
def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param,sdk_root,android_platform,build_mode):
|
||||||
|
|
||||||
ndk_path = os.path.join(ndk_root, "ndk-build")
|
ndk_path = os.path.join(ndk_root, "ndk-build")
|
||||||
|
|
||||||
|
@ -97,7 +111,19 @@ def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param):
|
||||||
else:
|
else:
|
||||||
command = '%s -C %s %s %s' % (ndk_path, app_android_root, ndk_build_param, ndk_module_path)
|
command = '%s -C %s %s %s' % (ndk_path, app_android_root, ndk_build_param, ndk_module_path)
|
||||||
if os.system(command) != 0:
|
if os.system(command) != 0:
|
||||||
raise Exception("Build project [ " + app_android_root + " ] fails!")
|
raise Exception("Build dynamic library for project [ " + app_android_root + " ] fails!")
|
||||||
|
elif android_platform is not None:
|
||||||
|
sdk_tool_path = os.path.join(sdk_root, "tools/android")
|
||||||
|
cocoslib_path = os.path.join(cocos_root, "cocos/2d/platform/android/java")
|
||||||
|
command = '%s update lib-project -t %s -p %s' % (sdk_tool_path,android_platform,cocoslib_path)
|
||||||
|
if os.system(command) != 0:
|
||||||
|
raise Exception("update cocos lib-project [ " + cocoslib_path + " ] fails!")
|
||||||
|
command = '%s update project -t %s -p %s -s' % (sdk_tool_path,android_platform,app_android_root)
|
||||||
|
if os.system(command) != 0:
|
||||||
|
raise Exception("update project [ " + app_android_root + " ] fails!")
|
||||||
|
buildfile_path = os.path.join(app_android_root, "build.xml")
|
||||||
|
command = 'ant clean %s -f %s -Dsdk.dir=%s' % (build_mode,buildfile_path,sdk_root)
|
||||||
|
os.system(command)
|
||||||
|
|
||||||
def copy_files(src, dst):
|
def copy_files(src, dst):
|
||||||
|
|
||||||
|
@ -169,15 +195,29 @@ def copy_resources(target, app_android_root):
|
||||||
resources_dir = os.path.join(app_android_root, "../../../Cpp/TestCpp/Resources")
|
resources_dir = os.path.join(app_android_root, "../../../Cpp/TestCpp/Resources")
|
||||||
copy_files(resources_dir, assets_dir)
|
copy_files(resources_dir, assets_dir)
|
||||||
|
|
||||||
def build_samples(target,ndk_build_param):
|
def build_samples(target,ndk_build_param,android_platform,build_mode):
|
||||||
|
|
||||||
ndk_root = check_environment_variables()
|
ndk_root = check_environment_variables()
|
||||||
|
sdk_root = None
|
||||||
select_toolchain_version()
|
select_toolchain_version()
|
||||||
build_targets = caculate_built_samples(target)
|
build_targets = caculate_built_samples(target)
|
||||||
|
|
||||||
current_dir = os.path.dirname(os.path.realpath(__file__))
|
current_dir = os.path.dirname(os.path.realpath(__file__))
|
||||||
cocos_root = os.path.join(current_dir, "..")
|
cocos_root = os.path.join(current_dir, "..")
|
||||||
|
|
||||||
|
if android_platform is not None:
|
||||||
|
sdk_root = check_environment_variables_sdk()
|
||||||
|
if android_platform.isdigit():
|
||||||
|
android_platform = 'android-'+android_platform
|
||||||
|
else:
|
||||||
|
print 'please use vaild android platform'
|
||||||
|
exit(1)
|
||||||
|
|
||||||
|
if build_mode is None:
|
||||||
|
build_mode = 'debug'
|
||||||
|
elif build_mode != 'release':
|
||||||
|
build_mode = 'debug'
|
||||||
|
|
||||||
app_android_root = ''
|
app_android_root = ''
|
||||||
for target in build_targets:
|
for target in build_targets:
|
||||||
if target == 'hellocpp':
|
if target == 'hellocpp':
|
||||||
|
@ -207,7 +247,7 @@ def build_samples(target,ndk_build_param):
|
||||||
continue
|
continue
|
||||||
|
|
||||||
copy_resources(target, app_android_root)
|
copy_resources(target, app_android_root)
|
||||||
do_build(cocos_root, ndk_root, app_android_root, ndk_build_param)
|
do_build(cocos_root, ndk_root, app_android_root, ndk_build_param,sdk_root,android_platform,build_mode)
|
||||||
|
|
||||||
# -------------- main --------------
|
# -------------- main --------------
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -215,13 +255,15 @@ if __name__ == '__main__':
|
||||||
#parse the params
|
#parse the params
|
||||||
parser = OptionParser()
|
parser = OptionParser()
|
||||||
parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build')
|
parser.add_option("-n", "--ndk", dest="ndk_build_param", help='parameter for ndk-build')
|
||||||
|
parser.add_option("-p", "--platform", dest="android_platform", help='parameter for android-update')
|
||||||
|
parser.add_option("-b", "--build", dest="build_mode", help='the build mode for java project,debug or release.Get more information,please refer to http://developer.android.com/tools/building/building-cmdline.html')
|
||||||
(opts, args) = parser.parse_args()
|
(opts, args) = parser.parse_args()
|
||||||
|
|
||||||
if len(args) == 0:
|
if len(args) == 0:
|
||||||
usage()
|
usage()
|
||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
build_samples(args, opts.ndk_build_param)
|
build_samples(args, opts.ndk_build_param,opts.android_platform,opts.build_mode)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print e
|
print e
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
0d9ce76f7e63d75718c38b1137b2580e19d0db76
|
4367613b05de13587c6cd0fb07aeef45f44afcfc
|
|
@ -1 +1 @@
|
||||||
2461d13fd6f4fadc6ee396109932e50b1de8ed99
|
edf83dc058b5630510ac8d327ae8db62ab062cc6
|
|
@ -39,13 +39,13 @@ CCEventAcceleration.cpp \
|
||||||
CCEventCustom.cpp \
|
CCEventCustom.cpp \
|
||||||
CCEventDispatcher.cpp \
|
CCEventDispatcher.cpp \
|
||||||
CCEventKeyboard.cpp \
|
CCEventKeyboard.cpp \
|
||||||
CCEventMouse.cpp \
|
|
||||||
CCEventListenerMouse.cpp \
|
|
||||||
CCEventListener.cpp \
|
CCEventListener.cpp \
|
||||||
CCEventListenerAcceleration.cpp \
|
CCEventListenerAcceleration.cpp \
|
||||||
CCEventListenerCustom.cpp \
|
CCEventListenerCustom.cpp \
|
||||||
CCEventListenerKeyboard.cpp \
|
CCEventListenerKeyboard.cpp \
|
||||||
|
CCEventListenerMouse.cpp \
|
||||||
CCEventListenerTouch.cpp \
|
CCEventListenerTouch.cpp \
|
||||||
|
CCEventMouse.cpp \
|
||||||
CCEventTouch.cpp \
|
CCEventTouch.cpp \
|
||||||
CCFont.cpp \
|
CCFont.cpp \
|
||||||
CCFontAtlas.cpp \
|
CCFontAtlas.cpp \
|
||||||
|
@ -149,11 +149,6 @@ platform/CCThread.cpp \
|
||||||
../physics/CCPhysicsJoint.cpp \
|
../physics/CCPhysicsJoint.cpp \
|
||||||
../physics/CCPhysicsShape.cpp \
|
../physics/CCPhysicsShape.cpp \
|
||||||
../physics/CCPhysicsWorld.cpp \
|
../physics/CCPhysicsWorld.cpp \
|
||||||
../physics/box2d/CCPhysicsBodyInfo_box2d.cpp \
|
|
||||||
../physics/box2d/CCPhysicsContactInfo_box2d.cpp \
|
|
||||||
../physics/box2d/CCPhysicsJointInfo_box2d.cpp \
|
|
||||||
../physics/box2d/CCPhysicsShapeInfo_box2d.cpp \
|
|
||||||
../physics/box2d/CCPhysicsWorldInfo_box2d.cpp \
|
|
||||||
../physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp \
|
../physics/chipmunk/CCPhysicsBodyInfo_chipmunk.cpp \
|
||||||
../physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp \
|
../physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp \
|
||||||
../physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp \
|
../physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp \
|
||||||
|
|
|
@ -46,15 +46,6 @@ class CC_DLL Action : public Object, public Clonable
|
||||||
public:
|
public:
|
||||||
/// Default tag used for all the actions
|
/// Default tag used for all the actions
|
||||||
static const int INVALID_TAG = -1;
|
static const int INVALID_TAG = -1;
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Action();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Action();
|
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -108,6 +99,9 @@ public:
|
||||||
inline void setTag(int tag) { _tag = tag; }
|
inline void setTag(int tag) { _tag = tag; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Action();
|
||||||
|
virtual ~Action();
|
||||||
|
|
||||||
Node *_originalTarget;
|
Node *_originalTarget;
|
||||||
/** The "target".
|
/** The "target".
|
||||||
The target will be set with the 'startWithTarget' method.
|
The target will be set with the 'startWithTarget' method.
|
||||||
|
@ -117,6 +111,9 @@ protected:
|
||||||
Node *_target;
|
Node *_target;
|
||||||
/** The action tag. An identifier of the action */
|
/** The action tag. An identifier of the action */
|
||||||
int _tag;
|
int _tag;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -131,17 +128,6 @@ protected:
|
||||||
class CC_DLL FiniteTimeAction : public Action
|
class CC_DLL FiniteTimeAction : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
FiniteTimeAction()
|
|
||||||
: _duration(0)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~FiniteTimeAction(){}
|
|
||||||
//! get duration in seconds of the action
|
//! get duration in seconds of the action
|
||||||
inline float getDuration() const { return _duration; }
|
inline float getDuration() const { return _duration; }
|
||||||
//! set duration in seconds of the action
|
//! set duration in seconds of the action
|
||||||
|
@ -154,8 +140,16 @@ public:
|
||||||
virtual FiniteTimeAction* clone() const override = 0;
|
virtual FiniteTimeAction* clone() const override = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
FiniteTimeAction()
|
||||||
|
: _duration(0)
|
||||||
|
{}
|
||||||
|
virtual ~FiniteTimeAction(){}
|
||||||
|
|
||||||
//! duration in seconds
|
//! duration in seconds
|
||||||
float _duration;
|
float _duration;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionInterval;
|
class ActionInterval;
|
||||||
|
@ -172,22 +166,11 @@ class CC_DLL Speed : public Action
|
||||||
public:
|
public:
|
||||||
/** create the action */
|
/** create the action */
|
||||||
static Speed* create(ActionInterval* action, float speed);
|
static Speed* create(ActionInterval* action, float speed);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Speed();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Speed(void);
|
|
||||||
|
|
||||||
inline float getSpeed(void) const { return _speed; }
|
inline float getSpeed(void) const { return _speed; }
|
||||||
/** alter the speed of the inner function in runtime */
|
/** alter the speed of the inner function in runtime */
|
||||||
inline void setSpeed(float speed) { _speed = speed; }
|
inline void setSpeed(float speed) { _speed = speed; }
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithAction(ActionInterval *action, float speed);
|
|
||||||
|
|
||||||
void setInnerAction(ActionInterval *action);
|
void setInnerAction(ActionInterval *action);
|
||||||
|
|
||||||
|
@ -204,8 +187,16 @@ public:
|
||||||
virtual bool isDone() const override;
|
virtual bool isDone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Speed();
|
||||||
|
virtual ~Speed(void);
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithAction(ActionInterval *action, float speed);
|
||||||
|
|
||||||
float _speed;
|
float _speed;
|
||||||
ActionInterval *_innerAction;
|
ActionInterval *_innerAction;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Speed);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -230,38 +221,11 @@ public:
|
||||||
* with no boundary.
|
* with no boundary.
|
||||||
*/
|
*/
|
||||||
static Follow* create(Node *followedNode, const Rect& rect = Rect::ZERO);
|
static Follow* create(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Follow()
|
|
||||||
: _followedNode(nullptr)
|
|
||||||
, _boundarySet(false)
|
|
||||||
, _boundaryFullyCovered(false)
|
|
||||||
, _leftBoundary(0.0)
|
|
||||||
, _rightBoundary(0.0)
|
|
||||||
, _topBoundary(0.0)
|
|
||||||
, _bottomBoundary(0.0)
|
|
||||||
, _worldRect(Rect::ZERO)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Follow();
|
|
||||||
|
|
||||||
inline bool isBoundarySet() const { return _boundarySet; }
|
inline bool isBoundarySet() const { return _boundarySet; }
|
||||||
/** alter behavior - turn on/off boundary */
|
/** alter behavior - turn on/off boundary */
|
||||||
inline void setBoudarySet(bool value) { _boundarySet = value; }
|
inline void setBoudarySet(bool value) { _boundarySet = value; }
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the action with a set boundary or with no boundary.
|
|
||||||
*
|
|
||||||
* @param followedNode The node to be followed.
|
|
||||||
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
|
||||||
* with no boundary.
|
|
||||||
*/
|
|
||||||
bool initWithTarget(Node *followedNode, const Rect& rect = Rect::ZERO);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Override
|
// Override
|
||||||
//
|
//
|
||||||
|
@ -272,6 +236,33 @@ public:
|
||||||
virtual void stop() override;
|
virtual void stop() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
Follow()
|
||||||
|
: _followedNode(nullptr)
|
||||||
|
, _boundarySet(false)
|
||||||
|
, _boundaryFullyCovered(false)
|
||||||
|
, _leftBoundary(0.0)
|
||||||
|
, _rightBoundary(0.0)
|
||||||
|
, _topBoundary(0.0)
|
||||||
|
, _bottomBoundary(0.0)
|
||||||
|
, _worldRect(Rect::ZERO)
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~Follow();
|
||||||
|
/**
|
||||||
|
* Initializes the action with a set boundary or with no boundary.
|
||||||
|
*
|
||||||
|
* @param followedNode The node to be followed.
|
||||||
|
* @param rect The boundary. If \p rect is equal to Rect::ZERO, it'll work
|
||||||
|
* with no boundary.
|
||||||
|
*/
|
||||||
|
bool initWithTarget(Node *followedNode, const Rect& rect = Rect::ZERO);
|
||||||
|
|
||||||
// node to follow
|
// node to follow
|
||||||
Node *_followedNode;
|
Node *_followedNode;
|
||||||
|
|
||||||
|
@ -292,6 +283,8 @@ protected:
|
||||||
float _bottomBoundary;
|
float _bottomBoundary;
|
||||||
Rect _worldRect;
|
Rect _worldRect;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Follow);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -44,14 +44,6 @@ class Object;
|
||||||
class CC_DLL ActionEase : public ActionInterval
|
class CC_DLL ActionEase : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ActionEase(void);
|
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithAction(ActionInterval *action);
|
|
||||||
|
|
||||||
virtual ActionInterval* getInnerAction();
|
virtual ActionInterval* getInnerAction();
|
||||||
|
|
||||||
|
@ -65,8 +57,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ActionEase() {}
|
||||||
|
virtual ~ActionEase();
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithAction(ActionInterval *action);
|
||||||
|
|
||||||
/** The inner action */
|
/** The inner action */
|
||||||
ActionInterval *_inner;
|
ActionInterval *_inner;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -76,15 +76,6 @@ protected:
|
||||||
class CC_DLL EaseRateAction : public ActionEase
|
class CC_DLL EaseRateAction : public ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~EaseRateAction();
|
|
||||||
|
|
||||||
/** Initializes the action with the inner action and the rate parameter */
|
|
||||||
bool initWithAction(ActionInterval *pAction, float fRate);
|
|
||||||
|
|
||||||
/** set rate value for the actions */
|
/** set rate value for the actions */
|
||||||
inline void setRate(float rate) { _rate = rate; }
|
inline void setRate(float rate) { _rate = rate; }
|
||||||
/** get rate value for the actions */
|
/** get rate value for the actions */
|
||||||
|
@ -97,7 +88,15 @@ public:
|
||||||
virtual EaseRateAction* reverse() const override = 0;
|
virtual EaseRateAction* reverse() const override = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
EaseRateAction() {}
|
||||||
|
virtual ~EaseRateAction();
|
||||||
|
/** Initializes the action with the inner action and the rate parameter */
|
||||||
|
bool initWithAction(ActionInterval *pAction, float fRate);
|
||||||
|
|
||||||
float _rate;
|
float _rate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -114,6 +113,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseIn* clone() const override;
|
virtual EaseIn* clone() const override;
|
||||||
virtual EaseIn* reverse() const override;
|
virtual EaseIn* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseIn() {}
|
||||||
|
virtual ~EaseIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -130,6 +136,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseOut* clone() const override;
|
virtual EaseOut* clone() const override;
|
||||||
virtual EaseOut* reverse() const override;
|
virtual EaseOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseOut() {}
|
||||||
|
virtual ~EaseOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -146,6 +159,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseInOut* clone() const override;
|
virtual EaseInOut* clone() const override;
|
||||||
virtual EaseInOut* reverse() const override;
|
virtual EaseInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseInOut() {}
|
||||||
|
virtual ~EaseInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -162,6 +182,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseExponentialIn* clone() const override;
|
virtual EaseExponentialIn* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseExponentialIn() {}
|
||||||
|
virtual ~EaseExponentialIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -178,6 +205,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseExponentialOut* clone() const override;
|
virtual EaseExponentialOut* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseExponentialOut() {}
|
||||||
|
virtual ~EaseExponentialOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -194,6 +228,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseExponentialInOut* clone() const override;
|
virtual EaseExponentialInOut* clone() const override;
|
||||||
virtual EaseExponentialInOut* reverse() const override;
|
virtual EaseExponentialInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseExponentialInOut() {}
|
||||||
|
virtual ~EaseExponentialInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseExponentialInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -210,6 +251,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseSineIn* clone() const override;
|
virtual EaseSineIn* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseSineIn() {}
|
||||||
|
virtual ~EaseSineIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -226,6 +274,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseSineOut* clone() const override;
|
virtual EaseSineOut* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseSineOut() {}
|
||||||
|
virtual ~EaseSineOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -242,6 +297,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseSineInOut* clone() const override;
|
virtual EaseSineInOut* clone() const override;
|
||||||
virtual EaseSineInOut* reverse() const override;
|
virtual EaseSineInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseSineInOut() {}
|
||||||
|
virtual ~EaseSineInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseSineInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -252,8 +314,6 @@ public:
|
||||||
class CC_DLL EaseElastic : public ActionEase
|
class CC_DLL EaseElastic : public ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
|
|
||||||
bool initWithAction(ActionInterval *action, float period = 0.3f);
|
|
||||||
|
|
||||||
/** get period of the wave in radians. default is 0.3 */
|
/** get period of the wave in radians. default is 0.3 */
|
||||||
inline float getPeriod() const { return _period; }
|
inline float getPeriod() const { return _period; }
|
||||||
|
@ -267,7 +327,16 @@ public:
|
||||||
virtual EaseElastic* reverse() const override = 0;
|
virtual EaseElastic* reverse() const override = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
EaseElastic() {}
|
||||||
|
virtual ~EaseElastic() {}
|
||||||
|
/** Initializes the action with the inner action and the period in radians (default is 0.3) */
|
||||||
|
bool initWithAction(ActionInterval *action, float period = 0.3f);
|
||||||
|
|
||||||
float _period;
|
float _period;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -287,6 +356,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseElasticIn* clone() const override;
|
virtual EaseElasticIn* clone() const override;
|
||||||
virtual EaseElastic* reverse() const override;
|
virtual EaseElastic* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseElasticIn() {}
|
||||||
|
virtual ~EaseElasticIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -306,6 +382,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseElasticOut* clone() const override;
|
virtual EaseElasticOut* clone() const override;
|
||||||
virtual EaseElastic* reverse() const override;
|
virtual EaseElastic* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseElasticOut() {}
|
||||||
|
virtual ~EaseElasticOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -325,6 +408,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseElasticInOut* clone() const override;
|
virtual EaseElasticInOut* clone() const override;
|
||||||
virtual EaseElasticInOut* reverse() const override;
|
virtual EaseElasticInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseElasticInOut() {}
|
||||||
|
virtual ~EaseElasticInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,6 +430,13 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual EaseBounce* clone() const override = 0;
|
virtual EaseBounce* clone() const override = 0;
|
||||||
virtual EaseBounce* reverse() const override = 0;
|
virtual EaseBounce* reverse() const override = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBounce() {}
|
||||||
|
virtual ~EaseBounce() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounce);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -358,6 +455,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBounceIn* clone() const override;
|
virtual EaseBounceIn* clone() const override;
|
||||||
virtual EaseBounce* reverse() const override;
|
virtual EaseBounce* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBounceIn() {}
|
||||||
|
virtual ~EaseBounceIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -376,6 +480,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBounceOut* clone() const override;
|
virtual EaseBounceOut* clone() const override;
|
||||||
virtual EaseBounce* reverse() const override;
|
virtual EaseBounce* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBounceOut() {}
|
||||||
|
virtual ~EaseBounceOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -394,6 +505,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBounceInOut* clone() const override;
|
virtual EaseBounceInOut* clone() const override;
|
||||||
virtual EaseBounceInOut* reverse() const override;
|
virtual EaseBounceInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBounceInOut() {}
|
||||||
|
virtual ~EaseBounceInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBounceInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -412,6 +530,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBackIn* clone() const override;
|
virtual EaseBackIn* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBackIn() {}
|
||||||
|
virtual ~EaseBackIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -430,6 +555,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBackOut* clone() const override;
|
virtual EaseBackOut* clone() const override;
|
||||||
virtual ActionEase* reverse() const override;
|
virtual ActionEase* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBackOut() {}
|
||||||
|
virtual ~EaseBackOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -448,6 +580,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual EaseBackInOut* clone() const override;
|
virtual EaseBackInOut* clone() const override;
|
||||||
virtual EaseBackInOut* reverse() const override;
|
virtual EaseBackInOut* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
EaseBackInOut() {}
|
||||||
|
virtual ~EaseBackInOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackInOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -41,8 +41,6 @@ class GridBase;
|
||||||
class CC_DLL GridAction : public ActionInterval
|
class CC_DLL GridAction : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** initializes the action with size and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize);
|
|
||||||
|
|
||||||
/** returns the grid */
|
/** returns the grid */
|
||||||
virtual GridBase* getGrid();
|
virtual GridBase* getGrid();
|
||||||
|
@ -53,7 +51,15 @@ public:
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
GridAction() {}
|
||||||
|
virtual ~GridAction() {}
|
||||||
|
/** initializes the action with size and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize);
|
||||||
|
|
||||||
Size _gridSize;
|
Size _gridSize;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -153,18 +159,6 @@ class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||||
static AccelDeccelAmplitude* create(Action *action, float duration);
|
static AccelDeccelAmplitude* create(Action *action, float duration);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~AccelDeccelAmplitude();
|
|
||||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
bool initWithAction(Action *pAction, float duration);
|
|
||||||
|
|
||||||
/** returns a new clone of the action */
|
|
||||||
virtual AccelDeccelAmplitude* clone() const;
|
|
||||||
/** returns a new reversed action */
|
|
||||||
virtual AccelDeccelAmplitude* reverse() const;
|
|
||||||
|
|
||||||
/** get amplitude rate */
|
/** get amplitude rate */
|
||||||
inline float getRate(void) const { return _rate; }
|
inline float getRate(void) const { return _rate; }
|
||||||
|
@ -174,10 +168,20 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
virtual AccelDeccelAmplitude* clone() const override;
|
||||||
|
virtual AccelDeccelAmplitude* reverse() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
AccelDeccelAmplitude() {}
|
||||||
|
virtual ~AccelDeccelAmplitude();
|
||||||
|
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||||
|
bool initWithAction(Action *pAction, float duration);
|
||||||
|
|
||||||
float _rate;
|
float _rate;
|
||||||
ActionInterval *_other;
|
ActionInterval *_other;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief AccelAmplitude action */
|
/** @brief AccelAmplitude action */
|
||||||
|
@ -186,14 +190,6 @@ class CC_DLL AccelAmplitude : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||||
static AccelAmplitude* create(Action *action, float duration);
|
static AccelAmplitude* create(Action *action, float duration);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~AccelAmplitude();
|
|
||||||
|
|
||||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
bool initWithAction(Action *action, float duration);
|
|
||||||
|
|
||||||
/** get amplitude rate */
|
/** get amplitude rate */
|
||||||
inline float getRate() const { return _rate; }
|
inline float getRate() const { return _rate; }
|
||||||
|
@ -207,8 +203,15 @@ public:
|
||||||
virtual AccelAmplitude* reverse() const override;
|
virtual AccelAmplitude* reverse() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
AccelAmplitude() {}
|
||||||
|
virtual ~AccelAmplitude();
|
||||||
|
bool initWithAction(Action *action, float duration);
|
||||||
|
|
||||||
float _rate;
|
float _rate;
|
||||||
ActionInterval *_other;
|
ActionInterval *_other;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief DeccelAmplitude action */
|
/** @brief DeccelAmplitude action */
|
||||||
|
@ -217,13 +220,6 @@ class CC_DLL DeccelAmplitude : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||||
static DeccelAmplitude* create(Action *action, float duration);
|
static DeccelAmplitude* create(Action *action, float duration);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~DeccelAmplitude();
|
|
||||||
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
|
||||||
bool initWithAction(Action *action, float duration);
|
|
||||||
|
|
||||||
/** get amplitude rate */
|
/** get amplitude rate */
|
||||||
inline float getRate(void) const { return _rate; }
|
inline float getRate(void) const { return _rate; }
|
||||||
|
@ -233,12 +229,20 @@ public:
|
||||||
// overrides
|
// overrides
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual DeccelAmplitude* clone() const;
|
virtual DeccelAmplitude* clone() const override;
|
||||||
virtual DeccelAmplitude* reverse() const;
|
virtual DeccelAmplitude* reverse() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
DeccelAmplitude() {}
|
||||||
|
virtual ~DeccelAmplitude();
|
||||||
|
/** initializes the action with an inner action that has the amplitude property, and a duration time */
|
||||||
|
bool initWithAction(Action *action, float duration);
|
||||||
|
|
||||||
float _rate;
|
float _rate;
|
||||||
ActionInterval *_other;
|
ActionInterval *_other;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief StopGrid action.
|
/** @brief StopGrid action.
|
||||||
|
@ -256,6 +260,13 @@ public:
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual StopGrid* clone() const override;
|
virtual StopGrid* clone() const override;
|
||||||
virtual StopGrid* reverse() const override;
|
virtual StopGrid* reverse() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
StopGrid() {}
|
||||||
|
virtual ~StopGrid() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief ReuseGrid action */
|
/** @brief ReuseGrid action */
|
||||||
|
@ -265,16 +276,21 @@ public:
|
||||||
/** creates an action with the number of times that the current grid will be reused */
|
/** creates an action with the number of times that the current grid will be reused */
|
||||||
static ReuseGrid* create(int times);
|
static ReuseGrid* create(int times);
|
||||||
|
|
||||||
/** initializes an action with the number of times that the current grid will be reused */
|
|
||||||
bool initWithTimes(int times);
|
|
||||||
|
|
||||||
// Override
|
// Override
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual ReuseGrid* clone() const override;
|
virtual ReuseGrid* clone() const override;
|
||||||
virtual ReuseGrid* reverse() const override;
|
virtual ReuseGrid* reverse() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ReuseGrid() {}
|
||||||
|
virtual ~ReuseGrid() {}
|
||||||
|
/** initializes an action with the number of times that the current grid will be reused */
|
||||||
|
bool initWithTimes(int times);
|
||||||
|
|
||||||
int _times;
|
int _times;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -53,17 +53,22 @@ public:
|
||||||
/** sets the ampliture rate */
|
/** sets the ampliture rate */
|
||||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||||
|
|
||||||
/** initializes an action with duration, grid size, waves and amplitude */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Waves3D* clone() const override;
|
virtual Waves3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Waves3D() {}
|
||||||
|
virtual ~Waves3D() {}
|
||||||
|
/** initializes an action with duration, grid size, waves and amplitude */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
unsigned int _waves;
|
unsigned int _waves;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FlipX3D action */
|
/** @brief FlipX3D action */
|
||||||
|
@ -73,25 +78,36 @@ public:
|
||||||
/** creates the action with duration */
|
/** creates the action with duration */
|
||||||
static FlipX3D* create(float duration);
|
static FlipX3D* create(float duration);
|
||||||
|
|
||||||
|
// Override
|
||||||
|
virtual FlipX3D* clone() const override;
|
||||||
|
virtual void update(float time) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FlipX3D() {}
|
||||||
|
virtual ~FlipX3D() {}
|
||||||
/** initializes the action with duration */
|
/** initializes the action with duration */
|
||||||
bool initWithDuration(float duration);
|
bool initWithDuration(float duration);
|
||||||
virtual bool initWithSize(const Size& gridSize, float duration);
|
virtual bool initWithSize(const Size& gridSize, float duration);
|
||||||
|
|
||||||
// Override
|
private:
|
||||||
virtual FlipX3D* clone() const override;
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
||||||
virtual void update(float time) override;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FlipY3D action */
|
/** @brief FlipY3D action */
|
||||||
class CC_DLL FlipY3D : public FlipX3D
|
class CC_DLL FlipY3D : public FlipX3D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
FlipY3D() {}
|
||||||
|
virtual ~FlipY3D() {}
|
||||||
/** creates the action with duration */
|
/** creates the action with duration */
|
||||||
static FlipY3D* create(float duration);
|
static FlipY3D* create(float duration);
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual FlipY3D* clone() const override;
|
virtual FlipY3D* clone() const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Lens3D action */
|
/** @brief Lens3D action */
|
||||||
|
@ -111,14 +127,16 @@ public:
|
||||||
inline const Point& getPosition() const { return _position; }
|
inline const Point& getPosition() const { return _position; }
|
||||||
void setPosition(const Point& position);
|
void setPosition(const Point& position);
|
||||||
|
|
||||||
/** initializes the action with center position, radius, a grid size and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Lens3D* clone() const override;
|
virtual Lens3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Lens3D() {}
|
||||||
|
virtual ~Lens3D() {}
|
||||||
|
/** initializes the action with center position, radius, a grid size and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius);
|
||||||
|
|
||||||
/* lens center position */
|
/* lens center position */
|
||||||
Point _position;
|
Point _position;
|
||||||
float _radius;
|
float _radius;
|
||||||
|
@ -128,6 +146,9 @@ protected:
|
||||||
bool _concave;
|
bool _concave;
|
||||||
|
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Ripple3D action */
|
/** @brief Ripple3D action */
|
||||||
|
@ -148,45 +169,57 @@ public:
|
||||||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||||
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
inline void setAmplitudeRate(float fAmplitudeRate) { _amplitudeRate = fAmplitudeRate; }
|
||||||
|
|
||||||
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
|
||||||
|
|
||||||
// Override
|
// Override
|
||||||
virtual Ripple3D* clone() const override;
|
virtual Ripple3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Ripple3D() {}
|
||||||
|
virtual ~Ripple3D() {}
|
||||||
|
/** initializes the action with radius, number of waves, amplitude, a grid size and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, const Point& position, float radius, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
/* center position */
|
/* center position */
|
||||||
Point _position;
|
Point _position;
|
||||||
float _radius;
|
float _radius;
|
||||||
unsigned int _waves;
|
unsigned int _waves;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Shaky3D action */
|
/** @brief Shaky3D action */
|
||||||
class CC_DLL Shaky3D : public Grid3DAction
|
class CC_DLL Shaky3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Shaky3D() {}
|
||||||
|
virtual ~Shaky3D() {}
|
||||||
/** creates the action with a range, shake Z vertices, a grid and duration */
|
/** creates the action with a range, shake Z vertices, a grid and duration */
|
||||||
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
|
static Shaky3D* create(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||||
|
|
||||||
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Shaky3D* clone() const override;
|
virtual Shaky3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** initializes the action with a range, shake Z vertices, a grid and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, int range, bool shakeZ);
|
||||||
|
|
||||||
int _randrange;
|
int _randrange;
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Liquid action */
|
/** @brief Liquid action */
|
||||||
class CC_DLL Liquid : public Grid3DAction
|
class CC_DLL Liquid : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Liquid() {}
|
||||||
|
virtual ~Liquid() {}
|
||||||
/** creates the action with amplitude, a grid and duration */
|
/** creates the action with amplitude, a grid and duration */
|
||||||
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
static Liquid* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
|
@ -196,23 +229,28 @@ public:
|
||||||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||||
|
|
||||||
/** initializes the action with amplitude, a grid and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Liquid* clone() const override;
|
virtual Liquid* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** initializes the action with amplitude, a grid and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
unsigned int _waves;
|
unsigned int _waves;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Waves action */
|
/** @brief Waves action */
|
||||||
class CC_DLL Waves : public Grid3DAction
|
class CC_DLL Waves : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Waves() {}
|
||||||
|
virtual ~Waves() {}
|
||||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||||
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
static Waves* create(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||||
|
|
||||||
|
@ -222,25 +260,30 @@ public:
|
||||||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||||
|
|
||||||
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Waves* clone() const override;
|
virtual Waves* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** initializes the action with amplitude, horizontal sin, vertical sin, a grid and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude, bool horizontal, bool vertical);
|
||||||
|
|
||||||
unsigned int _waves;
|
unsigned int _waves;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
bool _vertical;
|
bool _vertical;
|
||||||
bool _horizontal;
|
bool _horizontal;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Twirl action */
|
/** @brief Twirl action */
|
||||||
class CC_DLL Twirl : public Grid3DAction
|
class CC_DLL Twirl : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Twirl() {}
|
||||||
|
virtual ~Twirl() {}
|
||||||
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
/** creates the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||||
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
static Twirl* create(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||||
|
|
||||||
|
@ -255,19 +298,23 @@ public:
|
||||||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||||
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
inline void setAmplitudeRate(float amplitudeRate) { _amplitudeRate = amplitudeRate; }
|
||||||
|
|
||||||
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Twirl* clone() const override;
|
virtual Twirl* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** initializes the action with center position, number of twirls, amplitude, a grid size and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, Point position, unsigned int twirls, float amplitude);
|
||||||
|
|
||||||
/* twirl center */
|
/* twirl center */
|
||||||
Point _position;
|
Point _position;
|
||||||
unsigned int _twirls;
|
unsigned int _twirls;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -472,7 +472,7 @@ CallFuncN * CallFuncN::clone() const
|
||||||
if( _selectorTarget) {
|
if( _selectorTarget) {
|
||||||
a->initWithTarget(_selectorTarget, _callFuncN);
|
a->initWithTarget(_selectorTarget, _callFuncN);
|
||||||
}
|
}
|
||||||
else if( _function ){
|
else if( _functionN ){
|
||||||
a->initWithFunction(_functionN);
|
a->initWithFunction(_functionN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,6 @@ public:
|
||||||
/** Allocates and initializes the action */
|
/** Allocates and initializes the action */
|
||||||
static Show * create();
|
static Show * create();
|
||||||
|
|
||||||
Show(){}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -73,6 +72,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual ActionInstant* reverse() const override;
|
virtual ActionInstant* reverse() const override;
|
||||||
virtual Show* clone() const override;
|
virtual Show* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Show(){}
|
||||||
|
virtual ~Show(){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Show);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,14 +90,19 @@ public:
|
||||||
/** Allocates and initializes the action */
|
/** Allocates and initializes the action */
|
||||||
static Hide * create();
|
static Hide * create();
|
||||||
|
|
||||||
Hide(){}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual ActionInstant* reverse() const override;
|
virtual ActionInstant* reverse() const override;
|
||||||
virtual Hide* clone() const override;
|
virtual Hide* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Hide(){}
|
||||||
|
virtual ~Hide(){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Hide);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Toggles the visibility of a node
|
/** @brief Toggles the visibility of a node
|
||||||
|
@ -102,14 +113,19 @@ public:
|
||||||
/** Allocates and initializes the action */
|
/** Allocates and initializes the action */
|
||||||
static ToggleVisibility * create();
|
static ToggleVisibility * create();
|
||||||
|
|
||||||
ToggleVisibility(){}
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual ToggleVisibility* reverse() const override;
|
virtual ToggleVisibility* reverse() const override;
|
||||||
virtual ToggleVisibility* clone() const override;
|
virtual ToggleVisibility* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ToggleVisibility(){}
|
||||||
|
virtual ~ToggleVisibility(){}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -121,12 +137,6 @@ public:
|
||||||
/** create the action */
|
/** create the action */
|
||||||
static RemoveSelf * create(bool isNeedCleanUp = true);
|
static RemoveSelf * create(bool isNeedCleanUp = true);
|
||||||
|
|
||||||
RemoveSelf():_isNeedCleanUp(true)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** init the action */
|
|
||||||
bool init(bool isNeedCleanUp);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Override
|
// Override
|
||||||
//
|
//
|
||||||
|
@ -135,7 +145,15 @@ public:
|
||||||
virtual RemoveSelf* reverse() const override;
|
virtual RemoveSelf* reverse() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RemoveSelf() : _isNeedCleanUp(true){}
|
||||||
|
virtual ~RemoveSelf(){}
|
||||||
|
/** init the action */
|
||||||
|
bool init(bool isNeedCleanUp);
|
||||||
|
|
||||||
bool _isNeedCleanUp;
|
bool _isNeedCleanUp;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -148,13 +166,6 @@ public:
|
||||||
/** create the action */
|
/** create the action */
|
||||||
static FlipX * create(bool x);
|
static FlipX * create(bool x);
|
||||||
|
|
||||||
FlipX()
|
|
||||||
:_flipX(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** init the action */
|
|
||||||
bool initWithFlipX(bool x);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -163,7 +174,15 @@ public:
|
||||||
virtual FlipX* clone() const override;
|
virtual FlipX* clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
FlipX() :_flipX(false) {}
|
||||||
|
virtual ~FlipX() {}
|
||||||
|
/** init the action */
|
||||||
|
bool initWithFlipX(bool x);
|
||||||
|
|
||||||
bool _flipX;
|
bool _flipX;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,13 +195,6 @@ public:
|
||||||
/** create the action */
|
/** create the action */
|
||||||
static FlipY * create(bool y);
|
static FlipY * create(bool y);
|
||||||
|
|
||||||
FlipY()
|
|
||||||
:_flipY(false)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** init the action */
|
|
||||||
bool initWithFlipY(bool y);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -191,7 +203,15 @@ public:
|
||||||
virtual FlipY* clone() const override;
|
virtual FlipY* clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
FlipY() :_flipY(false) {}
|
||||||
|
virtual ~FlipY() {}
|
||||||
|
/** init the action */
|
||||||
|
bool initWithFlipY(bool y);
|
||||||
|
|
||||||
bool _flipY;
|
bool _flipY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Places the node in a certain position
|
/** @brief Places the node in a certain position
|
||||||
|
@ -199,12 +219,9 @@ protected:
|
||||||
class CC_DLL Place : public ActionInstant //<NSCopying>
|
class CC_DLL Place : public ActionInstant //<NSCopying>
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
Place(){}
|
|
||||||
|
|
||||||
/** creates a Place action with a position */
|
/** creates a Place action with a position */
|
||||||
static Place * create(const Point& pos);
|
static Place * create(const Point& pos);
|
||||||
/** Initializes a Place action with a position */
|
|
||||||
bool initWithPosition(const Point& pos);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -214,7 +231,15 @@ public:
|
||||||
virtual Place* clone() const override;
|
virtual Place* clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Place(){}
|
||||||
|
virtual ~Place(){}
|
||||||
|
/** Initializes a Place action with a position */
|
||||||
|
bool initWithPosition(const Point& pos);
|
||||||
|
|
||||||
Point _position;
|
Point _position;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Place);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -241,33 +266,6 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE static CallFunc * create(Object* target, SEL_CallFunc selector);
|
CC_DEPRECATED_ATTRIBUTE static CallFunc * create(Object* target, SEL_CallFunc selector);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
CallFunc()
|
|
||||||
: _selectorTarget(NULL)
|
|
||||||
, _callFunc(NULL)
|
|
||||||
, _function(nullptr)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~CallFunc();
|
|
||||||
|
|
||||||
/** initializes the action with the callback
|
|
||||||
typedef void (Object::*SEL_CallFunc)();
|
|
||||||
@deprecated Use the std::function API instead.
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
|
|
||||||
|
|
||||||
/** initializes the action with the std::function<void()>
|
|
||||||
* @js NK
|
|
||||||
* @lua NK
|
|
||||||
*/
|
|
||||||
bool initWithFunction(const std::function<void()>& func);
|
|
||||||
|
|
||||||
/** executes the callback */
|
/** executes the callback */
|
||||||
virtual void execute();
|
virtual void execute();
|
||||||
|
|
||||||
|
@ -293,6 +291,26 @@ public:
|
||||||
virtual CallFunc* clone() const override;
|
virtual CallFunc* clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CallFunc()
|
||||||
|
: _selectorTarget(NULL)
|
||||||
|
, _callFunc(NULL)
|
||||||
|
, _function(nullptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
virtual ~CallFunc();
|
||||||
|
|
||||||
|
/** initializes the action with the callback
|
||||||
|
typedef void (Object::*SEL_CallFunc)();
|
||||||
|
@deprecated Use the std::function API instead.
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target);
|
||||||
|
|
||||||
|
/** initializes the action with the std::function<void()>
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
bool initWithFunction(const std::function<void()>& func);
|
||||||
|
|
||||||
/** Target that will be called */
|
/** Target that will be called */
|
||||||
Object* _selectorTarget;
|
Object* _selectorTarget;
|
||||||
|
|
||||||
|
@ -304,6 +322,9 @@ protected:
|
||||||
|
|
||||||
/** function that will be called */
|
/** function that will be called */
|
||||||
std::function<void()> _function;
|
std::function<void()> _function;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -324,19 +345,6 @@ public:
|
||||||
@deprecated Use the std::function API instead.
|
@deprecated Use the std::function API instead.
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static CallFuncN * create(Object* target, SEL_CallFuncN selector);
|
CC_DEPRECATED_ATTRIBUTE static CallFuncN * create(Object* target, SEL_CallFuncN selector);
|
||||||
public:
|
|
||||||
CallFuncN():_functionN(nullptr){}
|
|
||||||
|
|
||||||
/** initializes the action with the std::function<void(Node*)>
|
|
||||||
*/
|
|
||||||
bool initWithFunction(const std::function<void(Node*)>& func);
|
|
||||||
|
|
||||||
/** initializes the action with the callback
|
|
||||||
|
|
||||||
typedef void (Object::*SEL_CallFuncN)(Node*);
|
|
||||||
@deprecated Use the std::function API instead.
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_CallFuncN selector);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -345,8 +353,24 @@ public:
|
||||||
virtual void execute() override;
|
virtual void execute() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
CallFuncN():_functionN(nullptr){}
|
||||||
|
virtual ~CallFuncN(){}
|
||||||
|
/** initializes the action with the std::function<void(Node*)> */
|
||||||
|
bool initWithFunction(const std::function<void(Node*)>& func);
|
||||||
|
|
||||||
|
/** initializes the action with the callback
|
||||||
|
|
||||||
|
typedef void (Object::*SEL_CallFuncN)(Node*);
|
||||||
|
@deprecated Use the std::function API instead.
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_CallFuncN selector);
|
||||||
|
|
||||||
|
|
||||||
/** function that will be called with the "sender" as the 1st argument */
|
/** function that will be called with the "sender" as the 1st argument */
|
||||||
std::function<void(Node*)> _functionN;
|
std::function<void(Node*)> _functionN;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -361,11 +385,6 @@ public:
|
||||||
/** creates the action with the callback and the data to pass as an argument */
|
/** creates the action with the callback and the data to pass as an argument */
|
||||||
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* target, SEL_CallFuncND selector, void* d);
|
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncND * create(Object* target, SEL_CallFuncND selector, void* d);
|
||||||
|
|
||||||
protected:
|
|
||||||
/** initializes the action with the callback and the data to pass as an argument */
|
|
||||||
bool initWithTarget(Object* target, SEL_CallFuncND selector, void* d);
|
|
||||||
|
|
||||||
public:
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -373,8 +392,17 @@ public:
|
||||||
virtual void execute() override;
|
virtual void execute() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
__CCCallFuncND() {}
|
||||||
|
virtual ~__CCCallFuncND() {}
|
||||||
|
|
||||||
|
/** initializes the action with the callback and the data to pass as an argument */
|
||||||
|
bool initWithTarget(Object* target, SEL_CallFuncND selector, void* d);
|
||||||
|
|
||||||
SEL_CallFuncND _callFuncND;
|
SEL_CallFuncND _callFuncND;
|
||||||
void* _data;
|
void* _data;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncND);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -393,24 +421,6 @@ public:
|
||||||
typedef void (Object::*SEL_CallFuncO)(Object*);
|
typedef void (Object::*SEL_CallFuncO)(Object*);
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncO * create(Object* target, SEL_CallFuncO selector, Object* object);
|
CC_DEPRECATED_ATTRIBUTE static __CCCallFuncO * create(Object* target, SEL_CallFuncO selector, Object* object);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
__CCCallFuncO();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~__CCCallFuncO();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
/** initializes the action with the callback
|
|
||||||
|
|
||||||
typedef void (Object::*SEL_CallFuncO)(Object*);
|
|
||||||
*/
|
|
||||||
bool initWithTarget(Object* target, SEL_CallFuncO selector, Object* object);
|
|
||||||
|
|
||||||
public:
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -421,9 +431,21 @@ public:
|
||||||
void setObject(Object* obj);
|
void setObject(Object* obj);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
__CCCallFuncO();
|
||||||
|
virtual ~__CCCallFuncO();
|
||||||
|
/** initializes the action with the callback
|
||||||
|
|
||||||
|
typedef void (Object::*SEL_CallFuncO)(Object*);
|
||||||
|
*/
|
||||||
|
bool initWithTarget(Object* target, SEL_CallFuncO selector, Object* object);
|
||||||
|
|
||||||
|
|
||||||
/** object to be passed as argument */
|
/** object to be passed as argument */
|
||||||
Object* _object;
|
Object* _object;
|
||||||
SEL_CallFuncO _callFuncO;
|
SEL_CallFuncO _callFuncO;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncO);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -149,13 +149,13 @@ void ActionInterval::startWithTarget(Node *target)
|
||||||
// Sequence
|
// Sequence
|
||||||
//
|
//
|
||||||
|
|
||||||
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo)
|
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction *actionTwo)
|
||||||
{
|
{
|
||||||
Sequence *pSequence = new Sequence();
|
Sequence *sequence = new Sequence();
|
||||||
pSequence->initWithTwoActions(pActionOne, pActionTwo);
|
sequence->initWithTwoActions(actionOne, actionTwo);
|
||||||
pSequence->autorelease();
|
sequence->autorelease();
|
||||||
|
|
||||||
return pSequence;
|
return sequence;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sequence* Sequence::create(FiniteTimeAction *pAction1, ...)
|
Sequence* Sequence::create(FiniteTimeAction *pAction1, ...)
|
||||||
|
@ -597,13 +597,13 @@ Spawn* Spawn::create(Array *arrayOfActions)
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2)
|
||||||
{
|
{
|
||||||
Spawn *pSpawn = new Spawn();
|
Spawn *spawn = new Spawn();
|
||||||
pSpawn->initWithTwoActions(pAction1, pAction2);
|
spawn->initWithTwoActions(action1, action2);
|
||||||
pSpawn->autorelease();
|
spawn->autorelease();
|
||||||
|
|
||||||
return pSpawn;
|
return spawn;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Spawn:: initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
bool Spawn:: initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
||||||
|
|
|
@ -64,9 +64,6 @@ public:
|
||||||
/** how many seconds had elapsed since the actions started to run. */
|
/** how many seconds had elapsed since the actions started to run. */
|
||||||
inline float getElapsed(void) { return _elapsed; }
|
inline float getElapsed(void) { return _elapsed; }
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float d);
|
|
||||||
|
|
||||||
//extension in GridAction
|
//extension in GridAction
|
||||||
void setAmplitudeRate(float amp);
|
void setAmplitudeRate(float amp);
|
||||||
float getAmplitudeRate(void);
|
float getAmplitudeRate(void);
|
||||||
|
@ -80,8 +77,10 @@ public:
|
||||||
virtual ActionInterval* reverse() const override = 0;
|
virtual ActionInterval* reverse() const override = 0;
|
||||||
virtual ActionInterval *clone() const override = 0;
|
virtual ActionInterval *clone() const override = 0;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float d);
|
||||||
|
|
||||||
float _elapsed;
|
float _elapsed;
|
||||||
bool _firstTick;
|
bool _firstTick;
|
||||||
};
|
};
|
||||||
|
@ -105,14 +104,6 @@ public:
|
||||||
static Sequence* createWithVariableList(FiniteTimeAction *pAction1, va_list args);
|
static Sequence* createWithVariableList(FiniteTimeAction *pAction1, va_list args);
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static Sequence* createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
static Sequence* createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Sequence(void);
|
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -124,9 +115,17 @@ public:
|
||||||
virtual void update(float t) override;
|
virtual void update(float t) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Sequence() {}
|
||||||
|
virtual ~Sequence(void);
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||||
|
|
||||||
FiniteTimeAction *_actions[2];
|
FiniteTimeAction *_actions[2];
|
||||||
float _split;
|
float _split;
|
||||||
int _last;
|
int _last;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Repeats an action a number of times.
|
/** @brief Repeats an action a number of times.
|
||||||
|
@ -137,14 +136,6 @@ class CC_DLL Repeat : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
/** creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||||
static Repeat* create(FiniteTimeAction *pAction, unsigned int times);
|
static Repeat* create(FiniteTimeAction *pAction, unsigned int times);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Repeat(void);
|
|
||||||
|
|
||||||
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
|
||||||
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
|
|
||||||
|
|
||||||
inline void setInnerAction(FiniteTimeAction *pAction)
|
inline void setInnerAction(FiniteTimeAction *pAction)
|
||||||
{
|
{
|
||||||
|
@ -172,12 +163,20 @@ public:
|
||||||
virtual bool isDone(void) const override;
|
virtual bool isDone(void) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Repeat() {}
|
||||||
|
virtual ~Repeat();
|
||||||
|
/** initializes a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||||
|
bool initWithAction(FiniteTimeAction *pAction, unsigned int times);
|
||||||
|
|
||||||
unsigned int _times;
|
unsigned int _times;
|
||||||
unsigned int _total;
|
unsigned int _total;
|
||||||
float _nextDt;
|
float _nextDt;
|
||||||
bool _actionInstant;
|
bool _actionInstant;
|
||||||
/** Inner action */
|
/** Inner action */
|
||||||
FiniteTimeAction *_innerAction;
|
FiniteTimeAction *_innerAction;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Repeats an action for ever.
|
/** @brief Repeats an action for ever.
|
||||||
|
@ -189,20 +188,6 @@ class CC_DLL RepeatForever : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static RepeatForever* create(ActionInterval *pAction);
|
static RepeatForever* create(ActionInterval *pAction);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
RepeatForever()
|
|
||||||
: _innerAction(NULL)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~RepeatForever();
|
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithAction(ActionInterval *pAction);
|
|
||||||
|
|
||||||
inline void setInnerAction(ActionInterval *pAction)
|
inline void setInnerAction(ActionInterval *pAction)
|
||||||
{
|
{
|
||||||
|
@ -229,8 +214,18 @@ public:
|
||||||
virtual bool isDone(void) const override;
|
virtual bool isDone(void) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RepeatForever()
|
||||||
|
: _innerAction(nullptr)
|
||||||
|
{}
|
||||||
|
virtual ~RepeatForever();
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithAction(ActionInterval *pAction);
|
||||||
|
|
||||||
/** Inner action */
|
/** Inner action */
|
||||||
ActionInterval *_innerAction;
|
ActionInterval *_innerAction;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Spawn a new action immediately
|
/** @brief Spawn a new action immediately
|
||||||
|
@ -255,14 +250,6 @@ public:
|
||||||
|
|
||||||
/** creates the Spawn action */
|
/** creates the Spawn action */
|
||||||
static Spawn* createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
static Spawn* createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Spawn(void);
|
|
||||||
|
|
||||||
/** initializes the Spawn action with the 2 actions to spawn */
|
|
||||||
bool initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -274,8 +261,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Spawn() {}
|
||||||
|
virtual ~Spawn();
|
||||||
|
/** initializes the Spawn action with the 2 actions to spawn */
|
||||||
|
bool initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||||
|
|
||||||
FiniteTimeAction *_one;
|
FiniteTimeAction *_one;
|
||||||
FiniteTimeAction *_two;
|
FiniteTimeAction *_two;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Rotates a Node object to a certain angle by modifying it's
|
/** @brief Rotates a Node object to a certain angle by modifying it's
|
||||||
|
@ -290,10 +285,6 @@ public:
|
||||||
|
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static RotateTo* create(float fDuration, float fDeltaAngle);
|
static RotateTo* create(float fDuration, float fDeltaAngle);
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
|
||||||
|
|
||||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -304,6 +295,12 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RotateTo() {}
|
||||||
|
virtual ~RotateTo() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||||
|
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||||
|
|
||||||
float _dstAngleX;
|
float _dstAngleX;
|
||||||
float _startAngleX;
|
float _startAngleX;
|
||||||
float _diffAngleX;
|
float _diffAngleX;
|
||||||
|
@ -311,6 +308,9 @@ protected:
|
||||||
float _dstAngleY;
|
float _dstAngleY;
|
||||||
float _startAngleY;
|
float _startAngleY;
|
||||||
float _diffAngleY;
|
float _diffAngleY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
/** @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
||||||
|
@ -320,12 +320,7 @@ class CC_DLL RotateBy : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static RotateBy* create(float fDuration, float fDeltaAngle);
|
static RotateBy* create(float fDuration, float fDeltaAngle);
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
|
||||||
|
|
||||||
static RotateBy* create(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
static RotateBy* create(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Override
|
// Override
|
||||||
|
@ -336,10 +331,19 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
RotateBy() {}
|
||||||
|
virtual ~RotateBy() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||||
|
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||||
|
|
||||||
float _angleX;
|
float _angleX;
|
||||||
float _startAngleX;
|
float _startAngleX;
|
||||||
float _angleY;
|
float _angleY;
|
||||||
float _startAngleY;
|
float _startAngleY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Moves a Node object x,y pixels by modifying it's position attribute.
|
/** Moves a Node object x,y pixels by modifying it's position attribute.
|
||||||
|
@ -354,9 +358,6 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static MoveBy* create(float duration, const Point& deltaPosition);
|
static MoveBy* create(float duration, const Point& deltaPosition);
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float duration, const Point& deltaPosition);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -366,9 +367,17 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
MoveBy() {}
|
||||||
|
virtual ~MoveBy() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float duration, const Point& deltaPosition);
|
||||||
|
|
||||||
Point _positionDelta;
|
Point _positionDelta;
|
||||||
Point _startPosition;
|
Point _startPosition;
|
||||||
Point _previousPosition;
|
Point _previousPosition;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Moves a Node object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
|
/** Moves a Node object to the position x,y. x and y are absolute coordinates by modifying it's position attribute.
|
||||||
|
@ -382,9 +391,6 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static MoveTo* create(float duration, const Point& position);
|
static MoveTo* create(float duration, const Point& position);
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float duration, const Point& position);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -392,7 +398,15 @@ public:
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
MoveTo() {}
|
||||||
|
virtual ~MoveTo() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float duration, const Point& position);
|
||||||
|
|
||||||
Point _endPosition;
|
Point _endPosition;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
/** Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
||||||
|
@ -404,9 +418,6 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static SkewTo* create(float t, float sx, float sy);
|
static SkewTo* create(float t, float sx, float sy);
|
||||||
|
|
||||||
SkewTo();
|
|
||||||
bool initWithDuration(float t, float sx, float sy);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -416,6 +427,10 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
SkewTo();
|
||||||
|
virtual ~SkewTo() {}
|
||||||
|
bool initWithDuration(float t, float sx, float sy);
|
||||||
|
|
||||||
float _skewX;
|
float _skewX;
|
||||||
float _skewY;
|
float _skewY;
|
||||||
float _startSkewX;
|
float _startSkewX;
|
||||||
|
@ -424,6 +439,9 @@ protected:
|
||||||
float _endSkewY;
|
float _endSkewY;
|
||||||
float _deltaX;
|
float _deltaX;
|
||||||
float _deltaY;
|
float _deltaY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Skews a Node object by skewX and skewY degrees
|
/** Skews a Node object by skewX and skewY degrees
|
||||||
|
@ -435,14 +453,20 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
||||||
|
|
||||||
bool initWithDuration(float t, float sx, float sy);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual SkewBy* clone() const override;
|
virtual SkewBy* clone() const override;
|
||||||
virtual SkewBy* reverse(void) const override;
|
virtual SkewBy* reverse(void) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SkewBy() {}
|
||||||
|
virtual ~SkewBy() {}
|
||||||
|
bool initWithDuration(float t, float sx, float sy);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
/** @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
||||||
|
@ -453,9 +477,6 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static JumpBy* create(float duration, const Point& position, float height, int jumps);
|
static JumpBy* create(float duration, const Point& position, float height, int jumps);
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float duration, const Point& position, float height, int jumps);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -465,11 +486,19 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
JumpBy() {}
|
||||||
|
virtual ~JumpBy() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float duration, const Point& position, float height, int jumps);
|
||||||
|
|
||||||
Point _startPosition;
|
Point _startPosition;
|
||||||
Point _delta;
|
Point _delta;
|
||||||
float _height;
|
float _height;
|
||||||
int _jumps;
|
int _jumps;
|
||||||
Point _previousPos;
|
Point _previousPos;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
/** @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
||||||
|
@ -486,6 +515,11 @@ public:
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual JumpTo* clone() const override;
|
virtual JumpTo* clone() const override;
|
||||||
virtual JumpTo* reverse(void) const override;
|
virtual JumpTo* reverse(void) const override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
JumpTo() {}
|
||||||
|
virtual ~JumpTo() {}
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Bezier configuration structure
|
/** Bezier configuration structure
|
||||||
|
@ -513,9 +547,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static BezierBy* create(float t, const ccBezierConfig& c);
|
static BezierBy* create(float t, const ccBezierConfig& c);
|
||||||
|
|
||||||
/** initializes the action with a duration and a bezier configuration */
|
|
||||||
bool initWithDuration(float t, const ccBezierConfig& c);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -525,9 +556,17 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
BezierBy() {}
|
||||||
|
virtual ~BezierBy() {}
|
||||||
|
/** initializes the action with a duration and a bezier configuration */
|
||||||
|
bool initWithDuration(float t, const ccBezierConfig& c);
|
||||||
|
|
||||||
ccBezierConfig _config;
|
ccBezierConfig _config;
|
||||||
Point _startPosition;
|
Point _startPosition;
|
||||||
Point _previousPosition;
|
Point _previousPosition;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
/** @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
||||||
|
@ -544,7 +583,6 @@ public:
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
static BezierTo* create(float t, const ccBezierConfig& c);
|
static BezierTo* create(float t, const ccBezierConfig& c);
|
||||||
bool initWithDuration(float t, const ccBezierConfig &c);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -554,7 +592,14 @@ public:
|
||||||
virtual BezierTo* reverse(void) const override;
|
virtual BezierTo* reverse(void) const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
BezierTo() {}
|
||||||
|
virtual ~BezierTo() {}
|
||||||
|
bool initWithDuration(float t, const ccBezierConfig &c);
|
||||||
|
|
||||||
ccBezierConfig _toConfig;
|
ccBezierConfig _toConfig;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
/** @brief Scales a Node object to a zoom factor by modifying it's scale attribute.
|
||||||
|
@ -569,12 +614,6 @@ public:
|
||||||
/** creates the action with and X factor and a Y factor */
|
/** creates the action with and X factor and a Y factor */
|
||||||
static ScaleTo* create(float duration, float sx, float sy);
|
static ScaleTo* create(float duration, float sx, float sy);
|
||||||
|
|
||||||
/** initializes the action with the same scale factor for X and Y */
|
|
||||||
bool initWithDuration(float duration, float s);
|
|
||||||
|
|
||||||
/** initializes the action with and X factor and a Y factor */
|
|
||||||
bool initWithDuration(float duration, float sx, float sy);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -584,6 +623,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ScaleTo() {}
|
||||||
|
virtual ~ScaleTo() {}
|
||||||
|
/** initializes the action with the same scale factor for X and Y */
|
||||||
|
bool initWithDuration(float duration, float s);
|
||||||
|
/** initializes the action with and X factor and a Y factor */
|
||||||
|
bool initWithDuration(float duration, float sx, float sy);
|
||||||
|
|
||||||
float _scaleX;
|
float _scaleX;
|
||||||
float _scaleY;
|
float _scaleY;
|
||||||
float _startScaleX;
|
float _startScaleX;
|
||||||
|
@ -592,6 +638,9 @@ protected:
|
||||||
float _endScaleY;
|
float _endScaleY;
|
||||||
float _deltaX;
|
float _deltaX;
|
||||||
float _deltaY;
|
float _deltaY;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
/** @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
||||||
|
@ -611,6 +660,13 @@ public:
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
virtual ScaleBy* clone() const override;
|
virtual ScaleBy* clone() const override;
|
||||||
virtual ScaleBy* reverse(void) const override;
|
virtual ScaleBy* reverse(void) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
ScaleBy() {}
|
||||||
|
virtual ~ScaleBy() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Blinks a Node object by modifying it's visible attribute
|
/** @brief Blinks a Node object by modifying it's visible attribute
|
||||||
|
@ -621,9 +677,6 @@ public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static Blink* create(float duration, int blinks);
|
static Blink* create(float duration, int blinks);
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithDuration(float duration, int blinks);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -634,8 +687,16 @@ public:
|
||||||
virtual void stop() override;
|
virtual void stop() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Blink() {}
|
||||||
|
virtual ~Blink() {}
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithDuration(float duration, int blinks);
|
||||||
|
|
||||||
int _times;
|
int _times;
|
||||||
bool _originalState;
|
bool _originalState;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Blink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
/** @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
||||||
|
@ -653,6 +714,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual FadeIn* clone() const override;
|
virtual FadeIn* clone() const override;
|
||||||
virtual ActionInterval* reverse(void) const override;
|
virtual ActionInterval* reverse(void) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeIn() {}
|
||||||
|
virtual ~FadeIn() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
/** @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
||||||
|
@ -670,6 +738,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual FadeOut* clone() const override;
|
virtual FadeOut* clone() const override;
|
||||||
virtual ActionInterval* reverse(void) const override;
|
virtual ActionInterval* reverse(void) const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeOut() {}
|
||||||
|
virtual ~FadeOut() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Fades an object that implements the RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
|
/** @brief Fades an object that implements the RGBAProtocol protocol. It modifies the opacity from the current value to a custom one.
|
||||||
|
@ -681,9 +756,6 @@ public:
|
||||||
/** creates an action with duration and opacity */
|
/** creates an action with duration and opacity */
|
||||||
static FadeTo* create(float duration, GLubyte opacity);
|
static FadeTo* create(float duration, GLubyte opacity);
|
||||||
|
|
||||||
/** initializes the action with duration and opacity */
|
|
||||||
bool initWithDuration(float duration, GLubyte opacity);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -693,8 +765,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
FadeTo() {}
|
||||||
|
virtual ~FadeTo() {}
|
||||||
|
/** initializes the action with duration and opacity */
|
||||||
|
bool initWithDuration(float duration, GLubyte opacity);
|
||||||
|
|
||||||
GLubyte _toOpacity;
|
GLubyte _toOpacity;
|
||||||
GLubyte _fromOpacity;
|
GLubyte _fromOpacity;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
||||||
|
@ -707,9 +787,6 @@ public:
|
||||||
/** creates an action with duration and color */
|
/** creates an action with duration and color */
|
||||||
static TintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
static TintTo* create(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||||
|
|
||||||
/** initializes the action with duration and color */
|
|
||||||
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -719,8 +796,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TintTo() {}
|
||||||
|
virtual ~TintTo() {}
|
||||||
|
/** initializes the action with duration and color */
|
||||||
|
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||||
|
|
||||||
Color3B _to;
|
Color3B _to;
|
||||||
Color3B _from;
|
Color3B _from;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
/** @brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
||||||
|
@ -732,9 +817,6 @@ public:
|
||||||
/** creates an action with duration and color */
|
/** creates an action with duration and color */
|
||||||
static TintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
static TintBy* create(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||||
|
|
||||||
/** initializes the action with duration and color */
|
|
||||||
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -744,6 +826,11 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TintBy() {}
|
||||||
|
virtual ~TintBy() {}
|
||||||
|
/** initializes the action with duration and color */
|
||||||
|
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||||
|
|
||||||
GLshort _deltaR;
|
GLshort _deltaR;
|
||||||
GLshort _deltaG;
|
GLshort _deltaG;
|
||||||
GLshort _deltaB;
|
GLshort _deltaB;
|
||||||
|
@ -751,6 +838,9 @@ protected:
|
||||||
GLshort _fromR;
|
GLshort _fromR;
|
||||||
GLshort _fromG;
|
GLshort _fromG;
|
||||||
GLshort _fromB;
|
GLshort _fromB;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Delays the action a certain amount of seconds
|
/** @brief Delays the action a certain amount of seconds
|
||||||
|
@ -767,6 +857,13 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual DelayTime* reverse() const override;
|
virtual DelayTime* reverse() const override;
|
||||||
virtual DelayTime* clone() const override;
|
virtual DelayTime* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
DelayTime() {}
|
||||||
|
virtual ~DelayTime() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief Executes an action in reverse order, from time=duration to time=0
|
/** @brief Executes an action in reverse order, from time=duration to time=0
|
||||||
|
@ -781,18 +878,6 @@ class CC_DLL ReverseTime : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action */
|
/** creates the action */
|
||||||
static ReverseTime* create(FiniteTimeAction *pAction);
|
static ReverseTime* create(FiniteTimeAction *pAction);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ReverseTime(void);
|
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
ReverseTime();
|
|
||||||
|
|
||||||
/** initializes the action */
|
|
||||||
bool initWithAction(FiniteTimeAction *pAction);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -804,7 +889,15 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ReverseTime();
|
||||||
|
virtual ~ReverseTime(void);
|
||||||
|
/** initializes the action */
|
||||||
|
bool initWithAction(FiniteTimeAction *pAction);
|
||||||
|
|
||||||
FiniteTimeAction *_other;
|
FiniteTimeAction *_other;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
|
@ -814,18 +907,6 @@ class CC_DLL Animate : public ActionInterval
|
||||||
public:
|
public:
|
||||||
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
||||||
static Animate* create(Animation *pAnimation);
|
static Animate* create(Animation *pAnimation);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Animate();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Animate();
|
|
||||||
|
|
||||||
/** initializes the action with an Animation and will restore the original frame when the animation is over */
|
|
||||||
bool initWithAnimation(Animation *pAnimation);
|
|
||||||
|
|
||||||
/** sets the Animation object to be animated */
|
/** sets the Animation object to be animated */
|
||||||
void setAnimation( Animation* animation );
|
void setAnimation( Animation* animation );
|
||||||
|
@ -843,11 +924,19 @@ public:
|
||||||
virtual void update(float t) override;
|
virtual void update(float t) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Animate();
|
||||||
|
virtual ~Animate();
|
||||||
|
/** initializes the action with an Animation and will restore the original frame when the animation is over */
|
||||||
|
bool initWithAnimation(Animation *pAnimation);
|
||||||
|
|
||||||
std::vector<float>* _splitTimes;
|
std::vector<float>* _splitTimes;
|
||||||
int _nextFrame;
|
int _nextFrame;
|
||||||
SpriteFrame* _origFrame;
|
SpriteFrame* _origFrame;
|
||||||
unsigned int _executedLoops;
|
unsigned int _executedLoops;
|
||||||
Animation* _animation;
|
Animation* _animation;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Overrides the target of an action so that it always runs on the target
|
/** Overrides the target of an action so that it always runs on the target
|
||||||
|
@ -856,22 +945,9 @@ protected:
|
||||||
class CC_DLL TargetedAction : public ActionInterval
|
class CC_DLL TargetedAction : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TargetedAction();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TargetedAction();
|
|
||||||
|
|
||||||
/** Create an action with the specified action and forced target */
|
/** Create an action with the specified action and forced target */
|
||||||
static TargetedAction* create(Node* target, FiniteTimeAction* pAction);
|
static TargetedAction* create(Node* target, FiniteTimeAction* pAction);
|
||||||
|
|
||||||
/** Init an action with the specified action and forced target */
|
|
||||||
bool initWithTarget(Node* target, FiniteTimeAction* pAction);
|
|
||||||
|
|
||||||
/** Sets the target that the action will be forced to run with */
|
/** Sets the target that the action will be forced to run with */
|
||||||
void setForcedTarget(Node* forcedTarget);
|
void setForcedTarget(Node* forcedTarget);
|
||||||
/** returns the target that the action is forced to run with */
|
/** returns the target that the action is forced to run with */
|
||||||
|
@ -887,9 +963,17 @@ public:
|
||||||
virtual void stop(void) override;
|
virtual void stop(void) override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
TargetedAction();
|
||||||
|
virtual ~TargetedAction();
|
||||||
|
/** Init an action with the specified action and forced target */
|
||||||
|
bool initWithTarget(Node* target, FiniteTimeAction* pAction);
|
||||||
|
|
||||||
FiniteTimeAction* _action;
|
FiniteTimeAction* _action;
|
||||||
Node* _forcedTarget;
|
Node* _forcedTarget;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -44,9 +44,6 @@ public:
|
||||||
/** Creates and initializes with a duration and a percent */
|
/** Creates and initializes with a duration and a percent */
|
||||||
static ProgressTo* create(float duration, float fPercent);
|
static ProgressTo* create(float duration, float fPercent);
|
||||||
|
|
||||||
/** Initializes with a duration and a percent */
|
|
||||||
bool initWithDuration(float duration, float fPercent);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -56,8 +53,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ProgressTo() {}
|
||||||
|
virtual ~ProgressTo() {}
|
||||||
|
/** Initializes with a duration and a percent */
|
||||||
|
bool initWithDuration(float duration, float fPercent);
|
||||||
|
|
||||||
float _to;
|
float _to;
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -70,9 +75,6 @@ public:
|
||||||
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
|
/** Creates and initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||||
static ProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
|
static ProgressFromTo* create(float duration, float fFromPercentage, float fToPercentage);
|
||||||
|
|
||||||
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
|
|
||||||
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
@ -82,8 +84,16 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ProgressFromTo() {}
|
||||||
|
virtual ~ProgressFromTo() {}
|
||||||
|
/** Initializes the action with a duration, a "from" percentage and a "to" percentage */
|
||||||
|
bool initWithDuration(float duration, float fFromPercentage, float fToPercentage);
|
||||||
|
|
||||||
float _to;
|
float _to;
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -41,16 +41,21 @@ public:
|
||||||
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
/** creates the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||||
static ShakyTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
static ShakyTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||||
|
|
||||||
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
|
||||||
|
|
||||||
// Override
|
// Override
|
||||||
virtual ShakyTiles3D* clone() const override;
|
virtual ShakyTiles3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ShakyTiles3D() {}
|
||||||
|
virtual ~ShakyTiles3D() {}
|
||||||
|
/** initializes the action with a range, whether or not to shake Z vertices, a grid size, and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShakeZ);
|
||||||
|
|
||||||
int _randrange;
|
int _randrange;
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief ShatteredTiles3D action */
|
/** @brief ShatteredTiles3D action */
|
||||||
|
@ -60,17 +65,22 @@ public:
|
||||||
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
/** creates the action with a range, whether of not to shatter Z vertices, a grid size and duration */
|
||||||
static ShatteredTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
static ShatteredTiles3D* create(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||||
|
|
||||||
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
|
||||||
|
|
||||||
// Override
|
// Override
|
||||||
virtual ShatteredTiles3D* clone() const override;
|
virtual ShatteredTiles3D* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ShatteredTiles3D() {}
|
||||||
|
virtual ~ShatteredTiles3D() {}
|
||||||
|
/** initializes the action with a range, whether or not to shatter Z vertices, a grid size and duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, int nRange, bool bShatterZ);
|
||||||
|
|
||||||
int _randrange;
|
int _randrange;
|
||||||
bool _once;
|
bool _once;
|
||||||
bool _shatterZ;
|
bool _shatterZ;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tile;
|
struct Tile;
|
||||||
|
@ -82,13 +92,6 @@ class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
||||||
public:
|
public:
|
||||||
/** creates the action with a random seed, the grid size and the duration */
|
/** creates the action with a random seed, the grid size and the duration */
|
||||||
static ShuffleTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
static ShuffleTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ShuffleTiles(void);
|
|
||||||
/** initializes the action with a random seed, the grid size and the duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
|
||||||
|
|
||||||
void shuffle(unsigned int *array, unsigned int nLen);
|
void shuffle(unsigned int *array, unsigned int nLen);
|
||||||
Size getDelta(const Size& pos) const;
|
Size getDelta(const Size& pos) const;
|
||||||
|
@ -100,10 +103,18 @@ public:
|
||||||
virtual ShuffleTiles* clone() const override;
|
virtual ShuffleTiles* clone() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
ShuffleTiles() {}
|
||||||
|
virtual ~ShuffleTiles();
|
||||||
|
/** initializes the action with a random seed, the grid size and the duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||||
|
|
||||||
unsigned int _seed;
|
unsigned int _seed;
|
||||||
unsigned int _tilesCount;
|
unsigned int _tilesCount;
|
||||||
unsigned int* _tilesOrder;
|
unsigned int* _tilesOrder;
|
||||||
Tile* _tiles;
|
Tile* _tiles;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FadeOutTRTiles action
|
/** @brief FadeOutTRTiles action
|
||||||
|
@ -123,6 +134,13 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual FadeOutTRTiles* clone() const override;
|
virtual FadeOutTRTiles* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeOutTRTiles() {}
|
||||||
|
virtual ~FadeOutTRTiles() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FadeOutBLTiles action.
|
/** @brief FadeOutBLTiles action.
|
||||||
|
@ -137,6 +155,13 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual float testFunc(const Size& pos, float time) override;
|
virtual float testFunc(const Size& pos, float time) override;
|
||||||
virtual FadeOutBLTiles* clone() const override;
|
virtual FadeOutBLTiles* clone() const override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeOutBLTiles() {}
|
||||||
|
virtual ~FadeOutBLTiles() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FadeOutUpTiles action.
|
/** @brief FadeOutUpTiles action.
|
||||||
|
@ -153,6 +178,13 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual FadeOutUpTiles* clone() const override;
|
virtual FadeOutUpTiles* clone() const override;
|
||||||
virtual float testFunc(const Size& pos, float time) override;
|
virtual float testFunc(const Size& pos, float time) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeOutUpTiles() {}
|
||||||
|
virtual ~FadeOutUpTiles() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief FadeOutDownTiles action.
|
/** @brief FadeOutDownTiles action.
|
||||||
|
@ -167,6 +199,13 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual FadeOutDownTiles* clone() const override;
|
virtual FadeOutDownTiles* clone() const override;
|
||||||
virtual float testFunc(const Size& pos, float time) override;
|
virtual float testFunc(const Size& pos, float time) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
FadeOutDownTiles() {}
|
||||||
|
virtual ~FadeOutDownTiles() {}
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TurnOffTiles action.
|
/** @brief TurnOffTiles action.
|
||||||
|
@ -179,13 +218,6 @@ public:
|
||||||
static TurnOffTiles* create(float duration, const Size& gridSize);
|
static TurnOffTiles* create(float duration, const Size& gridSize);
|
||||||
/** creates the action with a random seed, the grid size and the duration */
|
/** creates the action with a random seed, the grid size and the duration */
|
||||||
static TurnOffTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
static TurnOffTiles* create(float duration, const Size& gridSize, unsigned int seed);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
~TurnOffTiles(void);
|
|
||||||
/** initializes the action with a random seed, the grid size and the duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
|
||||||
|
|
||||||
void shuffle(unsigned int *pArray, unsigned int nLen);
|
void shuffle(unsigned int *pArray, unsigned int nLen);
|
||||||
void turnOnTile(const Point& pos);
|
void turnOnTile(const Point& pos);
|
||||||
|
@ -197,9 +229,17 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TurnOffTiles() {}
|
||||||
|
virtual ~TurnOffTiles();
|
||||||
|
/** initializes the action with a random seed, the grid size and the duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int seed);
|
||||||
|
|
||||||
unsigned int _seed;
|
unsigned int _seed;
|
||||||
unsigned int _tilesCount;
|
unsigned int _tilesCount;
|
||||||
unsigned int* _tilesOrder;
|
unsigned int* _tilesOrder;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief WavesTiles3D action. */
|
/** @brief WavesTiles3D action. */
|
||||||
|
@ -209,9 +249,6 @@ public:
|
||||||
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
/** creates the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||||
static WavesTiles3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
static WavesTiles3D* create(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
|
||||||
|
|
||||||
/** waves amplitude */
|
/** waves amplitude */
|
||||||
inline float getAmplitude(void) const { return _amplitude; }
|
inline float getAmplitude(void) const { return _amplitude; }
|
||||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||||
|
@ -225,9 +262,17 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
WavesTiles3D() {}
|
||||||
|
virtual ~WavesTiles3D() {}
|
||||||
|
/** initializes the action with a number of waves, the waves amplitude, the grid size and the duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int waves, float amplitude);
|
||||||
|
|
||||||
unsigned int _waves;
|
unsigned int _waves;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief JumpTiles3D action.
|
/** @brief JumpTiles3D action.
|
||||||
|
@ -239,9 +284,6 @@ public:
|
||||||
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
/** creates the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||||
static JumpTiles3D* create(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
static JumpTiles3D* create(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||||
|
|
||||||
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
|
||||||
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
|
||||||
|
|
||||||
/** amplitude of the sin*/
|
/** amplitude of the sin*/
|
||||||
inline float getAmplitude(void) const { return _amplitude; }
|
inline float getAmplitude(void) const { return _amplitude; }
|
||||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||||
|
@ -255,9 +297,17 @@ public:
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
JumpTiles3D() {}
|
||||||
|
virtual ~JumpTiles3D() {}
|
||||||
|
/** initializes the action with the number of jumps, the sin amplitude, the grid size and the duration */
|
||||||
|
bool initWithDuration(float duration, const Size& gridSize, unsigned int numberOfJumps, float amplitude);
|
||||||
|
|
||||||
unsigned int _jumps;
|
unsigned int _jumps;
|
||||||
float _amplitude;
|
float _amplitude;
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief SplitRows action */
|
/** @brief SplitRows action */
|
||||||
|
@ -267,17 +317,22 @@ public :
|
||||||
/** creates the action with the number of rows to split and the duration */
|
/** creates the action with the number of rows to split and the duration */
|
||||||
static SplitRows* create(float duration, unsigned int nRows);
|
static SplitRows* create(float duration, unsigned int nRows);
|
||||||
|
|
||||||
/** initializes the action with the number of rows to split and the duration */
|
|
||||||
bool initWithDuration(float duration, unsigned int nRows);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual SplitRows* clone() const override;
|
virtual SplitRows* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
SplitRows() {}
|
||||||
|
virtual ~SplitRows() {}
|
||||||
|
/** initializes the action with the number of rows to split and the duration */
|
||||||
|
bool initWithDuration(float duration, unsigned int nRows);
|
||||||
|
|
||||||
unsigned int _rows;
|
unsigned int _rows;
|
||||||
Size _winSize;
|
Size _winSize;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief SplitCols action */
|
/** @brief SplitCols action */
|
||||||
|
@ -287,17 +342,22 @@ public:
|
||||||
/** creates the action with the number of columns to split and the duration */
|
/** creates the action with the number of columns to split and the duration */
|
||||||
static SplitCols* create(float duration, unsigned int nCols);
|
static SplitCols* create(float duration, unsigned int nCols);
|
||||||
|
|
||||||
/** initializes the action with the number of columns to split and the duration */
|
|
||||||
bool initWithDuration(float duration, unsigned int nCols);
|
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual SplitCols* clone() const override;
|
virtual SplitCols* clone() const override;
|
||||||
virtual void update(float time) override;
|
virtual void update(float time) override;
|
||||||
virtual void startWithTarget(Node *target) override;
|
virtual void startWithTarget(Node *target) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
SplitCols() {}
|
||||||
|
virtual ~SplitCols() {}
|
||||||
|
/** initializes the action with the number of columns to split and the duration */
|
||||||
|
bool initWithDuration(float duration, unsigned int nCols);
|
||||||
|
|
||||||
unsigned int _cols;
|
unsigned int _cols;
|
||||||
Size _winSize;
|
Size _winSize;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
ActionTween* ActionTween::create(float aDuration, const char* key, float from, float to)
|
ActionTween* ActionTween::create(float aDuration, const std::string& key, float from, float to)
|
||||||
{
|
{
|
||||||
ActionTween* pRet = new ActionTween();
|
ActionTween* pRet = new ActionTween();
|
||||||
if (pRet && pRet->initWithDuration(aDuration, key, from, to))
|
if (pRet && pRet->initWithDuration(aDuration, key, from, to))
|
||||||
|
@ -41,7 +41,7 @@ ActionTween* ActionTween::create(float aDuration, const char* key, float from, f
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ActionTween::initWithDuration(float aDuration, const char* key, float from, float to)
|
bool ActionTween::initWithDuration(float aDuration, const std::string& key, float from, float to)
|
||||||
{
|
{
|
||||||
if (ActionInterval::initWithDuration(aDuration))
|
if (ActionInterval::initWithDuration(aDuration))
|
||||||
{
|
{
|
||||||
|
|
|
@ -42,7 +42,7 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual ~ActionTweenDelegate() {}
|
virtual ~ActionTweenDelegate() {}
|
||||||
virtual void updateTweenAction(float value, const char* key) = 0;
|
virtual void updateTweenAction(float value, const std::string& key) = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
/** ActionTween
|
/** ActionTween
|
||||||
|
@ -69,9 +69,9 @@ class CC_DLL ActionTween : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates an initializes the action with the property name (key), and the from and to parameters. */
|
/** creates an initializes the action with the property name (key), and the from and to parameters. */
|
||||||
static ActionTween* create(float duration, const char* key, float from, float to);
|
static ActionTween* create(float duration, const std::string& key, float from, float to);
|
||||||
/** initializes the action with the property name (key), and the from and to parameters. */
|
/** initializes the action with the property name (key), and the from and to parameters. */
|
||||||
bool initWithDuration(float duration, const char* key, float from, float to);
|
bool initWithDuration(float duration, const std::string& key, float from, float to);
|
||||||
|
|
||||||
// Overrides
|
// Overrides
|
||||||
void startWithTarget(Node *target) override;
|
void startWithTarget(Node *target) override;
|
||||||
|
|
|
@ -175,7 +175,7 @@ void Animation::addSpriteFrame(SpriteFrame *pFrame)
|
||||||
_totalDelayUnits++;
|
_totalDelayUnits++;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::addSpriteFrameWithFile(const char *filename)
|
void Animation::addSpriteFrameWithFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||||
Rect rect = Rect::ZERO;
|
Rect rect = Rect::ZERO;
|
||||||
|
|
|
@ -173,11 +173,11 @@ public:
|
||||||
The frame will be added with one "delay unit".
|
The frame will be added with one "delay unit".
|
||||||
Added to facilitate the migration from v0.8 to v0.9.
|
Added to facilitate the migration from v0.8 to v0.9.
|
||||||
*/
|
*/
|
||||||
void addSpriteFrameWithFile(const char *filename);
|
void addSpriteFrameWithFile(const std::string& filename);
|
||||||
/**
|
/**
|
||||||
@deprecated. Use addSpriteFrameWithFile() instead
|
@deprecated. Use addSpriteFrameWithFile() instead
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE void addSpriteFrameWithFileName(const char *filename){ addSpriteFrameWithFile(filename);}
|
CC_DEPRECATED_ATTRIBUTE void addSpriteFrameWithFileName(const std::string& filename){ addSpriteFrameWithFile(filename);}
|
||||||
|
|
||||||
/** Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.
|
/** Adds a frame with a texture and a rect. Internally it will create a SpriteFrame and it will add it.
|
||||||
The frame will be added with one "delay unit".
|
The frame will be added with one "delay unit".
|
||||||
|
|
|
@ -53,22 +53,7 @@ class CC_DLL AtlasNode : public NodeRGBA, public TextureProtocol
|
||||||
public:
|
public:
|
||||||
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||||
static AtlasNode * create(const std::string& filename, long tileWidth, long tileHeight, long itemsToRender);
|
static AtlasNode * create(const std::string& filename, long tileWidth, long tileHeight, long itemsToRender);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
AtlasNode();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~AtlasNode();
|
|
||||||
|
|
||||||
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
|
||||||
bool initWithTileFile(const std::string& tile, long tileWidth, long tileHeight, long itemsToRender);
|
|
||||||
|
|
||||||
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
|
||||||
bool initWithTexture(Texture2D* texture, long tileWidth, long tileHeight, long itemsToRender);
|
|
||||||
|
|
||||||
/** updates the Atlas (indexed vertex array).
|
/** updates the Atlas (indexed vertex array).
|
||||||
* Shall be overridden in subclasses
|
* Shall be overridden in subclasses
|
||||||
*/
|
*/
|
||||||
|
@ -104,15 +89,24 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual const BlendFunc& getBlendFunc() const override;
|
virtual const BlendFunc& getBlendFunc() const override;
|
||||||
|
|
||||||
private :
|
|
||||||
|
protected:
|
||||||
|
AtlasNode();
|
||||||
|
virtual ~AtlasNode();
|
||||||
|
|
||||||
|
/** initializes an AtlasNode with an Atlas file the width and height of each item and the quantity of items to render*/
|
||||||
|
bool initWithTileFile(const std::string& tile, long tileWidth, long tileHeight, long itemsToRender);
|
||||||
|
|
||||||
|
/** initializes an AtlasNode with a texture the width and height of each item measured in points and the quantity of items to render*/
|
||||||
|
bool initWithTexture(Texture2D* texture, long tileWidth, long tileHeight, long itemsToRender);
|
||||||
|
|
||||||
void calculateMaxItems();
|
void calculateMaxItems();
|
||||||
void updateBlendFunc();
|
void updateBlendFunc();
|
||||||
void updateOpacityModifyRGB();
|
void updateOpacityModifyRGB();
|
||||||
|
|
||||||
friend class Director;
|
friend class Director;
|
||||||
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
||||||
|
|
||||||
protected:
|
|
||||||
//! chars per row
|
//! chars per row
|
||||||
long _itemsPerRow;
|
long _itemsPerRow;
|
||||||
//! chars per column
|
//! chars per column
|
||||||
|
@ -136,6 +130,10 @@ protected:
|
||||||
GLint _uniformColor;
|
GLint _uniformColor;
|
||||||
// This varible is only used for LabelAtlas FPS display. So plz don't modify its value.
|
// This varible is only used for LabelAtlas FPS display. So plz don't modify its value.
|
||||||
bool _ignoreContentScaleFactor;
|
bool _ignoreContentScaleFactor;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of base_node group
|
// end of base_node group
|
||||||
|
|
|
@ -49,21 +49,7 @@ public:
|
||||||
The stencil node will be retained.
|
The stencil node will be retained.
|
||||||
*/
|
*/
|
||||||
static ClippingNode* create(Node *pStencil);
|
static ClippingNode* create(Node *pStencil);
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ClippingNode();
|
|
||||||
|
|
||||||
/** Initializes a clipping node without a stencil.
|
|
||||||
*/
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
/** Initializes a clipping node with an other node as its stencil.
|
|
||||||
The stencil node will be retained, and its parent will be set to this clipping node.
|
|
||||||
*/
|
|
||||||
virtual bool init(Node *pStencil);
|
|
||||||
|
|
||||||
/** The Node to use as a stencil to do the clipping.
|
/** The Node to use as a stencil to do the clipping.
|
||||||
The stencil node will be retained.
|
The stencil node will be retained.
|
||||||
This default to nil.
|
This default to nil.
|
||||||
|
@ -109,18 +95,34 @@ public:
|
||||||
virtual void onExit() override;
|
virtual void onExit() override;
|
||||||
virtual void visit() override;
|
virtual void visit() override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
ClippingNode();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~ClippingNode();
|
||||||
|
|
||||||
|
/** Initializes a clipping node without a stencil.
|
||||||
|
*/
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
|
/** Initializes a clipping node with an other node as its stencil.
|
||||||
|
The stencil node will be retained, and its parent will be set to this clipping node.
|
||||||
|
*/
|
||||||
|
virtual bool init(Node *pStencil);
|
||||||
|
|
||||||
/**draw fullscreen quad to clear stencil bits
|
/**draw fullscreen quad to clear stencil bits
|
||||||
*/
|
*/
|
||||||
void drawFullScreenQuadClearStencil();
|
void drawFullScreenQuadClearStencil();
|
||||||
|
|
||||||
protected:
|
|
||||||
ClippingNode();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
Node* _stencil;
|
Node* _stencil;
|
||||||
GLfloat _alphaThreshold;
|
GLfloat _alphaThreshold;
|
||||||
bool _inverted;
|
bool _inverted;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -78,6 +78,12 @@ bool Configuration::init()
|
||||||
_valueDict->setObject(Bool::create(true), "cocos2d.x.compiled_with_gl_state_cache");
|
_valueDict->setObject(Bool::create(true), "cocos2d.x.compiled_with_gl_state_cache");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef DEBUG
|
||||||
|
_valueDict->setObject(String::create("DEBUG"), "cocos2d.x.build_type");
|
||||||
|
#else
|
||||||
|
_valueDict->setObject(String::create("RELEASE"), "cocos2d.x.build_type");
|
||||||
|
#endif
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1026,9 +1026,6 @@ void DisplayLinkDirector::startAnimation()
|
||||||
}
|
}
|
||||||
|
|
||||||
_invalid = false;
|
_invalid = false;
|
||||||
#ifndef EMSCRIPTEN
|
|
||||||
Application::getInstance()->setAnimationInterval(_animationInterval);
|
|
||||||
#endif // EMSCRIPTEN
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DisplayLinkDirector::mainLoop()
|
void DisplayLinkDirector::mainLoop()
|
||||||
|
@ -1040,6 +1037,9 @@ void DisplayLinkDirector::mainLoop()
|
||||||
}
|
}
|
||||||
else if (! _invalid)
|
else if (! _invalid)
|
||||||
{
|
{
|
||||||
|
// invoke call back from other thread
|
||||||
|
ThreadHelper::doCallback();
|
||||||
|
|
||||||
drawScene();
|
drawScene();
|
||||||
|
|
||||||
// release the objects
|
// release the objects
|
||||||
|
|
|
@ -46,17 +46,6 @@ class CC_DLL DrawNode : public Node
|
||||||
public:
|
public:
|
||||||
/** creates and initialize a DrawNode node */
|
/** creates and initialize a DrawNode node */
|
||||||
static DrawNode* create();
|
static DrawNode* create();
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
DrawNode();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~DrawNode();
|
|
||||||
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
/** draw a dot at a position, with a given radius and color */
|
/** draw a dot at a position, with a given radius and color */
|
||||||
void drawDot(const Point &pos, float radius, const Color4F &color);
|
void drawDot(const Point &pos, float radius, const Color4F &color);
|
||||||
|
@ -99,6 +88,10 @@ public:
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
DrawNode();
|
||||||
|
virtual ~DrawNode();
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
void ensureCapacity(long count);
|
void ensureCapacity(long count);
|
||||||
void render();
|
void render();
|
||||||
|
|
||||||
|
@ -112,6 +105,9 @@ protected:
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
|
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -251,7 +251,7 @@ private:
|
||||||
GLint _uniforms[UNIFORM_MAX];
|
GLint _uniforms[UNIFORM_MAX];
|
||||||
struct _hashUniformEntry* _hashForUniforms;
|
struct _hashUniformEntry* _hashForUniforms;
|
||||||
|
|
||||||
struct flag_struct {
|
struct flag_struct {
|
||||||
unsigned int usesTime:1;
|
unsigned int usesTime:1;
|
||||||
unsigned int usesMVP:1;
|
unsigned int usesMVP:1;
|
||||||
unsigned int usesMV:1;
|
unsigned int usesMV:1;
|
||||||
|
|
|
@ -119,16 +119,16 @@ Label::~Label()
|
||||||
if (_fontAtlas)
|
if (_fontAtlas)
|
||||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||||
|
|
||||||
delete _reusedLetter;
|
_reusedLetter->release();
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::init()
|
bool Label::init()
|
||||||
{
|
{
|
||||||
if(_fontAtlas)
|
if(_fontAtlas)
|
||||||
{
|
{
|
||||||
_reusedLetter = new Sprite;
|
_reusedLetter = Sprite::createWithTexture(&_fontAtlas->getTexture(0));
|
||||||
_reusedLetter->initWithTexture(&_fontAtlas->getTexture(0));
|
|
||||||
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||||
|
_reusedLetter->retain();
|
||||||
return SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), 30);
|
return SpriteBatchNode::initWithTexture(&_fontAtlas->getTexture(0), 30);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -437,15 +437,13 @@ Sprite * Label::getLetter(int ID)
|
||||||
uvRect.origin.x = _lettersInfo[ID].def.U;
|
uvRect.origin.x = _lettersInfo[ID].def.U;
|
||||||
uvRect.origin.y = _lettersInfo[ID].def.V;
|
uvRect.origin.y = _lettersInfo[ID].def.V;
|
||||||
|
|
||||||
sp = new Sprite();
|
sp = Sprite::createWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID), uvRect);
|
||||||
sp->initWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID),uvRect);
|
|
||||||
sp->setBatchNode(this);
|
sp->setBatchNode(this);
|
||||||
sp->setAnchorPoint(Point(_lettersInfo[ID].def.anchorX, _lettersInfo[ID].def.anchorY));
|
sp->setAnchorPoint(Point(_lettersInfo[ID].def.anchorX, _lettersInfo[ID].def.anchorY));
|
||||||
sp->setPosition(_lettersInfo[ID].position);
|
sp->setPosition(_lettersInfo[ID].position);
|
||||||
sp->setOpacity(_realOpacity);
|
sp->setOpacity(_realOpacity);
|
||||||
|
|
||||||
this->addSpriteWithoutQuad(sp, ID, ID);
|
this->addSpriteWithoutQuad(sp, ID, ID);
|
||||||
sp->release();
|
|
||||||
}
|
}
|
||||||
return sp;
|
return sp;
|
||||||
}
|
}
|
||||||
|
|
|
@ -511,8 +511,8 @@ bool LabelBMFont::initWithString(const std::string& theString, const std::string
|
||||||
|
|
||||||
_imageOffset = imageOffset;
|
_imageOffset = imageOffset;
|
||||||
|
|
||||||
_reusedChar = new Sprite();
|
_reusedChar = Sprite::createWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0));
|
||||||
_reusedChar->initWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0), false);
|
_reusedChar->retain();
|
||||||
_reusedChar->setBatchNode(this);
|
_reusedChar->setBatchNode(this);
|
||||||
|
|
||||||
this->setString(theString, true);
|
this->setString(theString, true);
|
||||||
|
@ -663,10 +663,8 @@ void LabelBMFont::createFontChars()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
fontChar = new Sprite();
|
fontChar = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||||
fontChar->initWithTexture(_textureAtlas->getTexture(), rect);
|
|
||||||
addChild(fontChar, i, i);
|
addChild(fontChar, i, i);
|
||||||
fontChar->release();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply label properties
|
// Apply label properties
|
||||||
|
@ -1199,9 +1197,9 @@ float LabelBMFont::getLetterPosXRight( Sprite* sp )
|
||||||
}
|
}
|
||||||
|
|
||||||
// LabelBMFont - FntFile
|
// LabelBMFont - FntFile
|
||||||
void LabelBMFont::setFntFile(const char* fntFile)
|
void LabelBMFont::setFntFile(const std::string& fntFile)
|
||||||
{
|
{
|
||||||
if (fntFile != NULL && strcmp(fntFile, _fntFile.c_str()) != 0 )
|
if (_fntFile.compare(fntFile) != 0)
|
||||||
{
|
{
|
||||||
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
|
CCBMFontConfiguration *newConf = FNTConfigLoadFile(fntFile);
|
||||||
|
|
||||||
|
@ -1218,9 +1216,9 @@ void LabelBMFont::setFntFile(const char* fntFile)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* LabelBMFont::getFntFile()
|
const std::string& LabelBMFont::getFntFile() const
|
||||||
{
|
{
|
||||||
return _fntFile.c_str();
|
return _fntFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -258,8 +258,8 @@ public:
|
||||||
virtual bool isCascadeColorEnabled() const;
|
virtual bool isCascadeColorEnabled() const;
|
||||||
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
virtual void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||||
|
|
||||||
void setFntFile(const char* fntFile);
|
void setFntFile(const std::string& fntFile);
|
||||||
const char* getFntFile();
|
const std::string& getFntFile() const;
|
||||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||||
virtual void draw();
|
virtual void draw();
|
||||||
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
||||||
|
|
|
@ -33,7 +33,6 @@ THE SOFTWARE.
|
||||||
#ifdef EMSCRIPTEN
|
#ifdef EMSCRIPTEN
|
||||||
#include "CCGLBufferedNode.h"
|
#include "CCGLBufferedNode.h"
|
||||||
#endif // EMSCRIPTEN
|
#endif // EMSCRIPTEN
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
|
|
||||||
#include "CCEventKeyboard.h"
|
#include "CCEventKeyboard.h"
|
||||||
|
|
||||||
|
@ -63,18 +62,8 @@ class CC_DLL Layer : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates a fullscreen black layer */
|
/** creates a fullscreen black layer */
|
||||||
static Layer *create(void);
|
static Layer *create();
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Layer();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Layer();
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
// Deprecated touch callbacks.
|
// Deprecated touch callbacks.
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); return false;};
|
CC_DEPRECATED_ATTRIBUTE virtual bool ccTouchBegan(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent); return false;};
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
|
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchMoved(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
|
||||||
|
@ -169,18 +158,30 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
Layer();
|
||||||
|
virtual ~Layer();
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
|
//add the api for avoid use deprecated api
|
||||||
|
void _addTouchListener();
|
||||||
|
|
||||||
|
CC_DEPRECATED_ATTRIBUTE void addTouchListener() { _addTouchListener();};
|
||||||
|
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch);
|
||||||
|
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches);
|
||||||
|
|
||||||
bool _touchEnabled;
|
bool _touchEnabled;
|
||||||
bool _accelerometerEnabled;
|
bool _accelerometerEnabled;
|
||||||
bool _keyboardEnabled;
|
bool _keyboardEnabled;
|
||||||
EventListener* _touchListener;
|
EventListener* _touchListener;
|
||||||
EventListenerKeyboard* _keyboardListener;
|
EventListenerKeyboard* _keyboardListener;
|
||||||
EventListenerAcceleration* _accelerationListener;
|
EventListenerAcceleration* _accelerationListener;
|
||||||
private:
|
|
||||||
Touch::DispatchMode _touchMode;
|
Touch::DispatchMode _touchMode;
|
||||||
bool _swallowsTouches;
|
bool _swallowsTouches;
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch);
|
private:
|
||||||
CC_DEPRECATED_ATTRIBUTE int executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches);
|
CC_DISALLOW_COPY_AND_ASSIGN(Layer);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -195,17 +196,7 @@ class CC_DLL LayerRGBA : public Layer, public RGBAProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CREATE_FUNC(LayerRGBA);
|
CREATE_FUNC(LayerRGBA);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
LayerRGBA();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~LayerRGBA();
|
|
||||||
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -226,10 +217,18 @@ public:
|
||||||
|
|
||||||
virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}
|
virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}
|
||||||
virtual bool isOpacityModifyRGB() const override { return false; }
|
virtual bool isOpacityModifyRGB() const override { return false; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
LayerRGBA();
|
||||||
|
virtual ~LayerRGBA();
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
GLubyte _displayedOpacity, _realOpacity;
|
GLubyte _displayedOpacity, _realOpacity;
|
||||||
Color3B _displayedColor, _realColor;
|
Color3B _displayedColor, _realColor;
|
||||||
bool _cascadeOpacityEnabled, _cascadeColorEnabled;
|
bool _cascadeOpacityEnabled, _cascadeColorEnabled;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(LayerRGBA);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -253,27 +252,6 @@ public:
|
||||||
static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height);
|
static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height);
|
||||||
/** creates a Layer with color. Width and height are the window size. */
|
/** creates a Layer with color. Width and height are the window size. */
|
||||||
static LayerColor * create(const Color4B& color);
|
static LayerColor * create(const Color4B& color);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
LayerColor();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~LayerColor();
|
|
||||||
|
|
||||||
virtual bool init();
|
|
||||||
/** initializes a Layer with color, width and height in Points
|
|
||||||
* @js init
|
|
||||||
* @lua init
|
|
||||||
*/
|
|
||||||
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
|
||||||
/** initializes a Layer with color. Width and height are the window size.
|
|
||||||
* @js init
|
|
||||||
* @lua init
|
|
||||||
*/
|
|
||||||
bool initWithColor(const Color4B& color);
|
|
||||||
|
|
||||||
/** change width in Points*/
|
/** change width in Points*/
|
||||||
void changeWidth(GLfloat w);
|
void changeWidth(GLfloat w);
|
||||||
|
@ -307,11 +285,21 @@ public:
|
||||||
virtual void setBlendFunc(const BlendFunc& blendFunc) override;
|
virtual void setBlendFunc(const BlendFunc& blendFunc) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
LayerColor();
|
||||||
|
virtual ~LayerColor();
|
||||||
|
virtual bool init();
|
||||||
|
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
||||||
|
bool initWithColor(const Color4B& color);
|
||||||
|
|
||||||
virtual void updateColor();
|
virtual void updateColor();
|
||||||
|
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
Vertex2F _squareVertices[4];
|
Vertex2F _squareVertices[4];
|
||||||
Color4F _squareColors[4];
|
Color4F _squareColors[4];
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -73,17 +73,6 @@ public:
|
||||||
|
|
||||||
/** creates a Menu with MenuItem objects */
|
/** creates a Menu with MenuItem objects */
|
||||||
static Menu* createWithItems(MenuItem *firstItem, va_list args);
|
static Menu* createWithItems(MenuItem *firstItem, va_list args);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Menu() : _selectedItem(NULL) {}
|
|
||||||
virtual ~Menu();
|
|
||||||
|
|
||||||
/** initializes an empty Menu */
|
|
||||||
bool init();
|
|
||||||
|
|
||||||
/** initializes a Menu with a NSArray of MenuItem objects */
|
|
||||||
bool initWithArray(Array* pArrayOfItems);
|
|
||||||
|
|
||||||
/** align items vertically */
|
/** align items vertically */
|
||||||
void alignItemsVertically();
|
void alignItemsVertically();
|
||||||
|
@ -130,12 +119,27 @@ public:
|
||||||
virtual bool isOpacityModifyRGB(void) const override { return false;}
|
virtual bool isOpacityModifyRGB(void) const override { return false;}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
Menu() : _selectedItem(NULL) {}
|
||||||
|
virtual ~Menu();
|
||||||
|
|
||||||
|
/** initializes an empty Menu */
|
||||||
|
bool init();
|
||||||
|
|
||||||
|
/** initializes a Menu with a NSArray of MenuItem objects */
|
||||||
|
bool initWithArray(Array* pArrayOfItems);
|
||||||
|
|
||||||
/** whether or not the menu will receive events */
|
/** whether or not the menu will receive events */
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
|
|
||||||
MenuItem* itemForTouch(Touch * touch);
|
MenuItem* itemForTouch(Touch * touch);
|
||||||
State _state;
|
State _state;
|
||||||
MenuItem *_selectedItem;
|
MenuItem *_selectedItem;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of GUI group
|
// end of GUI group
|
||||||
|
|
|
@ -65,31 +65,6 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
||||||
/** Creates a MenuItem with a target/selector */
|
/** Creates a MenuItem with a target/selector */
|
||||||
static MenuItem* create(const ccMenuCallback& callback);
|
static MenuItem* create(const ccMenuCallback& callback);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
MenuItem()
|
|
||||||
: _selected(false)
|
|
||||||
, _enabled(false)
|
|
||||||
, _callback(nullptr)
|
|
||||||
, _target(NULL)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~MenuItem();
|
|
||||||
|
|
||||||
/** Initializes a MenuItem with a target/selector
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
bool initWithCallback(const ccMenuCallback& callback);
|
|
||||||
/** Initializes a MenuItem with a target/selector
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget( Object *rec, SEL_MenuHandler selector);
|
|
||||||
|
|
||||||
/** Returns the outside box */
|
/** Returns the outside box */
|
||||||
Rect rect() const;
|
Rect rect() const;
|
||||||
|
@ -120,12 +95,41 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
MenuItem()
|
||||||
|
: _selected(false)
|
||||||
|
, _enabled(false)
|
||||||
|
, _callback(nullptr)
|
||||||
|
, _target(NULL)
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~MenuItem();
|
||||||
|
|
||||||
|
/** Initializes a MenuItem with a target/selector
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
bool initWithCallback(const ccMenuCallback& callback);
|
||||||
|
/** Initializes a MenuItem with a target/selector
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithTarget( Object *rec, SEL_MenuHandler selector);
|
||||||
|
|
||||||
bool _selected;
|
bool _selected;
|
||||||
bool _enabled;
|
bool _enabled;
|
||||||
// callback
|
// callback
|
||||||
ccMenuCallback _callback;
|
ccMenuCallback _callback;
|
||||||
// If using the old API, the _target needs to be retained / released
|
// If using the old API, the _target needs to be retained / released
|
||||||
Object *_target;
|
Object *_target;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief An abstract class for "label" MenuItemLabel items
|
/** @brief An abstract class for "label" MenuItemLabel items
|
||||||
|
@ -146,24 +150,6 @@ public:
|
||||||
|
|
||||||
/** creates a MenuItemLabel with a Label. Target and selector will be nil */
|
/** creates a MenuItemLabel with a Label. Target and selector will be nil */
|
||||||
static MenuItemLabel* create(Node *label);
|
static MenuItemLabel* create(Node *label);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
MenuItemLabel()
|
|
||||||
: _originalScale(0.0)
|
|
||||||
, _label(NULL)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~MenuItemLabel();
|
|
||||||
|
|
||||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
|
||||||
bool initWithLabel(Node* label, const ccMenuCallback& callback);
|
|
||||||
|
|
||||||
/** initializes a MenuItemLabel with a Label, target and selector */
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
|
||||||
|
|
||||||
/** sets a new string to the inner label */
|
/** sets a new string to the inner label */
|
||||||
void setString(const std::string& label);
|
void setString(const std::string& label);
|
||||||
|
@ -187,6 +173,25 @@ public:
|
||||||
virtual void setEnabled(bool enabled) override;
|
virtual void setEnabled(bool enabled) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
MenuItemLabel()
|
||||||
|
: _originalScale(0.0)
|
||||||
|
, _label(NULL)
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~MenuItemLabel();
|
||||||
|
|
||||||
|
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||||
|
bool initWithLabel(Node* label, const ccMenuCallback& callback);
|
||||||
|
|
||||||
|
/** initializes a MenuItemLabel with a Label, target and selector */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithLabel(Node* label, Object* target, SEL_MenuHandler selector);
|
||||||
|
|
||||||
Color3B _colorBackup;
|
Color3B _colorBackup;
|
||||||
float _originalScale;
|
float _originalScale;
|
||||||
|
|
||||||
|
@ -194,6 +199,9 @@ protected:
|
||||||
Color3B _disabledColor;
|
Color3B _disabledColor;
|
||||||
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
||||||
Node* _label;
|
Node* _label;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemLabel);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -209,6 +217,8 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItemAtlasFont* create(const char* value, const char* charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE static MenuItemAtlasFont* create(const char* value, const char* charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
||||||
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
/** creates a menu item from a string and atlas. Use it with MenuItemToggle */
|
||||||
static MenuItemAtlasFont* create(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
static MenuItemAtlasFont* create(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -223,6 +233,9 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, const char *charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, const char *charMapFile, long itemWidth, long itemHeight, char startCharMap, Object* target, SEL_MenuHandler selector);
|
||||||
/** initializes a menu item from a string and atlas with a target/selector */
|
/** initializes a menu item from a string and atlas with a target/selector */
|
||||||
bool initWithString(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
bool initWithString(const std::string& value, const std::string& charMapFile, long itemWidth, long itemHeight, char startCharMap, const ccMenuCallback& callback);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -233,25 +246,11 @@ class CC_DLL MenuItemFont : public MenuItemLabel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates a menu item from a string without target/selector. To be used with MenuItemToggle */
|
/** creates a menu item from a string without target/selector. To be used with MenuItemToggle */
|
||||||
static MenuItemFont * create(const std::string& value);
|
static MenuItemFont * create(const std::string& value = "");
|
||||||
/** creates a menu item from a string with a target/selector */
|
/** creates a menu item from a string with a target/selector */
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItemFont * create(const char *value, Object* target, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE static MenuItemFont * create(const char *value, Object* target, SEL_MenuHandler selector);
|
||||||
/** creates a menu item from a string with a target/selector */
|
/** creates a menu item from a string with a target/selector */
|
||||||
static MenuItemFont * create(const std::string& value, const ccMenuCallback& callback);
|
static MenuItemFont * create(const std::string& value, const ccMenuCallback& callback);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
MenuItemFont();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~MenuItemFont();
|
|
||||||
|
|
||||||
/** initializes a menu item from a string with a target/selector */
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
|
||||||
/** initializes a menu item from a string with a target/selector */
|
|
||||||
bool initWithString(const std::string& value, const ccMenuCallback& callback);
|
|
||||||
|
|
||||||
/** set default font size */
|
/** set default font size */
|
||||||
static void setFontSize(long size);
|
static void setFontSize(long size);
|
||||||
|
@ -293,10 +292,28 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE const std::string& fontNameObj() const { return getFontNameObj(); }
|
CC_DEPRECATED_ATTRIBUTE const std::string& fontNameObj() const { return getFontNameObj(); }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
MenuItemFont();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~MenuItemFont();
|
||||||
|
|
||||||
|
/** initializes a menu item from a string with a target/selector */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithString(const char *value, Object* target, SEL_MenuHandler selector);
|
||||||
|
/** initializes a menu item from a string with a target/selector */
|
||||||
|
bool initWithString(const std::string& value, const ccMenuCallback& callback);
|
||||||
|
|
||||||
void recreateLabel();
|
void recreateLabel();
|
||||||
|
|
||||||
long _fontSize;
|
long _fontSize;
|
||||||
std::string _fontName;
|
std::string _fontName;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemFont);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -322,17 +339,6 @@ public:
|
||||||
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
/** creates a menu item with a normal,selected and disabled image with target/selector */
|
||||||
static MenuItemSprite * create(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
static MenuItemSprite * create(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||||
|
|
||||||
MenuItemSprite()
|
|
||||||
:_normalImage(NULL)
|
|
||||||
,_selectedImage(NULL)
|
|
||||||
,_disabledImage(NULL)
|
|
||||||
{}
|
|
||||||
|
|
||||||
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Object* target, SEL_MenuHandler selector);
|
|
||||||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
|
||||||
bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
|
||||||
|
|
||||||
/** Gets the image used when the item is not selected */
|
/** Gets the image used when the item is not selected */
|
||||||
inline Node* getNormalImage() const { return _normalImage; };
|
inline Node* getNormalImage() const { return _normalImage; };
|
||||||
|
|
||||||
|
@ -359,6 +365,17 @@ public:
|
||||||
virtual void setEnabled(bool bEnabled);
|
virtual void setEnabled(bool bEnabled);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
MenuItemSprite()
|
||||||
|
:_normalImage(NULL)
|
||||||
|
,_selectedImage(NULL)
|
||||||
|
,_disabledImage(NULL)
|
||||||
|
{}
|
||||||
|
|
||||||
|
/** initializes a menu item with a normal, selected and disabled image with target/selector */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, Object* target, SEL_MenuHandler selector);
|
||||||
|
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||||
|
bool initWithNormalSprite(Node* normalSprite, Node* selectedSprite, Node* disabledSprite, const ccMenuCallback& callback);
|
||||||
|
|
||||||
virtual void updateImagesVisibility();
|
virtual void updateImagesVisibility();
|
||||||
|
|
||||||
/** the image used when the item is not selected */
|
/** the image used when the item is not selected */
|
||||||
|
@ -367,6 +384,9 @@ protected:
|
||||||
Node* _selectedImage;
|
Node* _selectedImage;
|
||||||
/** the image used when the item is disabled */
|
/** the image used when the item is disabled */
|
||||||
Node* _disabledImage;
|
Node* _disabledImage;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemSprite);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -396,6 +416,15 @@ public:
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage, Object* target, SEL_MenuHandler selector);
|
CC_DEPRECATED_ATTRIBUTE static MenuItemImage* create(const char *normalImage, const char *selectedImage, const char *disabledImage, Object* target, SEL_MenuHandler selector);
|
||||||
/** creates a menu item with a normal,selected and disabled image with a callable object */
|
/** creates a menu item with a normal,selected and disabled image with a callable object */
|
||||||
static MenuItemImage* create(const std::string&normalImage, const std::string&selectedImage, const std::string&disabledImage, const ccMenuCallback& callback);
|
static MenuItemImage* create(const std::string&normalImage, const std::string&selectedImage, const std::string&disabledImage, const ccMenuCallback& callback);
|
||||||
|
|
||||||
|
/** sets the sprite frame for the normal image */
|
||||||
|
void setNormalSpriteFrame(SpriteFrame* frame);
|
||||||
|
/** sets the sprite frame for the selected image */
|
||||||
|
void setSelectedSpriteFrame(SpriteFrame* frame);
|
||||||
|
/** sets the sprite frame for the disabled image */
|
||||||
|
void setDisabledSpriteFrame(SpriteFrame* frame);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -412,12 +441,8 @@ public:
|
||||||
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
/** initializes a menu item with a normal, selected and disabled image with a callable object */
|
||||||
bool initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback);
|
bool initWithNormalImage(const std::string& normalImage, const std::string& selectedImage, const std::string& disabledImage, const ccMenuCallback& callback);
|
||||||
|
|
||||||
/** sets the sprite frame for the normal image */
|
private:
|
||||||
void setNormalSpriteFrame(SpriteFrame* frame);
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
||||||
/** sets the sprite frame for the selected image */
|
|
||||||
void setSelectedSpriteFrame(SpriteFrame* frame);
|
|
||||||
/** sets the sprite frame for the disabled image */
|
|
||||||
void setDisabledSpriteFrame(SpriteFrame* frame);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -436,39 +461,6 @@ public:
|
||||||
static MenuItemToggle* create();
|
static MenuItemToggle* create();
|
||||||
/** creates a menu item with a item */
|
/** creates a menu item with a item */
|
||||||
static MenuItemToggle* create(MenuItem *item);
|
static MenuItemToggle* create(MenuItem *item);
|
||||||
/** creates a menu item from a Array with a target selector
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
|
||||||
/** creates a menu item from a list of items with a target/selector
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...)CC_REQUIRES_NULL_TERMINATION;
|
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
MenuItemToggle()
|
|
||||||
: _selectedIndex(0)
|
|
||||||
, _subItems(NULL)
|
|
||||||
{}
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~MenuItemToggle();
|
|
||||||
|
|
||||||
/** initializes a menu item from a list of items with a target selector
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, va_list args);
|
|
||||||
/** initializes a menu item from a list of items with a callable object */
|
|
||||||
bool initWithCallback(const ccMenuCallback& callback, MenuItem* item, va_list args);
|
|
||||||
|
|
||||||
/** initializes a menu item with a item */
|
|
||||||
bool initWithItem(MenuItem *item);
|
|
||||||
/** add more menu item */
|
/** add more menu item */
|
||||||
void addSubItem(MenuItem *item);
|
void addSubItem(MenuItem *item);
|
||||||
|
|
||||||
|
@ -506,6 +498,40 @@ public:
|
||||||
virtual void setEnabled(bool var) override;
|
virtual void setEnabled(bool var) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** creates a menu item from a Array with a target selector
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle * createWithTarget(Object* target, SEL_MenuHandler selector, Array* menuItems);
|
||||||
|
/** creates a menu item from a list of items with a target/selector
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE static MenuItemToggle* createWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, ...)CC_REQUIRES_NULL_TERMINATION;
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
MenuItemToggle()
|
||||||
|
: _selectedIndex(0)
|
||||||
|
, _subItems(NULL)
|
||||||
|
{}
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~MenuItemToggle();
|
||||||
|
|
||||||
|
/** initializes a menu item from a list of items with a target selector
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
CC_DEPRECATED_ATTRIBUTE bool initWithTarget(Object* target, SEL_MenuHandler selector, MenuItem* item, va_list args);
|
||||||
|
/** initializes a menu item from a list of items with a callable object */
|
||||||
|
bool initWithCallback(const ccMenuCallback& callback, MenuItem* item, va_list args);
|
||||||
|
|
||||||
|
/** initializes a menu item with a item */
|
||||||
|
bool initWithItem(MenuItem *item);
|
||||||
|
|
||||||
/** returns the selected item */
|
/** returns the selected item */
|
||||||
unsigned int _selectedIndex;
|
unsigned int _selectedIndex;
|
||||||
/** Array that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
|
/** Array that contains the subitems. You can add/remove items in runtime, and you can replace the array with a new one.
|
||||||
|
@ -513,6 +539,9 @@ protected:
|
||||||
*/
|
*/
|
||||||
Array* _subItems;
|
Array* _subItems;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -53,20 +53,6 @@ public:
|
||||||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||||
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
|
/** creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture */
|
||||||
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
static MotionStreak* create(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
MotionStreak();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~MotionStreak();
|
|
||||||
|
|
||||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
|
||||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
|
||||||
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
|
||||||
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
|
||||||
|
|
||||||
/** color used for the tint */
|
/** color used for the tint */
|
||||||
void tintWithColor(const Color3B& colors);
|
void tintWithColor(const Color3B& colors);
|
||||||
|
@ -114,9 +100,24 @@ public:
|
||||||
virtual bool isOpacityModifyRGB() const override;
|
virtual bool isOpacityModifyRGB() const override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
MotionStreak();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~MotionStreak();
|
||||||
|
|
||||||
|
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture filename */
|
||||||
|
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, const char* path);
|
||||||
|
/** initializes a motion streak with fade in seconds, minimum segments, stroke's width, color and texture */
|
||||||
|
bool initWithFade(float fade, float minSeg, float stroke, const Color3B& color, Texture2D* texture);
|
||||||
|
|
||||||
bool _fastMode;
|
bool _fastMode;
|
||||||
bool _startingPositionInitialized;
|
bool _startingPositionInitialized;
|
||||||
private:
|
|
||||||
/** texture used for the motion streak */
|
/** texture used for the motion streak */
|
||||||
Texture2D* _texture;
|
Texture2D* _texture;
|
||||||
BlendFunc _blendFunc;
|
BlendFunc _blendFunc;
|
||||||
|
@ -138,6 +139,9 @@ private:
|
||||||
Vertex2F* _vertices;
|
Vertex2F* _vertices;
|
||||||
GLubyte* _colorPointer;
|
GLubyte* _colorPointer;
|
||||||
Tex2F* _texCoords;
|
Tex2F* _texCoords;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of misc_nodes group
|
// end of misc_nodes group
|
||||||
|
|
|
@ -38,7 +38,6 @@
|
||||||
#include "CCScriptSupport.h"
|
#include "CCScriptSupport.h"
|
||||||
#include "CCProtocols.h"
|
#include "CCProtocols.h"
|
||||||
#include "CCEventDispatcher.h"
|
#include "CCEventDispatcher.h"
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -152,25 +151,6 @@ public:
|
||||||
*/
|
*/
|
||||||
static Node * create(void);
|
static Node * create(void);
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Node(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default destructor
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Node(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes the instance of Node
|
|
||||||
* @return Whether the initialization was successful.
|
|
||||||
*/
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the description string. It makes debugging easier.
|
* Gets the description string. It makes debugging easier.
|
||||||
* @return A string terminated with '\0'
|
* @return A string terminated with '\0'
|
||||||
|
@ -1411,7 +1391,11 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
// Nodes should be created using create();
|
||||||
|
Node();
|
||||||
|
virtual ~Node();
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
/// lazy allocs
|
/// lazy allocs
|
||||||
void childrenAlloc(void);
|
void childrenAlloc(void);
|
||||||
|
|
||||||
|
@ -1494,6 +1478,9 @@ protected:
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
PhysicsBody* _physicsBody; ///< the physicsBody the node have
|
PhysicsBody* _physicsBody; ///< the physicsBody the node have
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||||
};
|
};
|
||||||
|
|
||||||
//#pragma mark - NodeRGBA
|
//#pragma mark - NodeRGBA
|
||||||
|
@ -1510,18 +1497,6 @@ protected:
|
||||||
class CC_DLL NodeRGBA : public Node, public RGBAProtocol
|
class CC_DLL NodeRGBA : public Node, public RGBAProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
NodeRGBA();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~NodeRGBA();
|
|
||||||
|
|
||||||
virtual bool init();
|
|
||||||
|
|
||||||
// overrides
|
// overrides
|
||||||
virtual GLubyte getOpacity() const override;
|
virtual GLubyte getOpacity() const override;
|
||||||
virtual GLubyte getDisplayedOpacity() const override;
|
virtual GLubyte getDisplayedOpacity() const override;
|
||||||
|
@ -1541,12 +1516,19 @@ public:
|
||||||
virtual bool isOpacityModifyRGB() const override { return false; };
|
virtual bool isOpacityModifyRGB() const override { return false; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
NodeRGBA();
|
||||||
|
virtual ~NodeRGBA();
|
||||||
|
virtual bool init();
|
||||||
|
|
||||||
GLubyte _displayedOpacity;
|
GLubyte _displayedOpacity;
|
||||||
GLubyte _realOpacity;
|
GLubyte _realOpacity;
|
||||||
Color3B _displayedColor;
|
Color3B _displayedColor;
|
||||||
Color3B _realColor;
|
Color3B _realColor;
|
||||||
bool _cascadeColorEnabled;
|
bool _cascadeColorEnabled;
|
||||||
bool _cascadeOpacityEnabled;
|
bool _cascadeOpacityEnabled;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(NodeRGBA);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of base_node group
|
// end of base_node group
|
||||||
|
|
|
@ -48,18 +48,6 @@ class CC_DLL ParallaxNode : public Node
|
||||||
public:
|
public:
|
||||||
// Create a Parallax node
|
// Create a Parallax node
|
||||||
static ParallaxNode * create();
|
static ParallaxNode * create();
|
||||||
|
|
||||||
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
|
|
||||||
It returns self, so you can chain several addChilds.
|
|
||||||
@since v0.8
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
ParallaxNode();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ParallaxNode();
|
|
||||||
|
|
||||||
// prevents compiler warning: "Included function hides overloaded virtual functions"
|
// prevents compiler warning: "Included function hides overloaded virtual functions"
|
||||||
using Node::addChild;
|
using Node::addChild;
|
||||||
|
@ -81,10 +69,25 @@ public:
|
||||||
virtual void visit(void) override;
|
virtual void visit(void) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/** Adds a child to the container with a z-order, a parallax ratio and a position offset
|
||||||
|
It returns self, so you can chain several addChilds.
|
||||||
|
@since v0.8
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
ParallaxNode();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~ParallaxNode();
|
||||||
|
|
||||||
Point absolutePosition();
|
Point absolutePosition();
|
||||||
|
|
||||||
Point _lastPosition;
|
Point _lastPosition;
|
||||||
struct _ccArray* _parallaxArray;
|
struct _ccArray* _parallaxArray;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of tilemap_parallax_nodes group
|
// end of tilemap_parallax_nodes group
|
||||||
|
|
|
@ -59,7 +59,7 @@ ParticleBatchNode::~ParticleBatchNode()
|
||||||
* creation with Texture2D
|
* creation with Texture2D
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned int capacity/* = kParticleDefaultCapacity*/)
|
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, int capacity/* = kParticleDefaultCapacity*/)
|
||||||
{
|
{
|
||||||
ParticleBatchNode * p = new ParticleBatchNode();
|
ParticleBatchNode * p = new ParticleBatchNode();
|
||||||
if( p && p->initWithTexture(tex, capacity))
|
if( p && p->initWithTexture(tex, capacity))
|
||||||
|
@ -75,7 +75,7 @@ ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned
|
||||||
* creation with File Image
|
* creation with File Image
|
||||||
*/
|
*/
|
||||||
|
|
||||||
ParticleBatchNode* ParticleBatchNode::create(const char* imageFile, unsigned int capacity/* = kParticleDefaultCapacity*/)
|
ParticleBatchNode* ParticleBatchNode::create(const std::string& imageFile, int capacity/* = kParticleDefaultCapacity*/)
|
||||||
{
|
{
|
||||||
ParticleBatchNode * p = new ParticleBatchNode();
|
ParticleBatchNode * p = new ParticleBatchNode();
|
||||||
if( p && p->initWithFile(imageFile, capacity))
|
if( p && p->initWithFile(imageFile, capacity))
|
||||||
|
@ -90,7 +90,7 @@ ParticleBatchNode* ParticleBatchNode::create(const char* imageFile, unsigned int
|
||||||
/*
|
/*
|
||||||
* init with Texture2D
|
* init with Texture2D
|
||||||
*/
|
*/
|
||||||
bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
bool ParticleBatchNode::initWithTexture(Texture2D *tex, int capacity)
|
||||||
{
|
{
|
||||||
_textureAtlas = new TextureAtlas();
|
_textureAtlas = new TextureAtlas();
|
||||||
_textureAtlas->initWithTexture(tex, capacity);
|
_textureAtlas->initWithTexture(tex, capacity);
|
||||||
|
@ -109,7 +109,7 @@ bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
||||||
/*
|
/*
|
||||||
* init with FileImage
|
* init with FileImage
|
||||||
*/
|
*/
|
||||||
bool ParticleBatchNode::initWithFile(const char* fileImage, unsigned int capacity)
|
bool ParticleBatchNode::initWithFile(const std::string& fileImage, int capacity)
|
||||||
{
|
{
|
||||||
Texture2D *tex = Director::getInstance()->getTextureCache()->addImage(fileImage);
|
Texture2D *tex = Director::getInstance()->getTextureCache()->addImage(fileImage);
|
||||||
return initWithTexture(tex, capacity);
|
return initWithTexture(tex, capacity);
|
||||||
|
|
|
@ -68,10 +68,10 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** initializes the particle system with Texture2D, a capacity of particles, which particle system to use */
|
/** initializes the particle system with Texture2D, a capacity of particles, which particle system to use */
|
||||||
static ParticleBatchNode* createWithTexture(Texture2D *tex, unsigned int capacity = kParticleDefaultCapacity);
|
static ParticleBatchNode* createWithTexture(Texture2D *tex, int capacity = kParticleDefaultCapacity);
|
||||||
|
|
||||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||||
static ParticleBatchNode* create(const char* fileImage, unsigned int capacity = kParticleDefaultCapacity);
|
static ParticleBatchNode* create(const std::string& fileImage, int capacity = kParticleDefaultCapacity);
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -83,10 +83,10 @@ public:
|
||||||
virtual ~ParticleBatchNode();
|
virtual ~ParticleBatchNode();
|
||||||
|
|
||||||
/** initializes the particle system with Texture2D, a capacity of particles */
|
/** initializes the particle system with Texture2D, a capacity of particles */
|
||||||
bool initWithTexture(Texture2D *tex, unsigned int capacity);
|
bool initWithTexture(Texture2D *tex, int capacity);
|
||||||
|
|
||||||
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
/** initializes the particle system with the name of a file on disk (for a list of supported formats look at the Texture2D class), a capacity of particles */
|
||||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
bool initWithFile(const std::string& fileImage, int capacity);
|
||||||
|
|
||||||
/** Inserts a child into the ParticleBatchNode */
|
/** Inserts a child into the ParticleBatchNode */
|
||||||
void insertChild(ParticleSystem* system, int index);
|
void insertChild(ParticleSystem* system, int index);
|
||||||
|
|
|
@ -72,7 +72,7 @@ ParticleFire* ParticleFire::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleFire* ParticleFire::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleFire* pRet = new ParticleFire();
|
ParticleFire* pRet = new ParticleFire();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -86,7 +86,7 @@ ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfPartic
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleFire::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleFire::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -177,7 +177,7 @@ ParticleFireworks* ParticleFireworks::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleFireworks* ParticleFireworks::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleFireworks* pRet = new ParticleFireworks();
|
ParticleFireworks* pRet = new ParticleFireworks();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -191,7 +191,7 @@ ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numb
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleFireworks::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -278,7 +278,7 @@ ParticleSun* ParticleSun::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleSun* ParticleSun::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleSun* pRet = new ParticleSun();
|
ParticleSun* pRet = new ParticleSun();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -292,7 +292,7 @@ ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticle
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSun::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSun::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -385,7 +385,7 @@ ParticleGalaxy* ParticleGalaxy::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleGalaxy* pRet = new ParticleGalaxy();
|
ParticleGalaxy* pRet = new ParticleGalaxy();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -399,7 +399,7 @@ ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfPa
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -494,7 +494,7 @@ ParticleFlower* ParticleFlower::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleFlower* ParticleFlower::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleFlower* pRet = new ParticleFlower();
|
ParticleFlower* pRet = new ParticleFlower();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -508,7 +508,7 @@ ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfPa
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleFlower::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -602,7 +602,7 @@ ParticleMeteor * ParticleMeteor::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleMeteor* ParticleMeteor::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleMeteor* pRet = new ParticleMeteor();
|
ParticleMeteor* pRet = new ParticleMeteor();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -616,7 +616,7 @@ ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfPa
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleMeteor::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -711,7 +711,7 @@ ParticleSpiral* ParticleSpiral::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleSpiral* ParticleSpiral::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleSpiral* pRet = new ParticleSpiral();
|
ParticleSpiral* pRet = new ParticleSpiral();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -725,7 +725,7 @@ ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfPa
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSpiral::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -820,7 +820,7 @@ ParticleExplosion* ParticleExplosion::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleExplosion* pRet = new ParticleExplosion();
|
ParticleExplosion* pRet = new ParticleExplosion();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -834,7 +834,7 @@ ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numb
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleExplosion::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -928,7 +928,7 @@ ParticleSmoke* ParticleSmoke::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleSmoke* ParticleSmoke::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleSmoke* pRet = new ParticleSmoke();
|
ParticleSmoke* pRet = new ParticleSmoke();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -942,7 +942,7 @@ ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfPart
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSmoke::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -1033,7 +1033,7 @@ ParticleSnow* ParticleSnow::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleSnow* ParticleSnow::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleSnow* pRet = new ParticleSnow();
|
ParticleSnow* pRet = new ParticleSnow();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -1047,7 +1047,7 @@ ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfPartic
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSnow::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
@ -1141,7 +1141,7 @@ ParticleRain* ParticleRain::create()
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleRain* ParticleRain::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleRain* pRet = new ParticleRain();
|
ParticleRain* pRet = new ParticleRain();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -1155,7 +1155,7 @@ ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfPartic
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleRain::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,6 +39,10 @@ NS_CC_BEGIN
|
||||||
class CC_DLL ParticleFire : public ParticleSystemQuad
|
class CC_DLL ParticleFire : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleFire* create();
|
||||||
|
static ParticleFire* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -49,16 +53,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleFire(){}
|
virtual ~ParticleFire(){}
|
||||||
bool init(){ return initWithTotalParticles(250); }
|
bool init(){ return initWithTotalParticles(250); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||||
|
|
||||||
static ParticleFire* create();
|
private:
|
||||||
static ParticleFire* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A fireworks particle system
|
//! @brief A fireworks particle system
|
||||||
class CC_DLL ParticleFireworks : public ParticleSystemQuad
|
class CC_DLL ParticleFireworks : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleFireworks* create();
|
||||||
|
static ParticleFireworks* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -69,16 +77,21 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleFireworks(){}
|
virtual ~ParticleFireworks(){}
|
||||||
bool init(){ return initWithTotalParticles(1500); }
|
bool init(){ return initWithTotalParticles(1500); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleFireworks* create();
|
private:
|
||||||
static ParticleFireworks* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A sun particle system
|
//! @brief A sun particle system
|
||||||
class CC_DLL ParticleSun : public ParticleSystemQuad
|
class CC_DLL ParticleSun : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleSun* create();
|
||||||
|
static ParticleSun* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -89,16 +102,21 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleSun(){}
|
virtual ~ParticleSun(){}
|
||||||
bool init(){ return initWithTotalParticles(350); }
|
bool init(){ return initWithTotalParticles(350); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleSun* create();
|
private:
|
||||||
static ParticleSun* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A galaxy particle system
|
//! @brief A galaxy particle system
|
||||||
class CC_DLL ParticleGalaxy : public ParticleSystemQuad
|
class CC_DLL ParticleGalaxy : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleGalaxy* create();
|
||||||
|
static ParticleGalaxy* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -109,16 +127,21 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleGalaxy(){}
|
virtual ~ParticleGalaxy(){}
|
||||||
bool init(){ return initWithTotalParticles(200); }
|
bool init(){ return initWithTotalParticles(200); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleGalaxy* create();
|
private:
|
||||||
static ParticleGalaxy* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A flower particle system
|
//! @brief A flower particle system
|
||||||
class CC_DLL ParticleFlower : public ParticleSystemQuad
|
class CC_DLL ParticleFlower : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleFlower* create();
|
||||||
|
static ParticleFlower* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -129,16 +152,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleFlower(){}
|
virtual ~ParticleFlower(){}
|
||||||
bool init(){ return initWithTotalParticles(250); }
|
bool init(){ return initWithTotalParticles(250); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleFlower* create();
|
private:
|
||||||
static ParticleFlower* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A meteor particle system
|
//! @brief A meteor particle system
|
||||||
class CC_DLL ParticleMeteor : public ParticleSystemQuad
|
class CC_DLL ParticleMeteor : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleMeteor * create();
|
||||||
|
static ParticleMeteor* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -149,16 +176,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleMeteor(){}
|
virtual ~ParticleMeteor(){}
|
||||||
bool init(){ return initWithTotalParticles(150); }
|
bool init(){ return initWithTotalParticles(150); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleMeteor * create();
|
private:
|
||||||
static ParticleMeteor* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief An spiral particle system
|
//! @brief An spiral particle system
|
||||||
class CC_DLL ParticleSpiral : public ParticleSystemQuad
|
class CC_DLL ParticleSpiral : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleSpiral* create();
|
||||||
|
static ParticleSpiral* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -169,16 +200,21 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleSpiral(){}
|
virtual ~ParticleSpiral(){}
|
||||||
bool init(){ return initWithTotalParticles(500); }
|
bool init(){ return initWithTotalParticles(500); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleSpiral* create();
|
private:
|
||||||
static ParticleSpiral* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief An explosion particle system
|
//! @brief An explosion particle system
|
||||||
class CC_DLL ParticleExplosion : public ParticleSystemQuad
|
class CC_DLL ParticleExplosion : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleExplosion* create();
|
||||||
|
static ParticleExplosion* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -189,16 +225,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleExplosion(){}
|
virtual ~ParticleExplosion(){}
|
||||||
bool init(){ return initWithTotalParticles(700); }
|
bool init(){ return initWithTotalParticles(700); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleExplosion* create();
|
private:
|
||||||
static ParticleExplosion* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief An smoke particle system
|
//! @brief An smoke particle system
|
||||||
class CC_DLL ParticleSmoke : public ParticleSystemQuad
|
class CC_DLL ParticleSmoke : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleSmoke* create();
|
||||||
|
static ParticleSmoke* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -209,16 +249,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleSmoke(){}
|
virtual ~ParticleSmoke(){}
|
||||||
bool init(){ return initWithTotalParticles(200); }
|
bool init(){ return initWithTotalParticles(200); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleSmoke* create();
|
private:
|
||||||
static ParticleSmoke* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief An snow particle system
|
//! @brief An snow particle system
|
||||||
class CC_DLL ParticleSnow : public ParticleSystemQuad
|
class CC_DLL ParticleSnow : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleSnow* create();
|
||||||
|
static ParticleSnow* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -229,16 +273,20 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleSnow(){}
|
virtual ~ParticleSnow(){}
|
||||||
bool init(){ return initWithTotalParticles(700); }
|
bool init(){ return initWithTotalParticles(700); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleSnow* create();
|
private:
|
||||||
static ParticleSnow* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
||||||
};
|
};
|
||||||
|
|
||||||
//! @brief A rain particle system
|
//! @brief A rain particle system
|
||||||
class CC_DLL ParticleRain : public ParticleSystemQuad
|
class CC_DLL ParticleRain : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
static ParticleRain* create();
|
||||||
|
static ParticleRain* createWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
protected:
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -249,10 +297,10 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual ~ParticleRain(){}
|
virtual ~ParticleRain(){}
|
||||||
bool init(){ return initWithTotalParticles(1000); }
|
bool init(){ return initWithTotalParticles(1000); }
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
static ParticleRain* create();
|
private:
|
||||||
static ParticleRain* createWithTotalParticles(unsigned int numberOfParticles);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of particle_nodes group
|
// end of particle_nodes group
|
||||||
|
|
|
@ -148,7 +148,7 @@ ParticleSystem * ParticleSystem::create(const std::string& plistFile)
|
||||||
return pRet;
|
return pRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSystem* ParticleSystem::createWithTotalParticles(unsigned int numberOfParticles)
|
ParticleSystem* ParticleSystem::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
ParticleSystem *pRet = new ParticleSystem();
|
ParticleSystem *pRet = new ParticleSystem();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||||
|
@ -425,7 +425,7 @@ bool ParticleSystem::initWithDictionary(Dictionary *dictionary, const std::strin
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
_totalParticles = numberOfParticles;
|
_totalParticles = numberOfParticles;
|
||||||
|
|
||||||
|
|
|
@ -170,38 +170,7 @@ public:
|
||||||
static ParticleSystem * create(const std::string& plistFile);
|
static ParticleSystem * create(const std::string& plistFile);
|
||||||
|
|
||||||
//! create a system with a fixed number of particles
|
//! create a system with a fixed number of particles
|
||||||
static ParticleSystem* createWithTotalParticles(unsigned int numberOfParticles);
|
static ParticleSystem* createWithTotalParticles(int numberOfParticles);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
ParticleSystem();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ParticleSystem();
|
|
||||||
|
|
||||||
/** initializes a ParticleSystem*/
|
|
||||||
bool init();
|
|
||||||
/** initializes a ParticleSystem from a plist file.
|
|
||||||
This plist files can be created manually or with Particle Designer:
|
|
||||||
http://particledesigner.71squared.com/
|
|
||||||
@since v0.99.3
|
|
||||||
*/
|
|
||||||
bool initWithFile(const std::string& plistFile);
|
|
||||||
|
|
||||||
/** initializes a QuadParticleSystem from a Dictionary.
|
|
||||||
@since v0.99.3
|
|
||||||
*/
|
|
||||||
bool initWithDictionary(Dictionary *dictionary);
|
|
||||||
|
|
||||||
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
|
||||||
@since v2.1
|
|
||||||
*/
|
|
||||||
bool initWithDictionary(Dictionary *dictionary, const std::string& dirname);
|
|
||||||
|
|
||||||
//! Initializes a system with a fixed number of particles
|
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
|
||||||
|
|
||||||
//! Add a particle to the emitter
|
//! Add a particle to the emitter
|
||||||
bool addParticle();
|
bool addParticle();
|
||||||
|
@ -393,10 +362,42 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual const BlendFunc &getBlendFunc() const override;
|
virtual const BlendFunc &getBlendFunc() const override;
|
||||||
protected:
|
|
||||||
virtual void updateBlendFunc();
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
ParticleSystem();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~ParticleSystem();
|
||||||
|
|
||||||
|
/** initializes a ParticleSystem*/
|
||||||
|
bool init();
|
||||||
|
/** initializes a ParticleSystem from a plist file.
|
||||||
|
This plist files can be created manually or with Particle Designer:
|
||||||
|
http://particledesigner.71squared.com/
|
||||||
|
@since v0.99.3
|
||||||
|
*/
|
||||||
|
bool initWithFile(const std::string& plistFile);
|
||||||
|
|
||||||
|
/** initializes a QuadParticleSystem from a Dictionary.
|
||||||
|
@since v0.99.3
|
||||||
|
*/
|
||||||
|
bool initWithDictionary(Dictionary *dictionary);
|
||||||
|
|
||||||
|
/** initializes a particle system from a NSDictionary and the path from where to load the png
|
||||||
|
@since v2.1
|
||||||
|
*/
|
||||||
|
bool initWithDictionary(Dictionary *dictionary, const std::string& dirname);
|
||||||
|
|
||||||
|
//! Initializes a system with a fixed number of particles
|
||||||
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
|
virtual void updateBlendFunc();
|
||||||
|
|
||||||
/** whether or not the particles are using blend additive.
|
/** whether or not the particles are using blend additive.
|
||||||
If enabled, the following blending function will be used.
|
If enabled, the following blending function will be used.
|
||||||
@code
|
@code
|
||||||
|
@ -551,6 +552,9 @@ protected:
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
PositionType _positionType;
|
PositionType _positionType;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of particle_nodes group
|
// end of particle_nodes group
|
||||||
|
|
|
@ -46,7 +46,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
//implementation ParticleSystemQuad
|
//implementation ParticleSystemQuad
|
||||||
// overriding the init method
|
// overriding the init method
|
||||||
bool ParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles)
|
bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
// base initialization
|
// base initialization
|
||||||
if( ParticleSystem::initWithTotalParticles(numberOfParticles) )
|
if( ParticleSystem::initWithTotalParticles(numberOfParticles) )
|
||||||
|
@ -111,27 +111,27 @@ ParticleSystemQuad::~ParticleSystemQuad()
|
||||||
|
|
||||||
// implementation ParticleSystemQuad
|
// implementation ParticleSystemQuad
|
||||||
|
|
||||||
ParticleSystemQuad * ParticleSystemQuad::create(const char *plistFile)
|
ParticleSystemQuad * ParticleSystemQuad::create(const std::string& filename)
|
||||||
{
|
{
|
||||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||||
if (pRet && pRet->initWithFile(plistFile))
|
if (ret && ret->initWithFile(filename))
|
||||||
{
|
{
|
||||||
pRet->autorelease();
|
ret->autorelease();
|
||||||
return pRet;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(pRet);
|
CC_SAFE_DELETE(ret);
|
||||||
return pRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(unsigned int numberOfParticles) {
|
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(int numberOfParticles) {
|
||||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
if (ret && ret->initWithTotalParticles(numberOfParticles))
|
||||||
{
|
{
|
||||||
pRet->autorelease();
|
ret->autorelease();
|
||||||
return pRet;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(pRet);
|
CC_SAFE_DELETE(ret);
|
||||||
return pRet;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -57,26 +57,11 @@ public:
|
||||||
/** creates a Particle Emitter */
|
/** creates a Particle Emitter */
|
||||||
static ParticleSystemQuad * create();
|
static ParticleSystemQuad * create();
|
||||||
/** creates a Particle Emitter with a number of particles */
|
/** creates a Particle Emitter with a number of particles */
|
||||||
static ParticleSystemQuad * createWithTotalParticles(unsigned int numberOfParticles);
|
static ParticleSystemQuad * createWithTotalParticles(int numberOfParticles);
|
||||||
/** creates an initializes a ParticleSystemQuad from a plist file.
|
/** creates an initializes a ParticleSystemQuad from a plist file.
|
||||||
This plist files can be created manually or with Particle Designer:
|
This plist files can be created manually or with Particle Designer:
|
||||||
*/
|
*/
|
||||||
static ParticleSystemQuad * create(const char *plistFile);
|
static ParticleSystemQuad * create(const std::string& filename);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
ParticleSystemQuad();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ParticleSystemQuad();
|
|
||||||
|
|
||||||
/** initializes the indices for the vertices*/
|
|
||||||
void initIndices();
|
|
||||||
|
|
||||||
/** initializes the texture with a rectangle measured Points */
|
|
||||||
void initTexCoordsWithRect(const Rect& rect);
|
|
||||||
|
|
||||||
/** Sets a new SpriteFrame as particle.
|
/** Sets a new SpriteFrame as particle.
|
||||||
WARNING: this method is experimental. Use setTextureWithRect instead.
|
WARNING: this method is experimental. Use setTextureWithRect instead.
|
||||||
|
@ -102,7 +87,7 @@ public:
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles) override;
|
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -134,18 +119,36 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void setTotalParticles(int tp) override;
|
virtual void setTotalParticles(int tp) override;
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
ParticleSystemQuad();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~ParticleSystemQuad();
|
||||||
|
|
||||||
|
/** initializes the indices for the vertices*/
|
||||||
|
void initIndices();
|
||||||
|
|
||||||
|
/** initializes the texture with a rectangle measured Points */
|
||||||
|
void initTexCoordsWithRect(const Rect& rect);
|
||||||
|
|
||||||
void setupVBOandVAO();
|
void setupVBOandVAO();
|
||||||
void setupVBO();
|
void setupVBO();
|
||||||
bool allocMemory();
|
bool allocMemory();
|
||||||
|
|
||||||
protected:
|
|
||||||
V3F_C4B_T2F_Quad *_quads; // quads to be rendered
|
V3F_C4B_T2F_Quad *_quads; // quads to be rendered
|
||||||
GLushort *_indices; // indices
|
GLushort *_indices; // indices
|
||||||
|
|
||||||
GLuint _VAOname;
|
GLuint _VAOname;
|
||||||
|
|
||||||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of particle_nodes group
|
// end of particle_nodes group
|
||||||
|
|
|
@ -62,18 +62,6 @@ public:
|
||||||
|
|
||||||
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
||||||
static ProgressTimer* create(Sprite* sp);
|
static ProgressTimer* create(Sprite* sp);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
ProgressTimer();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~ProgressTimer();
|
|
||||||
|
|
||||||
/** Initializes a progress timer with the sprite as the shape the timer goes through */
|
|
||||||
bool initWithSprite(Sprite* sp);
|
|
||||||
|
|
||||||
/** Change the percentage to change progress. */
|
/** Change the percentage to change progress. */
|
||||||
inline Type getType() const { return _type; }
|
inline Type getType() const { return _type; }
|
||||||
|
@ -129,6 +117,19 @@ public:
|
||||||
virtual void setOpacity(GLubyte opacity) override;
|
virtual void setOpacity(GLubyte opacity) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
ProgressTimer();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~ProgressTimer();
|
||||||
|
|
||||||
|
/** Initializes a progress timer with the sprite as the shape the timer goes through */
|
||||||
|
bool initWithSprite(Sprite* sp);
|
||||||
|
|
||||||
Tex2F textureCoordFromAlphaPoint(Point alpha);
|
Tex2F textureCoordFromAlphaPoint(Point alpha);
|
||||||
Vertex2F vertexFromAlphaPoint(Point alpha);
|
Vertex2F vertexFromAlphaPoint(Point alpha);
|
||||||
void updateProgress(void);
|
void updateProgress(void);
|
||||||
|
@ -146,6 +147,9 @@ protected:
|
||||||
V2F_C4B_T2F *_vertexData;
|
V2F_C4B_T2F *_vertexData;
|
||||||
|
|
||||||
bool _reverseDirection;
|
bool _reverseDirection;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of misc_nodes group
|
// end of misc_nodes group
|
||||||
|
|
|
@ -543,20 +543,20 @@ void RenderTexture::draw()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool RenderTexture::saveToFile(const char *szFilePath)
|
bool RenderTexture::saveToFile(const std::string& filename)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
|
|
||||||
Image *image = newImage(true);
|
Image *image = newImage(true);
|
||||||
if (image)
|
if (image)
|
||||||
{
|
{
|
||||||
ret = image->saveToFile(szFilePath);
|
ret = image->saveToFile(filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(image);
|
CC_SAFE_DELETE(image);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
bool RenderTexture::saveToFile(const char *fileName, Image::Format format)
|
bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG,
|
CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG,
|
||||||
|
|
|
@ -58,21 +58,6 @@ public:
|
||||||
|
|
||||||
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
|
/** creates a RenderTexture object with width and height in Points, pixel format is RGBA8888 */
|
||||||
static RenderTexture * create(int w, int h);
|
static RenderTexture * create(int w, int h);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
RenderTexture();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~RenderTexture();
|
|
||||||
|
|
||||||
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
|
||||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat);
|
|
||||||
|
|
||||||
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
|
|
||||||
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat, GLuint uDepthStencilFormat);
|
|
||||||
|
|
||||||
/** starts grabbing */
|
/** starts grabbing */
|
||||||
void begin();
|
void begin();
|
||||||
|
@ -114,12 +99,12 @@ public:
|
||||||
/** saves the texture into a file using JPEG format. The file will be saved in the Documents folder.
|
/** saves the texture into a file using JPEG format. The file will be saved in the Documents folder.
|
||||||
Returns true if the operation is successful.
|
Returns true if the operation is successful.
|
||||||
*/
|
*/
|
||||||
bool saveToFile(const char *szFilePath);
|
bool saveToFile(const std::string& filename);
|
||||||
|
|
||||||
/** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
|
/** saves the texture into a file. The format could be JPG or PNG. The file will be saved in the Documents folder.
|
||||||
Returns true if the operation is successful.
|
Returns true if the operation is successful.
|
||||||
*/
|
*/
|
||||||
bool saveToFile(const char *name, Image::Format format);
|
bool saveToFile(const std::string& filename, Image::Format format);
|
||||||
|
|
||||||
/** Listen "come to background" message, and save render texture.
|
/** Listen "come to background" message, and save render texture.
|
||||||
It only has effect on Android.
|
It only has effect on Android.
|
||||||
|
@ -167,10 +152,20 @@ public:
|
||||||
virtual void visit() override;
|
virtual void visit() override;
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
|
|
||||||
private:
|
public:
|
||||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
// XXX should be procted.
|
||||||
|
// but due to a bug in PowerVR + Android,
|
||||||
|
// the constructor is public again
|
||||||
|
RenderTexture();
|
||||||
|
virtual ~RenderTexture();
|
||||||
|
/** initializes a RenderTexture object with width and height in Points and a pixel format, only RGB and RGBA formats are valid */
|
||||||
|
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat);
|
||||||
|
/** initializes a RenderTexture object with width and height in Points and a pixel format( only RGB and RGBA formats are valid ) and depthStencil format*/
|
||||||
|
bool initWithWidthAndHeight(int w, int h, Texture2D::PixelFormat eFormat, GLuint uDepthStencilFormat);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||||
|
|
||||||
GLuint _FBO;
|
GLuint _FBO;
|
||||||
GLuint _depthRenderBufffer;
|
GLuint _depthRenderBufffer;
|
||||||
GLint _oldFBO;
|
GLint _oldFBO;
|
||||||
|
@ -192,6 +187,10 @@ protected:
|
||||||
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||||
*/
|
*/
|
||||||
Sprite* _sprite;
|
Sprite* _sprite;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(RenderTexture);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of textures group
|
// end of textures group
|
||||||
|
|
|
@ -56,18 +56,9 @@ public:
|
||||||
static Scene *createWithPhysics();
|
static Scene *createWithPhysics();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
Scene();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Scene();
|
|
||||||
|
|
||||||
bool init();
|
|
||||||
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
public:
|
public:
|
||||||
bool initWithPhysics();
|
|
||||||
|
|
||||||
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
|
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
|
||||||
|
|
||||||
|
@ -77,14 +68,23 @@ public:
|
||||||
virtual void update(float delta) override;
|
virtual void update(float delta) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void addChildToPhysicsWorld(Node* child);
|
bool initWithPhysics();
|
||||||
|
void addChildToPhysicsWorld(Node* child);
|
||||||
protected:
|
|
||||||
PhysicsWorld* _physicsWorld;
|
PhysicsWorld* _physicsWorld;
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
Scene();
|
||||||
|
virtual ~Scene();
|
||||||
|
bool init();
|
||||||
|
|
||||||
friend class Node;
|
friend class Node;
|
||||||
friend class SpriteBatchNode;
|
friend class SpriteBatchNode;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Scene);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of scene group
|
// end of scene group
|
||||||
|
|
|
@ -70,10 +70,10 @@ Sprite* Sprite::createWithTexture(Texture2D *texture)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect)
|
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||||
{
|
{
|
||||||
Sprite *sprite = new Sprite();
|
Sprite *sprite = new Sprite();
|
||||||
if (sprite && sprite->initWithTexture(texture, rect))
|
if (sprite && sprite->initWithTexture(texture, rect, rotated))
|
||||||
{
|
{
|
||||||
sprite->autorelease();
|
sprite->autorelease();
|
||||||
return sprite;
|
return sprite;
|
||||||
|
@ -145,7 +145,74 @@ Sprite* Sprite::create()
|
||||||
|
|
||||||
bool Sprite::init(void)
|
bool Sprite::init(void)
|
||||||
{
|
{
|
||||||
return initWithTexture(NULL, Rect::ZERO);
|
return initWithTexture(NULL, Rect::ZERO );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithTexture(Texture2D *texture)
|
||||||
|
{
|
||||||
|
CCASSERT(texture != NULL, "Invalid texture for sprite");
|
||||||
|
|
||||||
|
Rect rect = Rect::ZERO;
|
||||||
|
rect.size = texture->getContentSize();
|
||||||
|
|
||||||
|
return initWithTexture(texture, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect)
|
||||||
|
{
|
||||||
|
return initWithTexture(texture, rect, false);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithFile(const std::string& filename)
|
||||||
|
{
|
||||||
|
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
||||||
|
|
||||||
|
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
|
Rect rect = Rect::ZERO;
|
||||||
|
rect.size = texture->getContentSize();
|
||||||
|
return initWithTexture(texture, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't release here.
|
||||||
|
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||||
|
// this->release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
|
||||||
|
{
|
||||||
|
CCASSERT(filename.size()>0, "Invalid filename");
|
||||||
|
|
||||||
|
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||||
|
if (texture)
|
||||||
|
{
|
||||||
|
return initWithTexture(texture, rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
// don't release here.
|
||||||
|
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
||||||
|
// this->release();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithSpriteFrameName(const std::string& spriteFrameName)
|
||||||
|
{
|
||||||
|
CCASSERT(spriteFrameName.size() > 0, "Invalid spriteFrameName");
|
||||||
|
|
||||||
|
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
||||||
|
return initWithSpriteFrame(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
|
||||||
|
{
|
||||||
|
CCASSERT(spriteFrame != NULL, "");
|
||||||
|
|
||||||
|
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
|
||||||
|
setSpriteFrame(spriteFrame);
|
||||||
|
|
||||||
|
return bRet;
|
||||||
}
|
}
|
||||||
|
|
||||||
// designated initializer
|
// designated initializer
|
||||||
|
@ -200,99 +267,6 @@ bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sprite::initWithTexture(Texture2D *texture, const Rect& rect)
|
|
||||||
{
|
|
||||||
return initWithTexture(texture, rect, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::initWithTexture(Texture2D *texture)
|
|
||||||
{
|
|
||||||
CCASSERT(texture != NULL, "Invalid texture for sprite");
|
|
||||||
|
|
||||||
Rect rect = Rect::ZERO;
|
|
||||||
rect.size = texture->getContentSize();
|
|
||||||
|
|
||||||
return initWithTexture(texture, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::initWithFile(const std::string& filename)
|
|
||||||
{
|
|
||||||
CCASSERT(filename.size()>0, "Invalid filename for sprite");
|
|
||||||
|
|
||||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
|
||||||
if (texture)
|
|
||||||
{
|
|
||||||
Rect rect = Rect::ZERO;
|
|
||||||
rect.size = texture->getContentSize();
|
|
||||||
return initWithTexture(texture, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't release here.
|
|
||||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
|
||||||
// this->release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::initWithFile(const std::string &filename, const Rect& rect)
|
|
||||||
{
|
|
||||||
CCASSERT(filename.size()>0, "Invalid filename");
|
|
||||||
|
|
||||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
|
||||||
if (texture)
|
|
||||||
{
|
|
||||||
return initWithTexture(texture, rect);
|
|
||||||
}
|
|
||||||
|
|
||||||
// don't release here.
|
|
||||||
// when load texture failed, it's better to get a "transparent" sprite then a crashed program
|
|
||||||
// this->release();
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::initWithSpriteFrame(SpriteFrame *spriteFrame)
|
|
||||||
{
|
|
||||||
CCASSERT(spriteFrame != NULL, "");
|
|
||||||
|
|
||||||
bool bRet = initWithTexture(spriteFrame->getTexture(), spriteFrame->getRect());
|
|
||||||
setDisplayFrame(spriteFrame);
|
|
||||||
|
|
||||||
return bRet;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::initWithSpriteFrameName(const std::string& spriteFrameName)
|
|
||||||
{
|
|
||||||
CCASSERT(spriteFrameName.size() > 0, "Invalid spriteFrameName");
|
|
||||||
|
|
||||||
SpriteFrame *frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
|
|
||||||
return initWithSpriteFrame(frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
// XXX: deprecated
|
|
||||||
/*
|
|
||||||
Sprite* Sprite::initWithCGImage(CGImageRef pImage)
|
|
||||||
{
|
|
||||||
// todo
|
|
||||||
// because it is deprecated, so we do not implement it
|
|
||||||
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
Sprite* Sprite::initWithCGImage(CGImageRef pImage, const char *pszKey)
|
|
||||||
{
|
|
||||||
CCASSERT(pImage != NULL);
|
|
||||||
|
|
||||||
// XXX: possible bug. See issue #349. New API should be added
|
|
||||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addCGImage(pImage, pszKey);
|
|
||||||
|
|
||||||
const Size& size = texture->getContentSize();
|
|
||||||
Rect rect = Rect(0 ,0, size.width, size.height);
|
|
||||||
|
|
||||||
return initWithTexture(texture, rect);
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
Sprite::Sprite(void)
|
Sprite::Sprite(void)
|
||||||
: _shouldBeHidden(false)
|
: _shouldBeHidden(false)
|
||||||
, _texture(nullptr)
|
, _texture(nullptr)
|
||||||
|
@ -304,12 +278,83 @@ Sprite::~Sprite(void)
|
||||||
CC_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Texture methods
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This array is the data of a white image with 2 by 2 dimension.
|
||||||
|
* It's used for creating a default texture when sprite's texture is set to NULL.
|
||||||
|
* Supposing codes as follows:
|
||||||
|
*
|
||||||
|
* auto sp = new Sprite();
|
||||||
|
* sp->init(); // Texture was set to NULL, in order to make opacity and color to work correctly, we need to create a 2x2 white texture.
|
||||||
|
*
|
||||||
|
* The test is in "TestCpp/SpriteTest/Sprite without texture".
|
||||||
|
*/
|
||||||
|
static unsigned char cc_2x2_white_image[] = {
|
||||||
|
// RGBA8888
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF,
|
||||||
|
0xFF, 0xFF, 0xFF, 0xFF
|
||||||
|
};
|
||||||
|
|
||||||
|
#define CC_2x2_WHITE_IMAGE_KEY "/cc_2x2_white_image"
|
||||||
|
|
||||||
|
void Sprite::setTexture(const std::string &filename)
|
||||||
|
{
|
||||||
|
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||||
|
setTexture(texture);
|
||||||
|
|
||||||
|
Rect rect = Rect::ZERO;
|
||||||
|
rect.size = texture->getContentSize();
|
||||||
|
setTextureRect(rect);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::setTexture(Texture2D *texture)
|
||||||
|
{
|
||||||
|
// If batchnode, then texture id should be the same
|
||||||
|
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
|
||||||
|
// accept texture==nil as argument
|
||||||
|
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
|
||||||
|
|
||||||
|
if (texture == nullptr)
|
||||||
|
{
|
||||||
|
// Gets the texture by key firstly.
|
||||||
|
texture = Director::getInstance()->getTextureCache()->getTextureForKey(CC_2x2_WHITE_IMAGE_KEY);
|
||||||
|
|
||||||
|
// If texture wasn't in cache, create it from RAW data.
|
||||||
|
if (texture == nullptr)
|
||||||
|
{
|
||||||
|
Image* image = new Image();
|
||||||
|
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
|
||||||
|
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
|
||||||
|
|
||||||
|
texture = Director::getInstance()->getTextureCache()->addImage(image, CC_2x2_WHITE_IMAGE_KEY);
|
||||||
|
CC_SAFE_RELEASE(image);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_batchNode && _texture != texture)
|
||||||
|
{
|
||||||
|
CC_SAFE_RETAIN(texture);
|
||||||
|
CC_SAFE_RELEASE(_texture);
|
||||||
|
_texture = texture;
|
||||||
|
updateBlendFunc();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Texture2D* Sprite::getTexture() const
|
||||||
|
{
|
||||||
|
return _texture;
|
||||||
|
}
|
||||||
|
|
||||||
void Sprite::setTextureRect(const Rect& rect)
|
void Sprite::setTextureRect(const Rect& rect)
|
||||||
{
|
{
|
||||||
setTextureRect(rect, false, rect.size);
|
setTextureRect(rect, false, rect.size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize)
|
void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize)
|
||||||
{
|
{
|
||||||
_rectRotated = rotated;
|
_rectRotated = rotated;
|
||||||
|
@ -614,7 +659,7 @@ void Sprite::draw(void)
|
||||||
|
|
||||||
// Node overrides
|
// Node overrides
|
||||||
|
|
||||||
void Sprite::addChild(Node* child)
|
void Sprite::addChild(Node *child)
|
||||||
{
|
{
|
||||||
Node::addChild(child);
|
Node::addChild(child);
|
||||||
}
|
}
|
||||||
|
@ -673,7 +718,6 @@ void Sprite::removeChild(Node *child, bool cleanup)
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::removeChild(child, cleanup);
|
Node::removeChild(child, cleanup);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::removeAllChildrenWithCleanup(bool cleanup)
|
void Sprite::removeAllChildrenWithCleanup(bool cleanup)
|
||||||
|
@ -982,20 +1026,30 @@ void Sprite::updateDisplayedOpacity(GLubyte opacity)
|
||||||
|
|
||||||
// Frames
|
// Frames
|
||||||
|
|
||||||
void Sprite::setDisplayFrame(SpriteFrame *pNewFrame)
|
void Sprite::setSpriteFrame(const std::string &spriteFrameName)
|
||||||
{
|
{
|
||||||
_unflippedOffsetPositionFromCenter = pNewFrame->getOffset();
|
SpriteFrameCache *cache = SpriteFrameCache::getInstance();
|
||||||
|
SpriteFrame *spriteFrame = cache->getSpriteFrameByName(spriteFrameName);
|
||||||
|
|
||||||
Texture2D *pNewTexture = pNewFrame->getTexture();
|
CCASSERT(spriteFrame, "Invalid spriteFrameName");
|
||||||
|
|
||||||
|
setSpriteFrame(spriteFrame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::setSpriteFrame(SpriteFrame *spriteFrame)
|
||||||
|
{
|
||||||
|
_unflippedOffsetPositionFromCenter = spriteFrame->getOffset();
|
||||||
|
|
||||||
|
Texture2D *texture = spriteFrame->getTexture();
|
||||||
// update texture before updating texture rect
|
// update texture before updating texture rect
|
||||||
if (pNewTexture != _texture)
|
if (texture != _texture)
|
||||||
{
|
{
|
||||||
setTexture(pNewTexture);
|
setTexture(texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
// update rect
|
// update rect
|
||||||
_rectRotated = pNewFrame->isRotated();
|
_rectRotated = spriteFrame->isRotated();
|
||||||
setTextureRect(pNewFrame->getRect(), _rectRotated, pNewFrame->getOriginalSize());
|
setTextureRect(spriteFrame->getRect(), _rectRotated, spriteFrame->getOriginalSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName, int frameIndex)
|
void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName, int frameIndex)
|
||||||
|
@ -1010,7 +1064,7 @@ void Sprite::setDisplayFrameWithAnimationName(const std::string& animationName,
|
||||||
|
|
||||||
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
|
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
|
||||||
|
|
||||||
setDisplayFrame(frame->getSpriteFrame());
|
setSpriteFrame(frame->getSpriteFrame());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
||||||
|
@ -1022,7 +1076,7 @@ bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
||||||
frame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
frame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
||||||
}
|
}
|
||||||
|
|
||||||
SpriteFrame* Sprite::getDisplayFrame()
|
SpriteFrame* Sprite::getSpriteFrame() const
|
||||||
{
|
{
|
||||||
return SpriteFrame::createWithTexture(_texture,
|
return SpriteFrame::createWithTexture(_texture,
|
||||||
CC_RECT_POINTS_TO_PIXELS(_rect),
|
CC_RECT_POINTS_TO_PIXELS(_rect),
|
||||||
|
@ -1083,62 +1137,4 @@ void Sprite::updateBlendFunc(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* This array is the data of a white image with 2 by 2 dimension.
|
|
||||||
* It's used for creating a default texture when sprite's texture is set to NULL.
|
|
||||||
* Supposing codes as follows:
|
|
||||||
*
|
|
||||||
* auto sp = new Sprite();
|
|
||||||
* sp->init(); // Texture was set to NULL, in order to make opacity and color to work correctly, we need to create a 2x2 white texture.
|
|
||||||
*
|
|
||||||
* The test is in "TestCpp/SpriteTest/Sprite without texture".
|
|
||||||
*/
|
|
||||||
static unsigned char cc_2x2_white_image[] = {
|
|
||||||
// RGBA8888
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF,
|
|
||||||
0xFF, 0xFF, 0xFF, 0xFF
|
|
||||||
};
|
|
||||||
|
|
||||||
#define CC_2x2_WHITE_IMAGE_KEY "/cc_2x2_white_image"
|
|
||||||
|
|
||||||
void Sprite::setTexture(Texture2D *texture)
|
|
||||||
{
|
|
||||||
// If batchnode, then texture id should be the same
|
|
||||||
CCASSERT(! _batchNode || texture->getName() == _batchNode->getTexture()->getName(), "CCSprite: Batched sprites should use the same texture as the batchnode");
|
|
||||||
// accept texture==nil as argument
|
|
||||||
CCASSERT( !texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
|
|
||||||
|
|
||||||
if (NULL == texture)
|
|
||||||
{
|
|
||||||
// Gets the texture by key firstly.
|
|
||||||
texture = Director::getInstance()->getTextureCache()->getTextureForKey(CC_2x2_WHITE_IMAGE_KEY);
|
|
||||||
|
|
||||||
// If texture wasn't in cache, create it from RAW data.
|
|
||||||
if (NULL == texture)
|
|
||||||
{
|
|
||||||
Image* image = new Image();
|
|
||||||
bool isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
|
|
||||||
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
|
|
||||||
|
|
||||||
texture = Director::getInstance()->getTextureCache()->addImage(image, CC_2x2_WHITE_IMAGE_KEY);
|
|
||||||
CC_SAFE_RELEASE(image);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!_batchNode && _texture != texture)
|
|
||||||
{
|
|
||||||
CC_SAFE_RETAIN(texture);
|
|
||||||
CC_SAFE_RELEASE(_texture);
|
|
||||||
_texture = texture;
|
|
||||||
updateBlendFunc();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Texture2D* Sprite::getTexture(void) const
|
|
||||||
{
|
|
||||||
return _texture;
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -78,9 +78,6 @@ struct transformValues_;
|
||||||
* The default anchorPoint in Sprite is (0.5, 0.5).
|
* The default anchorPoint in Sprite is (0.5, 0.5).
|
||||||
*/
|
*/
|
||||||
class CC_DLL Sprite : public NodeRGBA, public TextureProtocol
|
class CC_DLL Sprite : public NodeRGBA, public TextureProtocol
|
||||||
#ifdef EMSCRIPTEN
|
|
||||||
, public GLBufferedNode
|
|
||||||
#endif // EMSCRIPTEN
|
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -133,9 +130,10 @@ public:
|
||||||
* @param texture A pointer to an existing Texture2D object.
|
* @param texture A pointer to an existing Texture2D object.
|
||||||
* You can use a Texture2D object for many sprites.
|
* You can use a Texture2D object for many sprites.
|
||||||
* @param rect Only the contents inside the rect of this texture will be applied for this sprite.
|
* @param rect Only the contents inside the rect of this texture will be applied for this sprite.
|
||||||
|
* @param rotated Whether or not the rect is rotated
|
||||||
* @return A valid sprite object that is marked as autoreleased.
|
* @return A valid sprite object that is marked as autoreleased.
|
||||||
*/
|
*/
|
||||||
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect);
|
static Sprite* createWithTexture(Texture2D *texture, const Rect& rect, bool rotated=false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a sprite with an sprite frame.
|
* Creates a sprite with an sprite frame.
|
||||||
|
@ -159,113 +157,6 @@ public:
|
||||||
/// @} end of creators group
|
/// @} end of creators group
|
||||||
|
|
||||||
|
|
||||||
/// @{
|
|
||||||
/// @name Initializers
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default constructor
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
Sprite(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Default destructor
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~Sprite(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes an empty sprite with nothing init.
|
|
||||||
*/
|
|
||||||
virtual bool init(void);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with a texture.
|
|
||||||
*
|
|
||||||
* After initialization, the rect used will be the size of the texture, and the offset will be (0,0).
|
|
||||||
*
|
|
||||||
* @param texture A pointer to an existing Texture2D object.
|
|
||||||
* You can use a Texture2D object for many sprites.
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool initWithTexture(Texture2D *texture);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with a texture and a rect.
|
|
||||||
*
|
|
||||||
* After initialization, the offset will be (0,0).
|
|
||||||
*
|
|
||||||
* @param texture A pointer to an exisiting Texture2D object.
|
|
||||||
* You can use a Texture2D object for many sprites.
|
|
||||||
* @param rect Only the contents inside rect of this texture will be applied for this sprite.
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with a texture and a rect in points, optionally rotated.
|
|
||||||
*
|
|
||||||
* After initialization, the offset will be (0,0).
|
|
||||||
* @note This is the designated initializer.
|
|
||||||
*
|
|
||||||
* @param texture A Texture2D object whose texture will be applied to this sprite.
|
|
||||||
* @param rect A rectangle assigned the contents of texture.
|
|
||||||
* @param rotated Whether or not the texture rectangle is rotated.
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool initWithTexture(Texture2D *texture, const Rect& rect, bool rotated);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with an SpriteFrame. The texture and rect in SpriteFrame will be applied on this sprite
|
|
||||||
*
|
|
||||||
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with an sprite frame name.
|
|
||||||
*
|
|
||||||
* A SpriteFrame will be fetched from the SpriteFrameCache by name.
|
|
||||||
* If the SpriteFrame doesn't exist it will raise an exception.
|
|
||||||
*
|
|
||||||
* @param spriteFrameName A key string that can fected a volid SpriteFrame from SpriteFrameCache
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
*/
|
|
||||||
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with an image filename.
|
|
||||||
*
|
|
||||||
* This method will find filename from local file system, load its content to Texture2D,
|
|
||||||
* then use Texture2D to create a sprite.
|
|
||||||
* After initialization, the rect used will be the size of the image. The offset will be (0,0).
|
|
||||||
*
|
|
||||||
* @param filename The path to an image file in local file system
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
* @js init
|
|
||||||
* @lua init
|
|
||||||
*/
|
|
||||||
virtual bool initWithFile(const std::string& filename);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Initializes a sprite with an image filename, and a rect.
|
|
||||||
*
|
|
||||||
* This method will find filename from local file system, load its content to Texture2D,
|
|
||||||
* then use Texture2D to create a sprite.
|
|
||||||
* After initialization, the offset will be (0,0).
|
|
||||||
*
|
|
||||||
* @param filename The path to an image file in local file system.
|
|
||||||
* @param rect The rectangle assigned the content area from texture.
|
|
||||||
* @return true if the sprite is initialized properly, false otherwise.
|
|
||||||
* @js init
|
|
||||||
* @lua init
|
|
||||||
*/
|
|
||||||
virtual bool initWithFile(const std::string& filename, const Rect& rect);
|
|
||||||
|
|
||||||
/// @} end of initializers
|
|
||||||
|
|
||||||
/// @{
|
/// @{
|
||||||
/// @name BatchNode methods
|
/// @name BatchNode methods
|
||||||
|
|
||||||
|
@ -298,7 +189,21 @@ public:
|
||||||
|
|
||||||
|
|
||||||
/// @{
|
/// @{
|
||||||
/// @name Texture methods
|
/// @name Texture / Frame methods
|
||||||
|
|
||||||
|
/** Sets a new texture (from a filename) to the sprite.
|
||||||
|
It will call `setTextureRect()` with the texture's content size.
|
||||||
|
TODO: The whole Sprite API needs to be reviewed.
|
||||||
|
*/
|
||||||
|
virtual void setTexture(const std::string &filename );
|
||||||
|
|
||||||
|
/** Sets a new texture to the sprite.
|
||||||
|
The Texture's rect is not changed.
|
||||||
|
*/
|
||||||
|
virtual void setTexture(Texture2D *texture) override;
|
||||||
|
|
||||||
|
/** returns the Texture2D object used by the sprite */
|
||||||
|
virtual Texture2D* getTexture() const override;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Updates the texture rect of the Sprite in points.
|
* Updates the texture rect of the Sprite in points.
|
||||||
|
@ -320,30 +225,28 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void setVertexRect(const Rect& rect);
|
virtual void setVertexRect(const Rect& rect);
|
||||||
|
|
||||||
/// @} end of texture methods
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// @{
|
|
||||||
/// @name Frames methods
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets a new display frame to the Sprite.
|
* Sets a new SpriteFrame to the Sprite.
|
||||||
*/
|
*/
|
||||||
virtual void setDisplayFrame(SpriteFrame *pNewFrame);
|
virtual void setSpriteFrame(SpriteFrame* newFrame);
|
||||||
|
virtual void setSpriteFrame(const std::string &spriteFrameName);
|
||||||
|
|
||||||
|
/** @deprecated Use `setSpriteFrame()` instead. */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE virtual void setDisplayFrame(SpriteFrame *newFrame) { setSpriteFrame(newFrame); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns whether or not a SpriteFrame is being displayed
|
* Returns whether or not a SpriteFrame is being displayed
|
||||||
*/
|
*/
|
||||||
virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
|
virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
|
||||||
|
|
||||||
/** @deprecated Use getDisplayFrame() instead */
|
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() { return getDisplayFrame(); };
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the current displayed frame.
|
* Returns the current displayed frame.
|
||||||
*/
|
*/
|
||||||
virtual SpriteFrame* getDisplayFrame();
|
virtual SpriteFrame* getSpriteFrame() const;
|
||||||
|
/** @deprecated Use `getSpriteFrame()` instead */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* getDisplayFrame() const { return getSpriteFrame(); }
|
||||||
|
/** @deprecated Use `getSpriteFrame()` instead */
|
||||||
|
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() const { return getSpriteFrame(); };
|
||||||
|
|
||||||
/// @} End of frames methods
|
/// @} End of frames methods
|
||||||
|
|
||||||
|
@ -473,8 +376,6 @@ public:
|
||||||
//
|
//
|
||||||
/// @{
|
/// @{
|
||||||
/// @name Functions inherited from TextureProtocol
|
/// @name Functions inherited from TextureProtocol
|
||||||
virtual void setTexture(Texture2D *texture) override;
|
|
||||||
virtual Texture2D* getTexture() const override;
|
|
||||||
/**
|
/**
|
||||||
*@code
|
*@code
|
||||||
*When this function bound into js or lua,the parameter will be changed
|
*When this function bound into js or lua,the parameter will be changed
|
||||||
|
@ -508,8 +409,10 @@ public:
|
||||||
virtual void removeChild(Node* child, bool cleanup) override;
|
virtual void removeChild(Node* child, bool cleanup) override;
|
||||||
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
||||||
virtual void reorderChild(Node *child, int zOrder) override;
|
virtual void reorderChild(Node *child, int zOrder) override;
|
||||||
virtual void addChild(Node *child) override;
|
// Should also override addChild(Node*) and addChild(Node*, int), or binding generator will only
|
||||||
virtual void addChild(Node *child, int zOrder) override;
|
// bind addChild(Node*, int, int);
|
||||||
|
virtual void addChild(Node* child) override;
|
||||||
|
virtual void addChild(Node* child, int zOrder) override;
|
||||||
virtual void addChild(Node *child, int zOrder, int tag) override;
|
virtual void addChild(Node *child, int zOrder, int tag) override;
|
||||||
virtual void sortAllChildren() override;
|
virtual void sortAllChildren() override;
|
||||||
virtual void setScale(float scale) override;
|
virtual void setScale(float scale) override;
|
||||||
|
@ -531,6 +434,97 @@ public:
|
||||||
/// @}
|
/// @}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
Sprite(void);
|
||||||
|
virtual ~Sprite(void);
|
||||||
|
|
||||||
|
/* Initializes an empty sprite with nothing init. */
|
||||||
|
virtual bool init(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with a texture.
|
||||||
|
*
|
||||||
|
* After initialization, the rect used will be the size of the texture, and the offset will be (0,0).
|
||||||
|
*
|
||||||
|
* @param texture A pointer to an existing Texture2D object.
|
||||||
|
* You can use a Texture2D object for many sprites.
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool initWithTexture(Texture2D *texture);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with a texture and a rect.
|
||||||
|
*
|
||||||
|
* After initialization, the offset will be (0,0).
|
||||||
|
*
|
||||||
|
* @param texture A pointer to an exisiting Texture2D object.
|
||||||
|
* You can use a Texture2D object for many sprites.
|
||||||
|
* @param rect Only the contents inside rect of this texture will be applied for this sprite.
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool initWithTexture(Texture2D *texture, const Rect& rect);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with a texture and a rect in points, optionally rotated.
|
||||||
|
*
|
||||||
|
* After initialization, the offset will be (0,0).
|
||||||
|
* @note This is the designated initializer.
|
||||||
|
*
|
||||||
|
* @param texture A Texture2D object whose texture will be applied to this sprite.
|
||||||
|
* @param rect A rectangle assigned the contents of texture.
|
||||||
|
* @param rotated Whether or not the texture rectangle is rotated.
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool initWithTexture(Texture2D *texture, const Rect& rect, bool rotated);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with an SpriteFrame. The texture and rect in SpriteFrame will be applied on this sprite
|
||||||
|
*
|
||||||
|
* @param pSpriteFrame A SpriteFrame object. It should includes a valid texture and a rect
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool initWithSpriteFrame(SpriteFrame *pSpriteFrame);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with an sprite frame name.
|
||||||
|
*
|
||||||
|
* A SpriteFrame will be fetched from the SpriteFrameCache by name.
|
||||||
|
* If the SpriteFrame doesn't exist it will raise an exception.
|
||||||
|
*
|
||||||
|
* @param spriteFrameName A key string that can fected a volid SpriteFrame from SpriteFrameCache
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
*/
|
||||||
|
virtual bool initWithSpriteFrameName(const std::string& spriteFrameName);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with an image filename.
|
||||||
|
*
|
||||||
|
* This method will find filename from local file system, load its content to Texture2D,
|
||||||
|
* then use Texture2D to create a sprite.
|
||||||
|
* After initialization, the rect used will be the size of the image. The offset will be (0,0).
|
||||||
|
*
|
||||||
|
* @param filename The path to an image file in local file system
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
* @js init
|
||||||
|
* @lua init
|
||||||
|
*/
|
||||||
|
virtual bool initWithFile(const std::string& filename);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initializes a sprite with an image filename, and a rect.
|
||||||
|
*
|
||||||
|
* This method will find filename from local file system, load its content to Texture2D,
|
||||||
|
* then use Texture2D to create a sprite.
|
||||||
|
* After initialization, the offset will be (0,0).
|
||||||
|
*
|
||||||
|
* @param filename The path to an image file in local file system.
|
||||||
|
* @param rect The rectangle assigned the content area from texture.
|
||||||
|
* @return true if the sprite is initialized properly, false otherwise.
|
||||||
|
* @js init
|
||||||
|
* @lua init
|
||||||
|
*/
|
||||||
|
virtual bool initWithFile(const std::string& filename, const Rect& rect);
|
||||||
|
|
||||||
void updateColor(void);
|
void updateColor(void);
|
||||||
virtual void setTextureCoords(Rect rect);
|
virtual void setTextureCoords(Rect rect);
|
||||||
virtual void updateBlendFunc(void);
|
virtual void updateBlendFunc(void);
|
||||||
|
@ -575,8 +569,11 @@ protected:
|
||||||
bool _opacityModifyRGB;
|
bool _opacityModifyRGB;
|
||||||
|
|
||||||
// image is flipped
|
// image is flipped
|
||||||
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
||||||
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(Sprite);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -294,9 +294,9 @@ Sprite* TMXLayer::reusedTileWithRect(Rect rect)
|
||||||
{
|
{
|
||||||
if (! _reusedTile)
|
if (! _reusedTile)
|
||||||
{
|
{
|
||||||
_reusedTile = new Sprite();
|
_reusedTile = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||||
_reusedTile->initWithTexture(_textureAtlas->getTexture(), rect, false);
|
|
||||||
_reusedTile->setBatchNode(this);
|
_reusedTile->setBatchNode(this);
|
||||||
|
_reusedTile->retain();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -335,8 +335,7 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
||||||
Rect rect = _tileSet->rectForGID(gid);
|
Rect rect = _tileSet->rectForGID(gid);
|
||||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||||
|
|
||||||
tile = new Sprite();
|
tile = Sprite::createWithTexture(this->getTexture(), rect);
|
||||||
tile->initWithTexture(this->getTexture(), rect);
|
|
||||||
tile->setBatchNode(this);
|
tile->setBatchNode(this);
|
||||||
tile->setPosition(getPositionAt(pos));
|
tile->setPosition(getPositionAt(pos));
|
||||||
tile->setVertexZ((float)getVertexZForPos(pos));
|
tile->setVertexZ((float)getVertexZForPos(pos));
|
||||||
|
@ -345,7 +344,6 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
||||||
|
|
||||||
unsigned int indexForZ = atlasIndexForExistantZ(z);
|
unsigned int indexForZ = atlasIndexForExistantZ(z);
|
||||||
this->addSpriteWithoutQuad(tile, indexForZ, z);
|
this->addSpriteWithoutQuad(tile, indexForZ, z);
|
||||||
tile->release();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -109,28 +109,12 @@ object->getProperty(name_of_the_property);
|
||||||
class CC_DLL TMXTiledMap : public Node
|
class CC_DLL TMXTiledMap : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TMXTiledMap();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TMXTiledMap();
|
|
||||||
|
|
||||||
/** creates a TMX Tiled Map with a TMX file.*/
|
/** creates a TMX Tiled Map with a TMX file.*/
|
||||||
static TMXTiledMap* create(const std::string& tmxFile);
|
static TMXTiledMap* create(const std::string& tmxFile);
|
||||||
|
|
||||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||||
static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
static TMXTiledMap* createWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||||
|
|
||||||
/** initializes a TMX Tiled Map with a TMX file */
|
|
||||||
bool initWithTMXFile(const std::string& tmxFile);
|
|
||||||
|
|
||||||
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
|
||||||
bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
|
|
||||||
|
|
||||||
/** return the TMXLayer for the specific layer */
|
/** return the TMXLayer for the specific layer */
|
||||||
TMXLayer* getLayer(const std::string& layerName) const;
|
TMXLayer* getLayer(const std::string& layerName) const;
|
||||||
/**
|
/**
|
||||||
|
@ -187,11 +171,27 @@ public:
|
||||||
_properties = properties;
|
_properties = properties;
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
protected:
|
||||||
|
/**
|
||||||
|
* @js ctor
|
||||||
|
*/
|
||||||
|
TMXTiledMap();
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
|
virtual ~TMXTiledMap();
|
||||||
|
|
||||||
|
/** initializes a TMX Tiled Map with a TMX file */
|
||||||
|
bool initWithTMXFile(const std::string& tmxFile);
|
||||||
|
|
||||||
|
/** initializes a TMX Tiled Map with a TMX formatted XML string and a path to TMX resources */
|
||||||
|
bool initWithXML(const std::string& tmxString, const std::string& resourcePath);
|
||||||
|
|
||||||
TMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
TMXLayer * parseLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||||
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||||
void buildWithMapInfo(TMXMapInfo* mapInfo);
|
void buildWithMapInfo(TMXMapInfo* mapInfo);
|
||||||
protected:
|
|
||||||
/** the map's size property measured in tiles */
|
/** the map's size property measured in tiles */
|
||||||
Size _mapSize;
|
Size _mapSize;
|
||||||
/** the tiles's size property measured in pixels */
|
/** the tiles's size property measured in pixels */
|
||||||
|
@ -206,6 +206,9 @@ protected:
|
||||||
//! tile properties
|
//! tile properties
|
||||||
Dictionary* _tileProperties;
|
Dictionary* _tileProperties;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of tilemap_parallax_nodes group
|
// end of tilemap_parallax_nodes group
|
||||||
|
|
|
@ -25,7 +25,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "CCTMXXMLParser.h"
|
#include "CCTMXXMLParser.h"
|
||||||
#include "CCTMXTiledMap.h"
|
#include "CCTMXTiledMap.h"
|
||||||
|
@ -38,11 +38,11 @@ using namespace std;
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
static const char* valueForKey(const char *key, std::map<std::string, std::string>* dict)
|
static const char* valueForKey(const char *key, std::unordered_map<std::string, std::string>* dict)
|
||||||
{
|
{
|
||||||
if (dict)
|
if (dict)
|
||||||
{
|
{
|
||||||
std::map<std::string, std::string>::iterator it = dict->find(key);
|
std::unordered_map<std::string, std::string>::iterator it = dict->find(key);
|
||||||
return it!=dict->end() ? it->second.c_str() : "";
|
return it!=dict->end() ? it->second.c_str() : "";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
|
@ -244,7 +244,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
||||||
CC_UNUSED_PARAM(ctx);
|
CC_UNUSED_PARAM(ctx);
|
||||||
TMXMapInfo *pTMXMapInfo = this;
|
TMXMapInfo *pTMXMapInfo = this;
|
||||||
std::string elementName = (char*)name;
|
std::string elementName = (char*)name;
|
||||||
std::map<std::string, std::string> *attributeDict = new std::map<std::string, std::string>();
|
std::unordered_map<std::string, std::string> *attributeDict = new std::unordered_map<std::string, std::string>();
|
||||||
if (atts && atts[0])
|
if (atts && atts[0])
|
||||||
{
|
{
|
||||||
for(int i = 0; atts[i]; i += 2)
|
for(int i = 0; atts[i]; i += 2)
|
||||||
|
|
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
#include "CCGeometry.h"
|
#include "CCGeometry.h"
|
||||||
|
|
|
@ -162,10 +162,6 @@ void TextureCache::loadImage()
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// create autorelease pool for iOS
|
|
||||||
Thread thread;
|
|
||||||
thread.createAutoreleasePool();
|
|
||||||
|
|
||||||
std::queue<AsyncStruct*> *pQueue = _asyncStructQueue;
|
std::queue<AsyncStruct*> *pQueue = _asyncStructQueue;
|
||||||
_asyncStructQueueMutex.lock();
|
_asyncStructQueueMutex.lock();
|
||||||
if (pQueue->empty())
|
if (pQueue->empty())
|
||||||
|
|
|
@ -36,7 +36,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
// implementation TileMapAtlas
|
// implementation TileMapAtlas
|
||||||
|
|
||||||
TileMapAtlas * TileMapAtlas::create(const char *tile, const char *mapFile, int tileWidth, int tileHeight)
|
TileMapAtlas * TileMapAtlas::create(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight)
|
||||||
{
|
{
|
||||||
TileMapAtlas *pRet = new TileMapAtlas();
|
TileMapAtlas *pRet = new TileMapAtlas();
|
||||||
if (pRet->initWithTileFile(tile, mapFile, tileWidth, tileHeight))
|
if (pRet->initWithTileFile(tile, mapFile, tileWidth, tileHeight))
|
||||||
|
@ -48,7 +48,7 @@ TileMapAtlas * TileMapAtlas::create(const char *tile, const char *mapFile, int t
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileMapAtlas::initWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight)
|
bool TileMapAtlas::initWithTileFile(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight)
|
||||||
{
|
{
|
||||||
this->loadTGAfile(mapFile);
|
this->loadTGAfile(mapFile);
|
||||||
this->calculateItemsToRender();
|
this->calculateItemsToRender();
|
||||||
|
@ -111,10 +111,8 @@ void TileMapAtlas::calculateItemsToRender()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TileMapAtlas::loadTGAfile(const char *file)
|
void TileMapAtlas::loadTGAfile(const std::string& file)
|
||||||
{
|
{
|
||||||
CCASSERT( file != NULL, "file must be non-nil");
|
|
||||||
|
|
||||||
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(file);
|
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(file);
|
||||||
|
|
||||||
// //Find the path of the file
|
// //Find the path of the file
|
||||||
|
|
|
@ -60,7 +60,7 @@ public:
|
||||||
/** creates a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
/** creates a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
||||||
The tile file will be loaded using the TextureMgr.
|
The tile file will be loaded using the TextureMgr.
|
||||||
*/
|
*/
|
||||||
static TileMapAtlas * create(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
static TileMapAtlas * create(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
|
||||||
/**
|
/**
|
||||||
* @js ctor
|
* @js ctor
|
||||||
*/
|
*/
|
||||||
|
@ -74,7 +74,7 @@ public:
|
||||||
/** initializes a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
/** initializes a TileMap with a tile file (atlas) with a map file and the width and height of each tile in points.
|
||||||
The file will be loaded using the TextureMgr.
|
The file will be loaded using the TextureMgr.
|
||||||
*/
|
*/
|
||||||
bool initWithTileFile(const char *tile, const char *mapFile, int tileWidth, int tileHeight);
|
bool initWithTileFile(const std::string& tile, const std::string& mapFile, int tileWidth, int tileHeight);
|
||||||
/** returns a tile from position x,y.
|
/** returns a tile from position x,y.
|
||||||
For the moment only channel R is used
|
For the moment only channel R is used
|
||||||
*/
|
*/
|
||||||
|
@ -89,13 +89,14 @@ public:
|
||||||
|
|
||||||
inline struct sImageTGA* getTGAInfo() const { return _TGAInfo; };
|
inline struct sImageTGA* getTGAInfo() const { return _TGAInfo; };
|
||||||
inline void setTGAInfo(struct sImageTGA* TGAInfo) { _TGAInfo = TGAInfo; };
|
inline void setTGAInfo(struct sImageTGA* TGAInfo) { _TGAInfo = TGAInfo; };
|
||||||
private:
|
|
||||||
void loadTGAfile(const char *file);
|
protected:
|
||||||
|
void loadTGAfile(const std::string& file);
|
||||||
void calculateItemsToRender();
|
void calculateItemsToRender();
|
||||||
void updateAtlasValueAt(const Point& pos, const Color3B& value, int index);
|
void updateAtlasValueAt(const Point& pos, const Color3B& value, int index);
|
||||||
void updateAtlasValues();
|
void updateAtlasValues();
|
||||||
|
|
||||||
protected:
|
|
||||||
//! x,y to atlas dictionary
|
//! x,y to atlas dictionary
|
||||||
Dictionary* _posToAtlasIndex;
|
Dictionary* _posToAtlasIndex;
|
||||||
//! numbers of tiles to render
|
//! numbers of tiles to render
|
||||||
|
|
|
@ -77,7 +77,6 @@ bool TransitionScene::initWithDuration(float t, Scene *scene)
|
||||||
if (_outScene == NULL)
|
if (_outScene == NULL)
|
||||||
{
|
{
|
||||||
_outScene = Scene::create();
|
_outScene = Scene::create();
|
||||||
_outScene->init();
|
|
||||||
}
|
}
|
||||||
_outScene->retain();
|
_outScene->retain();
|
||||||
|
|
||||||
|
|
|
@ -79,18 +79,6 @@ public:
|
||||||
|
|
||||||
/** creates a base transition with duration and incoming scene */
|
/** creates a base transition with duration and incoming scene */
|
||||||
static TransitionScene * create(float t, Scene *scene);
|
static TransitionScene * create(float t, Scene *scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionScene();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionScene();
|
|
||||||
|
|
||||||
/** initializes a transition with duration and incoming scene */
|
|
||||||
bool initWithDuration(float t,Scene* scene);
|
|
||||||
|
|
||||||
/** called after the transition finishes */
|
/** called after the transition finishes */
|
||||||
void finish(void);
|
void finish(void);
|
||||||
|
@ -102,30 +90,27 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onExit() override;
|
virtual void onExit() override;
|
||||||
virtual void cleanup() override;
|
virtual void cleanup() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual void sceneOrder();
|
TransitionScene();
|
||||||
|
virtual ~TransitionScene();
|
||||||
|
/** initializes a transition with duration and incoming scene */
|
||||||
|
bool initWithDuration(float t,Scene* scene);
|
||||||
|
|
||||||
private:
|
virtual void sceneOrder();
|
||||||
void setNewScene(float dt);
|
void setNewScene(float dt);
|
||||||
|
|
||||||
protected:
|
Scene *_inScene;
|
||||||
Scene * _inScene;
|
Scene *_outScene;
|
||||||
Scene * _outScene;
|
float _duration;
|
||||||
float _duration;
|
bool _isInSceneOnTop;
|
||||||
bool _isInSceneOnTop;
|
bool _isSendCleanupToScene;
|
||||||
bool _isSendCleanupToScene;
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionScene);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief A Transition that supports orientation like.
|
/** @brief A Transition that supports orientation like.
|
||||||
|
@ -136,21 +121,18 @@ class CC_DLL TransitionSceneOriented : public TransitionScene
|
||||||
public:
|
public:
|
||||||
/** creates a base transition with duration and incoming scene */
|
/** creates a base transition with duration and incoming scene */
|
||||||
static TransitionSceneOriented * create(float t,Scene* scene, Orientation orientation);
|
static TransitionSceneOriented * create(float t,Scene* scene, Orientation orientation);
|
||||||
/**
|
|
||||||
* @js ctor
|
protected:
|
||||||
*/
|
|
||||||
TransitionSceneOriented();
|
TransitionSceneOriented();
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSceneOriented();
|
virtual ~TransitionSceneOriented();
|
||||||
|
|
||||||
/** initializes a transition with duration and incoming scene */
|
/** initializes a transition with duration and incoming scene */
|
||||||
bool initWithDuration(float t,Scene* scene,Orientation orientation);
|
bool initWithDuration(float t,Scene* scene,Orientation orientation);
|
||||||
|
|
||||||
protected:
|
|
||||||
Orientation _orientation;
|
Orientation _orientation;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSceneOriented);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionRotoZoom:
|
/** @brief TransitionRotoZoom:
|
||||||
|
@ -161,21 +143,18 @@ class CC_DLL TransitionRotoZoom : public TransitionScene
|
||||||
public:
|
public:
|
||||||
static TransitionRotoZoom* create(float t, Scene* scene);
|
static TransitionRotoZoom* create(float t, Scene* scene);
|
||||||
|
|
||||||
TransitionRotoZoom();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionRotoZoom();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionRotoZoom();
|
||||||
|
virtual ~TransitionRotoZoom();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionRotoZoom);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionJumpZoom:
|
/** @brief TransitionJumpZoom:
|
||||||
|
@ -185,24 +164,18 @@ class CC_DLL TransitionJumpZoom : public TransitionScene
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionJumpZoom* create(float t, Scene* scene);
|
static TransitionJumpZoom* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionJumpZoom();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionJumpZoom();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionJumpZoom();
|
||||||
|
virtual ~TransitionJumpZoom();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionJumpZoom);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionMoveInL:
|
/** @brief TransitionMoveInL:
|
||||||
|
@ -212,17 +185,7 @@ class CC_DLL TransitionMoveInL : public TransitionScene, public TransitionEaseSc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionMoveInL* create(float t, Scene* scene);
|
static TransitionMoveInL* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionMoveInL();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionMoveInL();
|
|
||||||
/** initializes the scenes */
|
|
||||||
virtual void initScenes(void);
|
|
||||||
/** returns the action that will be performed */
|
/** returns the action that will be performed */
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action(void);
|
||||||
|
|
||||||
|
@ -231,11 +194,17 @@ public:
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionMoveInL();
|
||||||
|
virtual ~TransitionMoveInL();
|
||||||
|
|
||||||
|
/** initializes the scenes */
|
||||||
|
virtual void initScenes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInL);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionMoveInR:
|
/** @brief TransitionMoveInR:
|
||||||
|
@ -245,16 +214,15 @@ class CC_DLL TransitionMoveInR : public TransitionMoveInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionMoveInR* create(float t, Scene* scene);
|
static TransitionMoveInR* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
protected:
|
||||||
*/
|
|
||||||
TransitionMoveInR();
|
TransitionMoveInR();
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionMoveInR();
|
virtual ~TransitionMoveInR();
|
||||||
|
|
||||||
virtual void initScenes();
|
virtual void initScenes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInR);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionMoveInT:
|
/** @brief TransitionMoveInT:
|
||||||
|
@ -264,16 +232,15 @@ class CC_DLL TransitionMoveInT : public TransitionMoveInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionMoveInT* create(float t, Scene* scene);
|
static TransitionMoveInT* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
protected:
|
||||||
*/
|
|
||||||
TransitionMoveInT();
|
TransitionMoveInT();
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionMoveInT();
|
virtual ~TransitionMoveInT();
|
||||||
|
|
||||||
virtual void initScenes();
|
virtual void initScenes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInT);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionMoveInB:
|
/** @brief TransitionMoveInB:
|
||||||
|
@ -283,16 +250,15 @@ class CC_DLL TransitionMoveInB : public TransitionMoveInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionMoveInB* create(float t, Scene* scene);
|
static TransitionMoveInB* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
protected:
|
||||||
*/
|
|
||||||
TransitionMoveInB();
|
TransitionMoveInB();
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionMoveInB();
|
virtual ~TransitionMoveInB();
|
||||||
|
|
||||||
virtual void initScenes();
|
virtual void initScenes();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInB);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSlideInL:
|
/** @brief TransitionSlideInL:
|
||||||
|
@ -302,34 +268,28 @@ class CC_DLL TransitionSlideInL : public TransitionScene, public TransitionEaseS
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSlideInL* create(float t, Scene* scene);
|
static TransitionSlideInL* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSlideInL();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSlideInL();
|
|
||||||
|
|
||||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action);
|
virtual ActionInterval* easeActionWithAction(ActionInterval * action);
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
virtual void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action(void);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionSlideInL();
|
||||||
|
virtual ~TransitionSlideInL();
|
||||||
|
|
||||||
|
/** initializes the scenes */
|
||||||
|
virtual void initScenes(void);
|
||||||
|
|
||||||
virtual void sceneOrder() override;
|
virtual void sceneOrder() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInL);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSlideInR:
|
/** @brief TransitionSlideInR:
|
||||||
|
@ -339,23 +299,21 @@ class CC_DLL TransitionSlideInR : public TransitionSlideInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSlideInR* create(float t, Scene* scene);
|
static TransitionSlideInR* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSlideInR();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSlideInR();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
virtual void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionSlideInR();
|
||||||
|
virtual ~TransitionSlideInR();
|
||||||
|
|
||||||
|
/** initializes the scenes */
|
||||||
|
virtual void initScenes(void);
|
||||||
|
|
||||||
virtual void sceneOrder() override;
|
virtual void sceneOrder() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInR);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSlideInB:
|
/** @brief TransitionSlideInB:
|
||||||
|
@ -365,23 +323,21 @@ class CC_DLL TransitionSlideInB : public TransitionSlideInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSlideInB* create(float t, Scene* scene);
|
static TransitionSlideInB* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSlideInB();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSlideInB();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
virtual void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionSlideInB();
|
||||||
|
virtual ~TransitionSlideInB();
|
||||||
|
|
||||||
|
/** initializes the scenes */
|
||||||
|
virtual void initScenes();
|
||||||
|
|
||||||
virtual void sceneOrder() override;
|
virtual void sceneOrder() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInB);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSlideInT:
|
/** @brief TransitionSlideInT:
|
||||||
|
@ -391,23 +347,21 @@ class CC_DLL TransitionSlideInT : public TransitionSlideInL
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSlideInT* create(float t, Scene* scene);
|
static TransitionSlideInT* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSlideInT();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSlideInT();
|
|
||||||
|
|
||||||
/** initializes the scenes */
|
|
||||||
virtual void initScenes(void);
|
|
||||||
/** returns the action that will be performed by the incoming and outgoing scene */
|
/** returns the action that will be performed by the incoming and outgoing scene */
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action(void);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionSlideInT();
|
||||||
|
virtual ~TransitionSlideInT();
|
||||||
|
|
||||||
|
/** initializes the scenes */
|
||||||
|
virtual void initScenes(void);
|
||||||
|
|
||||||
virtual void sceneOrder() override;
|
virtual void sceneOrder() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInT);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -417,21 +371,23 @@ class CC_DLL TransitionShrinkGrow : public TransitionScene , public TransitionEa
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionShrinkGrow* create(float t, Scene* scene);
|
static TransitionShrinkGrow* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionShrinkGrow();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionShrinkGrow();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionShrinkGrow();
|
||||||
|
virtual ~TransitionShrinkGrow();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionShrinkGrow);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFlipX:
|
/** @brief TransitionFlipX:
|
||||||
|
@ -443,15 +399,6 @@ class CC_DLL TransitionFlipX : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionFlipX* create(float t, Scene* s, Orientation o);
|
static TransitionFlipX* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionFlipX* create(float t, Scene* s);
|
static TransitionFlipX* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFlipX();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFlipX();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -461,6 +408,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFlipX();
|
||||||
|
virtual ~TransitionFlipX();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipX);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFlipY:
|
/** @brief TransitionFlipY:
|
||||||
|
@ -472,15 +426,6 @@ class CC_DLL TransitionFlipY : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionFlipY* create(float t, Scene* s, Orientation o);
|
static TransitionFlipY* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionFlipY* create(float t, Scene* s);
|
static TransitionFlipY* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFlipY();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFlipY();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -490,6 +435,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFlipY();
|
||||||
|
virtual ~TransitionFlipY();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipY);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFlipAngular:
|
/** @brief TransitionFlipAngular:
|
||||||
|
@ -501,15 +453,6 @@ class CC_DLL TransitionFlipAngular : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionFlipAngular* create(float t, Scene* s, Orientation o);
|
static TransitionFlipAngular* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionFlipAngular* create(float t, Scene* s);
|
static TransitionFlipAngular* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFlipAngular();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFlipAngular();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -519,6 +462,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFlipAngular();
|
||||||
|
virtual ~TransitionFlipAngular();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipAngular);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionZoomFlipX:
|
/** @brief TransitionZoomFlipX:
|
||||||
|
@ -530,15 +480,6 @@ class CC_DLL TransitionZoomFlipX : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionZoomFlipX* create(float t, Scene* s, Orientation o);
|
static TransitionZoomFlipX* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionZoomFlipX* create(float t, Scene* s);
|
static TransitionZoomFlipX* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionZoomFlipX();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionZoomFlipX();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -548,6 +489,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionZoomFlipX();
|
||||||
|
virtual ~TransitionZoomFlipX();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipX);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionZoomFlipY:
|
/** @brief TransitionZoomFlipY:
|
||||||
|
@ -559,15 +507,6 @@ class CC_DLL TransitionZoomFlipY : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionZoomFlipY* create(float t, Scene* s, Orientation o);
|
static TransitionZoomFlipY* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionZoomFlipY* create(float t, Scene* s);
|
static TransitionZoomFlipY* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionZoomFlipY();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionZoomFlipY();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -577,6 +516,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionZoomFlipY();
|
||||||
|
virtual ~TransitionZoomFlipY();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipY);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionZoomFlipAngular:
|
/** @brief TransitionZoomFlipAngular:
|
||||||
|
@ -588,15 +534,6 @@ class CC_DLL TransitionZoomFlipAngular : public TransitionSceneOriented
|
||||||
public:
|
public:
|
||||||
static TransitionZoomFlipAngular* create(float t, Scene* s, Orientation o);
|
static TransitionZoomFlipAngular* create(float t, Scene* s, Orientation o);
|
||||||
static TransitionZoomFlipAngular* create(float t, Scene* s);
|
static TransitionZoomFlipAngular* create(float t, Scene* s);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionZoomFlipAngular();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionZoomFlipAngular();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -606,6 +543,13 @@ public:
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionZoomFlipAngular();
|
||||||
|
virtual ~TransitionZoomFlipAngular();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipAngular);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFade:
|
/** @brief TransitionFade:
|
||||||
|
@ -617,25 +561,9 @@ public:
|
||||||
/** creates the transition with a duration and with an RGB color
|
/** creates the transition with a duration and with an RGB color
|
||||||
* Example: FadeTransition::create(2, scene, Color3B(255,0,0); // red color
|
* Example: FadeTransition::create(2, scene, Color3B(255,0,0); // red color
|
||||||
*/
|
*/
|
||||||
static TransitionFade* create(float duration,Scene* scene, const Color3B& color);
|
static TransitionFade* create(float duration, Scene* scene, const Color3B& color);
|
||||||
static TransitionFade* create(float duration,Scene* scene);
|
static TransitionFade* create(float duration, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFade();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFade();
|
|
||||||
|
|
||||||
/** initializes the transition with a duration and with an RGB color */
|
|
||||||
bool initWithDuration(float t, Scene*scene ,const Color3B& color);
|
|
||||||
|
|
||||||
//
|
|
||||||
// Overrides
|
|
||||||
//
|
|
||||||
bool initWithDuration(float t,Scene* scene);
|
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -648,7 +576,18 @@ public:
|
||||||
virtual void onExit();
|
virtual void onExit();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Color4B _color;
|
TransitionFade();
|
||||||
|
virtual ~TransitionFade();
|
||||||
|
|
||||||
|
/** initializes the transition with a duration and with an RGB color */
|
||||||
|
bool initWithDuration(float t, Scene*scene, const Color3B& color);
|
||||||
|
bool initWithDuration(float t, Scene* scene);
|
||||||
|
|
||||||
|
Color4B _color;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFade);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class RenderTexture;
|
class RenderTexture;
|
||||||
|
@ -660,19 +599,14 @@ class CC_DLL TransitionCrossFade : public TransitionScene
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
static TransitionCrossFade* create(float t, Scene* scene);
|
static TransitionCrossFade* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionCrossFade();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionCrossFade();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
|
/**
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
*/
|
||||||
virtual void draw() override;
|
virtual void draw() override;
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
|
@ -685,6 +619,12 @@ public :
|
||||||
*/
|
*/
|
||||||
virtual void onExit() override;
|
virtual void onExit() override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionCrossFade();
|
||||||
|
virtual ~TransitionCrossFade();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionCrossFade);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionTurnOffTiles:
|
/** @brief TransitionTurnOffTiles:
|
||||||
|
@ -694,15 +634,6 @@ class CC_DLL TransitionTurnOffTiles : public TransitionScene ,public TransitionE
|
||||||
{
|
{
|
||||||
public :
|
public :
|
||||||
static TransitionTurnOffTiles* create(float t, Scene* scene);
|
static TransitionTurnOffTiles* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionTurnOffTiles();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionTurnOffTiles();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -715,7 +646,13 @@ public :
|
||||||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionTurnOffTiles();
|
||||||
|
virtual ~TransitionTurnOffTiles();
|
||||||
|
|
||||||
virtual void sceneOrder() override;
|
virtual void sceneOrder() override;
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionTurnOffTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSplitCols:
|
/** @brief TransitionSplitCols:
|
||||||
|
@ -725,17 +662,8 @@ class CC_DLL TransitionSplitCols : public TransitionScene , public TransitionEas
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSplitCols* create(float t, Scene* scene);
|
static TransitionSplitCols* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSplitCols();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSplitCols();
|
|
||||||
|
|
||||||
virtual ActionInterval* action(void);
|
virtual ActionInterval* action();
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
|
@ -746,6 +674,13 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual void onEnter() override;
|
virtual void onEnter() override;
|
||||||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionSplitCols();
|
||||||
|
virtual ~TransitionSplitCols();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitCols);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionSplitRows:
|
/** @brief TransitionSplitRows:
|
||||||
|
@ -755,20 +690,18 @@ class CC_DLL TransitionSplitRows : public TransitionSplitCols
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionSplitRows* create(float t, Scene* scene);
|
static TransitionSplitRows* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionSplitRows();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionSplitRows();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual ActionInterval* action(void) override;
|
virtual ActionInterval* action(void) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionSplitRows();
|
||||||
|
virtual ~TransitionSplitRows();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFadeTR:
|
/** @brief TransitionFadeTR:
|
||||||
|
@ -778,15 +711,7 @@ class CC_DLL TransitionFadeTR : public TransitionScene , public TransitionEaseSc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionFadeTR* create(float t, Scene* scene);
|
static TransitionFadeTR* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFadeTR();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFadeTR();
|
|
||||||
virtual ActionInterval* actionWithSize(const Size& size);
|
virtual ActionInterval* actionWithSize(const Size& size);
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -800,7 +725,13 @@ public:
|
||||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
TransitionFadeTR();
|
||||||
|
virtual ~TransitionFadeTR();
|
||||||
|
|
||||||
virtual void sceneOrder();
|
virtual void sceneOrder();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeTR);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFadeBL:
|
/** @brief TransitionFadeBL:
|
||||||
|
@ -810,21 +741,18 @@ class CC_DLL TransitionFadeBL : public TransitionFadeTR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionFadeBL* create(float t, Scene* scene);
|
static TransitionFadeBL* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFadeBL();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFadeBL();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFadeBL();
|
||||||
|
virtual ~TransitionFadeBL();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeBL);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFadeUp:
|
/** @brief TransitionFadeUp:
|
||||||
|
@ -834,20 +762,18 @@ class CC_DLL TransitionFadeUp : public TransitionFadeTR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionFadeUp* create(float t, Scene* scene);
|
static TransitionFadeUp* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFadeUp();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFadeUp();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFadeUp();
|
||||||
|
virtual ~TransitionFadeUp();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeUp);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief TransitionFadeDown:
|
/** @brief TransitionFadeDown:
|
||||||
|
@ -857,20 +783,19 @@ class CC_DLL TransitionFadeDown : public TransitionFadeTR
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TransitionFadeDown* create(float t, Scene* scene);
|
static TransitionFadeDown* create(float t, Scene* scene);
|
||||||
/**
|
|
||||||
* @js ctor
|
|
||||||
*/
|
|
||||||
TransitionFadeDown();
|
|
||||||
/**
|
|
||||||
* @js NA
|
|
||||||
* @lua NA
|
|
||||||
*/
|
|
||||||
virtual ~TransitionFadeDown();
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Overrides
|
// Overrides
|
||||||
//
|
//
|
||||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TransitionFadeDown();
|
||||||
|
virtual ~TransitionFadeDown();
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeDown);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of transition group
|
// end of transition group
|
||||||
|
|
|
@ -511,7 +511,7 @@ public:
|
||||||
unzFile zipFile;
|
unzFile zipFile;
|
||||||
|
|
||||||
// std::unordered_map is faster if available on the platform
|
// std::unordered_map is faster if available on the platform
|
||||||
typedef std::map<std::string, struct ZipEntryInfo> FileListContainer;
|
typedef std::unordered_map<std::string, struct ZipEntryInfo> FileListContainer;
|
||||||
FileListContainer fileList;
|
FileListContainer fileList;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ NS_CC_BEGIN
|
||||||
|
|
||||||
const char* cocos2dVersion()
|
const char* cocos2dVersion()
|
||||||
{
|
{
|
||||||
return "3.0-alpha1";
|
return "3.0-beta0-pre";
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -74,7 +74,7 @@
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;CC_USE_PHYSICS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<MinimalRebuild>false</MinimalRebuild>
|
<MinimalRebuild>false</MinimalRebuild>
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||||
|
@ -121,7 +121,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
</PreBuildEvent>
|
</PreBuildEvent>
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)external\sqlite3\include;$(EngineRoot)external\unzip;$(EngineRoot)external\tinyxml2;$(EngineRoot)external\png\include\win32;$(EngineRoot)external\jpeg\include\win32;$(EngineRoot)external\tiff\include\win32;$(EngineRoot)external\webp\include\win32;$(EngineRoot)external\freetype2\include\win32;$(EngineRoot)external\win32-specific\icon\include;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)external\chipmunk\include\chipmunk;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;CC_USE_PHYSICS;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
<PrecompiledHeader>
|
<PrecompiledHeader>
|
||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
|
@ -192,11 +192,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClCompile Include="..\math\kazmath\src\vec2.c" />
|
<ClCompile Include="..\math\kazmath\src\vec2.c" />
|
||||||
<ClCompile Include="..\math\kazmath\src\vec3.c" />
|
<ClCompile Include="..\math\kazmath\src\vec3.c" />
|
||||||
<ClCompile Include="..\math\kazmath\src\vec4.c" />
|
<ClCompile Include="..\math\kazmath\src\vec4.c" />
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsBodyInfo_box2d.cpp" />
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsContactInfo_box2d.cpp" />
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsJointInfo_box2d.cpp" />
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsShapeInfo_box2d.cpp" />
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsWorldInfo_box2d.cpp" />
|
|
||||||
<ClCompile Include="..\physics\CCPhysicsBody.cpp" />
|
<ClCompile Include="..\physics\CCPhysicsBody.cpp" />
|
||||||
<ClCompile Include="..\physics\CCPhysicsContact.cpp" />
|
<ClCompile Include="..\physics\CCPhysicsContact.cpp" />
|
||||||
<ClCompile Include="..\physics\CCPhysicsJoint.cpp" />
|
<ClCompile Include="..\physics\CCPhysicsJoint.cpp" />
|
||||||
|
@ -361,16 +356,9 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32-specific\gles\prebuilt\*.*" "$(Ou
|
||||||
<ClInclude Include="..\math\kazmath\include\kazmath\vec2.h" />
|
<ClInclude Include="..\math\kazmath\include\kazmath\vec2.h" />
|
||||||
<ClInclude Include="..\math\kazmath\include\kazmath\vec3.h" />
|
<ClInclude Include="..\math\kazmath\include\kazmath\vec3.h" />
|
||||||
<ClInclude Include="..\math\kazmath\include\kazmath\vec4.h" />
|
<ClInclude Include="..\math\kazmath\include\kazmath\vec4.h" />
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsBodyInfo_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsContactInfo_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsHelper_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsJointInfo_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsShapeInfo_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsWorldInfo_box2d.h" />
|
|
||||||
<ClInclude Include="..\physics\CCPhysicsBody.h" />
|
<ClInclude Include="..\physics\CCPhysicsBody.h" />
|
||||||
<ClInclude Include="..\physics\CCPhysicsContact.h" />
|
<ClInclude Include="..\physics\CCPhysicsContact.h" />
|
||||||
<ClInclude Include="..\physics\CCPhysicsJoint.h" />
|
<ClInclude Include="..\physics\CCPhysicsJoint.h" />
|
||||||
<ClInclude Include="..\physics\CCPhysicsSetting.h" />
|
|
||||||
<ClInclude Include="..\physics\CCPhysicsShape.h" />
|
<ClInclude Include="..\physics\CCPhysicsShape.h" />
|
||||||
<ClInclude Include="..\physics\CCPhysicsWorld.h" />
|
<ClInclude Include="..\physics\CCPhysicsWorld.h" />
|
||||||
<ClInclude Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.h" />
|
<ClInclude Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.h" />
|
||||||
|
|
|
@ -91,9 +91,6 @@
|
||||||
<Filter Include="physics\chipmunk">
|
<Filter Include="physics\chipmunk">
|
||||||
<UniqueIdentifier>{aeadfa95-9c89-4212-98ae-89ad57db596a}</UniqueIdentifier>
|
<UniqueIdentifier>{aeadfa95-9c89-4212-98ae-89ad57db596a}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
<Filter Include="physics\Box2D">
|
|
||||||
<UniqueIdentifier>{b9880458-36e5-4f28-a34b-d01d9512a395}</UniqueIdentifier>
|
|
||||||
</Filter>
|
|
||||||
<Filter Include="kazmath\include">
|
<Filter Include="kazmath\include">
|
||||||
<UniqueIdentifier>{05e27e68-7574-4a8b-af68-553dd3bafdfa}</UniqueIdentifier>
|
<UniqueIdentifier>{05e27e68-7574-4a8b-af68-553dd3bafdfa}</UniqueIdentifier>
|
||||||
</Filter>
|
</Filter>
|
||||||
|
@ -548,21 +545,6 @@
|
||||||
<ClCompile Include="CCEventMouse.cpp">
|
<ClCompile Include="CCEventMouse.cpp">
|
||||||
<Filter>event_dispatcher</Filter>
|
<Filter>event_dispatcher</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsBodyInfo_box2d.cpp">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsContactInfo_box2d.cpp">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsJointInfo_box2d.cpp">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsShapeInfo_box2d.cpp">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\physics\box2d\CCPhysicsWorldInfo_box2d.cpp">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClCompile>
|
|
||||||
<ClCompile Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.cpp">
|
<ClCompile Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.cpp">
|
||||||
<Filter>physics\chipmunk</Filter>
|
<Filter>physics\chipmunk</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
@ -589,9 +571,6 @@
|
||||||
<ClInclude Include="..\physics\CCPhysicsJoint.h">
|
<ClInclude Include="..\physics\CCPhysicsJoint.h">
|
||||||
<Filter>physics</Filter>
|
<Filter>physics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\physics\CCPhysicsSetting.h">
|
|
||||||
<Filter>physics</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\CCPhysicsShape.h">
|
<ClInclude Include="..\physics\CCPhysicsShape.h">
|
||||||
<Filter>physics</Filter>
|
<Filter>physics</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1128,24 +1107,6 @@
|
||||||
<ClInclude Include="CCEventMouse.h">
|
<ClInclude Include="CCEventMouse.h">
|
||||||
<Filter>event_dispatcher</Filter>
|
<Filter>event_dispatcher</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsBodyInfo_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsContactInfo_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsHelper_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsJointInfo_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsShapeInfo_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\box2d\CCPhysicsWorldInfo_box2d.h">
|
|
||||||
<Filter>physics\Box2D</Filter>
|
|
||||||
</ClInclude>
|
|
||||||
<ClInclude Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.h">
|
<ClInclude Include="..\physics\chipmunk\CCPhysicsBodyInfo_chipmunk.h">
|
||||||
<Filter>physics\chipmunk</Filter>
|
<Filter>physics\chipmunk</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
@ -1165,4 +1126,4 @@
|
||||||
<Filter>physics\chipmunk</Filter>
|
<Filter>physics\chipmunk</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
|
@ -2,13 +2,12 @@
|
||||||
#define __CCDEVICE_H__
|
#define __CCDEVICE_H__
|
||||||
|
|
||||||
#include "CCPlatformMacros.h"
|
#include "CCPlatformMacros.h"
|
||||||
|
#include "ccMacros.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
class CC_DLL Device
|
class CC_DLL Device
|
||||||
{
|
{
|
||||||
private:
|
|
||||||
Device();
|
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* Gets the DPI of device
|
* Gets the DPI of device
|
||||||
|
@ -24,6 +23,9 @@ public:
|
||||||
* Sets the interval of accelerometer.
|
* Sets the interval of accelerometer.
|
||||||
*/
|
*/
|
||||||
static void setAccelerometerInterval(float interval);
|
static void setAccelerometerInterval(float interval);
|
||||||
|
|
||||||
|
private:
|
||||||
|
CC_DISALLOW_IMPLICIT_CONSTRUCTORS(Device);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -177,7 +177,7 @@ bool EGLViewProtocol::isScissorEnabled()
|
||||||
return (GL_FALSE == glIsEnabled(GL_SCISSOR_TEST)) ? false : true;
|
return (GL_FALSE == glIsEnabled(GL_SCISSOR_TEST)) ? false : true;
|
||||||
}
|
}
|
||||||
|
|
||||||
Rect EGLViewProtocol::getScissorRect()
|
Rect EGLViewProtocol::getScissorRect() const
|
||||||
{
|
{
|
||||||
GLfloat params[4];
|
GLfloat params[4];
|
||||||
glGetFloatv(GL_SCISSOR_BOX, params);
|
glGetFloatv(GL_SCISSOR_BOX, params);
|
||||||
|
@ -188,15 +188,12 @@ Rect EGLViewProtocol::getScissorRect()
|
||||||
return Rect(x, y, w, h);
|
return Rect(x, y, w, h);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EGLViewProtocol::setViewName(const char* pszViewName)
|
void EGLViewProtocol::setViewName(const std::string& viewname )
|
||||||
{
|
{
|
||||||
if (pszViewName != NULL && strlen(pszViewName) > 0)
|
_viewName = viewname;
|
||||||
{
|
|
||||||
strncpy(_viewName, pszViewName, sizeof(_viewName));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const char* EGLViewProtocol::getViewName()
|
const std::string& EGLViewProtocol::getViewName() const
|
||||||
{
|
{
|
||||||
return _viewName;
|
return _viewName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -129,11 +129,10 @@ public:
|
||||||
/**
|
/**
|
||||||
* Get the current scissor rectangle
|
* Get the current scissor rectangle
|
||||||
*/
|
*/
|
||||||
virtual Rect getScissorRect();
|
virtual Rect getScissorRect() const;
|
||||||
|
|
||||||
virtual void setViewName(const char* pszViewName);
|
virtual void setViewName(const std::string& viewname);
|
||||||
|
const std::string& getViewName() const;
|
||||||
const char* getViewName();
|
|
||||||
|
|
||||||
/** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
|
/** Touch events are handled by default; if you want to customize your handlers, please override these functions: */
|
||||||
virtual void handleTouchesBegin(int num, long ids[], float xs[], float ys[]);
|
virtual void handleTouchesBegin(int num, long ids[], float xs[], float ys[]);
|
||||||
|
@ -155,10 +154,11 @@ public:
|
||||||
* Get scale factor of the vertical direction.
|
* Get scale factor of the vertical direction.
|
||||||
*/
|
*/
|
||||||
float getScaleY() const;
|
float getScaleY() const;
|
||||||
private:
|
|
||||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
||||||
|
|
||||||
EGLTouchDelegate* _delegate;
|
EGLTouchDelegate* _delegate;
|
||||||
|
|
||||||
// real screen size
|
// real screen size
|
||||||
|
@ -168,7 +168,7 @@ protected:
|
||||||
// the view port size
|
// the view port size
|
||||||
Rect _viewPortRect;
|
Rect _viewPortRect;
|
||||||
// the view name
|
// the view name
|
||||||
char _viewName[50];
|
std::string _viewName;
|
||||||
|
|
||||||
float _scaleX;
|
float _scaleX;
|
||||||
float _scaleY;
|
float _scaleY;
|
||||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <map>
|
#include <unordered_map>
|
||||||
#include "CCPlatformMacros.h"
|
#include "CCPlatformMacros.h"
|
||||||
#include "ccTypes.h"
|
#include "ccTypes.h"
|
||||||
|
|
||||||
|
@ -399,7 +399,7 @@ protected:
|
||||||
* The full path cache. When a file is found, it will be added into this cache.
|
* The full path cache. When a file is found, it will be added into this cache.
|
||||||
* This variable is used for improving the performance of file search.
|
* This variable is used for improving the performance of file search.
|
||||||
*/
|
*/
|
||||||
std::map<std::string, std::string> _fullPathCache;
|
std::unordered_map<std::string, std::string> _fullPathCache;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The singleton pointer of FileUtils.
|
* The singleton pointer of FileUtils.
|
||||||
|
|
|
@ -193,7 +193,7 @@ public:
|
||||||
@param filePath the file's absolute path, including file suffix.
|
@param filePath the file's absolute path, including file suffix.
|
||||||
@param isToRGB whether the image is saved as RGB format.
|
@param isToRGB whether the image is saved as RGB format.
|
||||||
*/
|
*/
|
||||||
bool saveToFile(const char *filePath, bool isToRGB = true);
|
bool saveToFile(const std::string &filename, bool isToRGB = true);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool initWithJpgData(const unsigned char * data, int dataLen);
|
bool initWithJpgData(const unsigned char * data, int dataLen);
|
||||||
|
@ -207,8 +207,8 @@ protected:
|
||||||
bool initWithS3TCData(const unsigned char * data, int dataLen);
|
bool initWithS3TCData(const unsigned char * data, int dataLen);
|
||||||
bool initWithATITCData(const unsigned char *data, int dataLen);
|
bool initWithATITCData(const unsigned char *data, int dataLen);
|
||||||
|
|
||||||
bool saveImageToPNG(const char *filePath, bool isToRGB = true);
|
bool saveImageToPNG(const std::string& filePath, bool isToRGB = true);
|
||||||
bool saveImageToJPG(const char *filePath);
|
bool saveImageToJPG(const std::string& filePath);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1784,7 +1784,7 @@ bool Image::initWithRawData(const unsigned char * data, long dataLen, long width
|
||||||
|
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||||
bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
bool Image::saveToFile(const std::string& filename, bool bIsToRGB)
|
||||||
{
|
{
|
||||||
//only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data
|
//only support for Texture2D::PixelFormat::RGB888 or Texture2D::PixelFormat::RGBA8888 uncompressed data
|
||||||
if (isCompressed() || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
|
if (isCompressed() || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
|
||||||
|
@ -1797,24 +1797,22 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(NULL == pszFilePath);
|
|
||||||
|
|
||||||
std::string strFilePath(pszFilePath);
|
CC_BREAK_IF(filename.size() <= 4);
|
||||||
CC_BREAK_IF(strFilePath.size() <= 4);
|
|
||||||
|
|
||||||
std::string strLowerCasePath(strFilePath);
|
std::string strLowerCasePath(filename);
|
||||||
for (unsigned int i = 0; i < strLowerCasePath.length(); ++i)
|
for (unsigned int i = 0; i < strLowerCasePath.length(); ++i)
|
||||||
{
|
{
|
||||||
strLowerCasePath[i] = tolower(strFilePath[i]);
|
strLowerCasePath[i] = tolower(filename[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (std::string::npos != strLowerCasePath.find(".png"))
|
if (std::string::npos != strLowerCasePath.find(".png"))
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(!saveImageToPNG(pszFilePath, bIsToRGB));
|
CC_BREAK_IF(!saveImageToPNG(filename, bIsToRGB));
|
||||||
}
|
}
|
||||||
else if (std::string::npos != strLowerCasePath.find(".jpg"))
|
else if (std::string::npos != strLowerCasePath.find(".jpg"))
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(!saveImageToJPG(pszFilePath));
|
CC_BREAK_IF(!saveImageToJPG(filename));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1828,20 +1826,18 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
bool Image::saveImageToPNG(const char * filePath, bool isToRGB)
|
bool Image::saveImageToPNG(const std::string& filePath, bool isToRGB)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(NULL == filePath);
|
|
||||||
|
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
png_structp png_ptr;
|
png_structp png_ptr;
|
||||||
png_infop info_ptr;
|
png_infop info_ptr;
|
||||||
png_colorp palette;
|
png_colorp palette;
|
||||||
png_bytep *row_pointers;
|
png_bytep *row_pointers;
|
||||||
|
|
||||||
fp = fopen(filePath, "wb");
|
fp = fopen(filePath.c_str(), "wb");
|
||||||
CC_BREAK_IF(NULL == fp);
|
CC_BREAK_IF(NULL == fp);
|
||||||
|
|
||||||
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
|
||||||
|
@ -1968,13 +1964,11 @@ bool Image::saveImageToPNG(const char * filePath, bool isToRGB)
|
||||||
} while (0);
|
} while (0);
|
||||||
return bRet;
|
return bRet;
|
||||||
}
|
}
|
||||||
bool Image::saveImageToJPG(const char * filePath)
|
bool Image::saveImageToJPG(const std::string& filePath)
|
||||||
{
|
{
|
||||||
bool bRet = false;
|
bool bRet = false;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
CC_BREAK_IF(NULL == filePath);
|
|
||||||
|
|
||||||
struct jpeg_compress_struct cinfo;
|
struct jpeg_compress_struct cinfo;
|
||||||
struct jpeg_error_mgr jerr;
|
struct jpeg_error_mgr jerr;
|
||||||
FILE * outfile; /* target file */
|
FILE * outfile; /* target file */
|
||||||
|
@ -1985,7 +1979,7 @@ bool Image::saveImageToJPG(const char * filePath)
|
||||||
/* Now we can initialize the JPEG compression object. */
|
/* Now we can initialize the JPEG compression object. */
|
||||||
jpeg_create_compress(&cinfo);
|
jpeg_create_compress(&cinfo);
|
||||||
|
|
||||||
CC_BREAK_IF((outfile = fopen(filePath, "wb")) == NULL);
|
CC_BREAK_IF((outfile = fopen(filePath.c_str(), "wb")) == NULL);
|
||||||
|
|
||||||
jpeg_stdio_dest(&cinfo, outfile);
|
jpeg_stdio_dest(&cinfo, outfile);
|
||||||
|
|
||||||
|
|
|
@ -24,23 +24,62 @@ THE SOFTWARE.
|
||||||
|
|
||||||
#include "CCThread.h"
|
#include "CCThread.h"
|
||||||
|
|
||||||
|
NS_CC_BEGIN
|
||||||
|
|
||||||
// iOS and Mac already has a Thread.mm
|
// iOS and Mac already has a Thread.mm
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS && CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_IOS && CC_TARGET_PLATFORM != CC_PLATFORM_MAC)
|
||||||
|
|
||||||
NS_CC_BEGIN
|
std::list<std::function<void(void)>>* ThreadHelper::_callbackList = new std::list<std::function<void(void)>>();
|
||||||
|
std::mutex* ThreadHelper::_mutex = new std::mutex;
|
||||||
|
long ThreadHelper::_callbackNumberPerFrame = 5;
|
||||||
|
|
||||||
Thread::~Thread()
|
|
||||||
|
void* ThreadHelper::createAutoreleasePool()
|
||||||
{
|
{
|
||||||
// To prevent warning: private field '_autoreasePool' is not
|
return nullptr;
|
||||||
// used [-Wunused-private-field] by CLANG.
|
|
||||||
_autoReleasePool = nullptr;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::createAutoreleasePool()
|
void ThreadHelper::releaseAutoreleasePool(void* autoreleasePool)
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
void ThreadHelper::runOnGLThread(std::function<void(void)> f)
|
||||||
|
{
|
||||||
|
// Insert call back function
|
||||||
|
_mutex->lock();
|
||||||
|
_callbackList->push_back(f);
|
||||||
|
_mutex->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThreadHelper::doCallback()
|
||||||
|
{
|
||||||
|
_mutex->lock();
|
||||||
|
auto iter = _callbackList->begin();
|
||||||
|
long i = 0;
|
||||||
|
while (iter != _callbackList->end())
|
||||||
|
{
|
||||||
|
auto f = *iter;
|
||||||
|
f();
|
||||||
|
|
||||||
|
++i;
|
||||||
|
if (i >= _callbackNumberPerFrame)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iter = _callbackList->erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_mutex->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThreadHelper::setCallbackNumberPerFrame(long callbackNumberPerFrame)
|
||||||
|
{
|
||||||
|
_callbackNumberPerFrame = callbackNumberPerFrame;
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
NS_CC_END
|
||||||
|
|
|
@ -25,8 +25,12 @@ THE SOFTWARE.
|
||||||
#ifndef __CC_PLATFORM_THREAD_H__
|
#ifndef __CC_PLATFORM_THREAD_H__
|
||||||
#define __CC_PLATFORM_THREAD_H__
|
#define __CC_PLATFORM_THREAD_H__
|
||||||
|
|
||||||
|
#include <functional>
|
||||||
|
#include <list>
|
||||||
|
#include <mutex>
|
||||||
#include "platform/CCCommon.h"
|
#include "platform/CCCommon.h"
|
||||||
#include "CCPlatformMacros.h"
|
#include "CCPlatformMacros.h"
|
||||||
|
#include "CCDirector.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
@ -39,27 +43,45 @@ NS_CC_BEGIN
|
||||||
* and release it when the thread end.
|
* and release it when the thread end.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CC_DLL Thread
|
class CC_DLL ThreadHelper
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
friend DisplayLinkDirector;
|
||||||
|
|
||||||
|
/** Create an autorelease pool for objective-c codes.
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
Thread() : _autoReleasePool(nullptr) {}
|
static void* createAutoreleasePool();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
*/
|
*/
|
||||||
~Thread();
|
static void releaseAutoreleasePool(void *autoreleasePool);
|
||||||
/**
|
|
||||||
|
/** To run a function in gl thread.
|
||||||
* @js NA
|
* @js NA
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@since v3.0
|
||||||
*/
|
*/
|
||||||
void createAutoreleasePool();
|
static void runOnGLThread(std::function<void(void)> f);
|
||||||
|
|
||||||
|
/** Set how many callback functions being invoked per frame. Default value is 5.
|
||||||
|
* @js NA
|
||||||
|
* @lua NA
|
||||||
|
@since v3.0
|
||||||
|
*/
|
||||||
|
static void setCallbackNumberPerFrame(long callbackNumberPerFrame);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
void *_autoReleasePool;
|
// This function will be call by Director to call some call back function on gl thread
|
||||||
|
static void doCallback();
|
||||||
|
|
||||||
|
static std::list<std::function<void(void)>> *_callbackList;
|
||||||
|
static std::mutex *_mutex;
|
||||||
|
// How many callback functions invoked per frame
|
||||||
|
static long _callbackNumberPerFrame;
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of platform group
|
// end of platform group
|
||||||
|
|
|
@ -26,14 +26,55 @@ THE SOFTWARE.
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
Thread::~Thread()
|
std::list<std::function<void(void)>>* ThreadHelper::_callbackList = new std::list<std::function<void(void)>>();
|
||||||
|
std::mutex* ThreadHelper::_mutex = new std::mutex;
|
||||||
|
long ThreadHelper::_callbackNumberPerFrame = 5;
|
||||||
|
|
||||||
|
void* ThreadHelper::createAutoreleasePool()
|
||||||
{
|
{
|
||||||
[(id)_autoReleasePool release];
|
id pool = [[NSAutoreleasePool alloc] init];
|
||||||
|
return pool;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Thread::createAutoreleasePool()
|
void ThreadHelper::releaseAutoreleasePool(void *autoreleasePool)
|
||||||
{
|
{
|
||||||
_autoReleasePool = [[NSAutoreleasePool alloc] init];
|
[(NSAutoreleasePool*)autoreleasePool release];
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThreadHelper::runOnGLThread(std::function<void(void)> f)
|
||||||
|
{
|
||||||
|
// Insert call back function
|
||||||
|
_mutex->lock();
|
||||||
|
_callbackList->push_back(f);
|
||||||
|
_mutex->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThreadHelper::doCallback()
|
||||||
|
{
|
||||||
|
_mutex->lock();
|
||||||
|
auto iter = _callbackList->begin();
|
||||||
|
long i = 0;
|
||||||
|
while (iter != _callbackList->end())
|
||||||
|
{
|
||||||
|
auto f = *iter;
|
||||||
|
f();
|
||||||
|
|
||||||
|
++i;
|
||||||
|
if (i >= _callbackNumberPerFrame)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
iter = _callbackList->erase(iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
_mutex->unlock();
|
||||||
|
}
|
||||||
|
|
||||||
|
void ThreadHelper::setCallbackNumberPerFrame(long callbackNumberPerFrame)
|
||||||
|
{
|
||||||
|
_callbackNumberPerFrame = callbackNumberPerFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
|
@ -380,12 +380,12 @@ bool Image::initWithStringShadowStroke(
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
bool Image::saveToFile(const std::string& filename, bool bIsToRGB)
|
||||||
{
|
{
|
||||||
bool saveToPNG = false;
|
bool saveToPNG = false;
|
||||||
bool needToCopyPixels = false;
|
bool needToCopyPixels = false;
|
||||||
std::string filePath(pszFilePath);
|
|
||||||
if (std::string::npos != filePath.find(".png"))
|
if (std::string::npos != filename.find(".png"))
|
||||||
{
|
{
|
||||||
saveToPNG = true;
|
saveToPNG = true;
|
||||||
}
|
}
|
||||||
|
@ -453,7 +453,7 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||||
data = UIImageJPEGRepresentation(image, 1.0f);
|
data = UIImageJPEGRepresentation(image, 1.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
[data writeToFile:[NSString stringWithUTF8String:pszFilePath] atomically:YES];
|
[data writeToFile:[NSString stringWithUTF8String:filename.c_str()] atomically:YES];
|
||||||
|
|
||||||
[image release];
|
[image release];
|
||||||
|
|
||||||
|
|
|
@ -290,7 +290,7 @@ EGLView::EGLView()
|
||||||
{
|
{
|
||||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||||
s_pEglView = this;
|
s_pEglView = this;
|
||||||
strcpy(_viewName, "Cocos2dxWin32");
|
_viewName = "Cocos2dxWin32";
|
||||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||||
glfwInit();
|
glfwInit();
|
||||||
}
|
}
|
||||||
|
@ -310,7 +310,7 @@ bool EGLView::init(const char* viewName, float width, float height, float frameZ
|
||||||
setFrameZoomFactor(frameZoomFactor);
|
setFrameZoomFactor(frameZoomFactor);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);
|
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName.c_str(), nullptr, nullptr);
|
||||||
glfwMakeContextCurrent(_mainWindow);
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
|
||||||
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
||||||
|
|
|
@ -21,7 +21,11 @@
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "CCEGLView.h"
|
#include "CCEGLView.h"
|
||||||
|
|
||||||
|
#include <unordered_map>
|
||||||
|
|
||||||
#include "EAGLView.h"
|
#include "EAGLView.h"
|
||||||
#include "CCDirector.h"
|
#include "CCDirector.h"
|
||||||
#include "CCSet.h"
|
#include "CCSet.h"
|
||||||
|
@ -34,7 +38,7 @@
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
|
||||||
|
|
||||||
static std::map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
static std::unordered_map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
||||||
/* The unknown key */
|
/* The unknown key */
|
||||||
{ GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE },
|
{ GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE },
|
||||||
|
|
||||||
|
@ -308,8 +312,8 @@ EGLView::EGLView()
|
||||||
, _mainWindow(nullptr)
|
, _mainWindow(nullptr)
|
||||||
{
|
{
|
||||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||||
|
_viewName = "cocos2dx";
|
||||||
s_pEglView = this;
|
s_pEglView = this;
|
||||||
strcpy(_viewName, "Cocos2dxWin32");
|
|
||||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||||
glfwInit();
|
glfwInit();
|
||||||
}
|
}
|
||||||
|
@ -330,7 +334,7 @@ bool EGLView::init(const char *viewName, float width, float height, float frameZ
|
||||||
setFrameZoomFactor(frameZoomFactor);
|
setFrameZoomFactor(frameZoomFactor);
|
||||||
|
|
||||||
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
glfwWindowHint(GLFW_RESIZABLE,GL_FALSE);
|
||||||
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName, nullptr, nullptr);
|
_mainWindow = glfwCreateWindow(_screenSize.width * _frameZoomFactor, _screenSize.height * _frameZoomFactor, _viewName.c_str(), nullptr, nullptr);
|
||||||
glfwMakeContextCurrent(_mainWindow);
|
glfwMakeContextCurrent(_mainWindow);
|
||||||
|
|
||||||
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
||||||
|
|
|
@ -234,19 +234,29 @@ public: virtual void set##funName(varType var) \
|
||||||
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
|
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
|
||||||
#endif // Lua engine debug
|
#endif // Lua engine debug
|
||||||
|
|
||||||
|
// A macro to disallow the copy constructor and operator= functions
|
||||||
|
// This should be used in the private: declarations for a class
|
||||||
#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
|
#if defined(__GNUC__) && ((__GNUC__ >= 5) || ((__GNUG__ == 4) && (__GNUC_MINOR__ >= 4))) \
|
||||||
|| (defined(__clang__) && (__clang_major__ >= 3))
|
|| (defined(__clang__) && (__clang_major__ >= 3))
|
||||||
#define CC_DISABLE_COPY(Class) \
|
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||||
private: \
|
TypeName(const TypeName &) = delete; \
|
||||||
Class(const Class &) = delete; \
|
TypeName &operator =(const TypeName &) = delete;
|
||||||
Class &operator =(const Class &) = delete;
|
|
||||||
#else
|
#else
|
||||||
#define CC_DISABLE_COPY(Class) \
|
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||||
private: \
|
Class(const TypeName &); \
|
||||||
Class(const Class &); \
|
Class &operator =(const TypeName &);
|
||||||
Class &operator =(const Class &);
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// A macro to disallow all the implicit constructors, namely the
|
||||||
|
// default constructor, copy constructor and operator= functions.
|
||||||
|
//
|
||||||
|
// This should be used in the private: declarations for a class
|
||||||
|
// that wants to prevent anyone from instantiating it. This is
|
||||||
|
// especially useful for classes containing only static methods.
|
||||||
|
#define CC_DISALLOW_IMPLICIT_CONSTRUCTORS(TypeName) \
|
||||||
|
TypeName(); \
|
||||||
|
CC_DISALLOW_COPY_AND_ASSIGN(TypeName)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* only certain compilers support __attribute__((deprecated))
|
* only certain compilers support __attribute__((deprecated))
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -193,7 +193,7 @@ void ActionObject::simulationActionUpdate(float dt)
|
||||||
|
|
||||||
for ( int i = 0; i < nodeNum; i++ )
|
for ( int i = 0; i < nodeNum; i++ )
|
||||||
{
|
{
|
||||||
ActionNode* actionNode = (ActionNode*)_actionNodeList->getObjectAtIndex(i);
|
ActionNode* actionNode = static_cast<ActionNode*>(_actionNodeList->getObjectAtIndex(i));
|
||||||
|
|
||||||
if (actionNode->isActionDoneOnce() == false)
|
if (actionNode->isActionDoneOnce() == false)
|
||||||
{
|
{
|
||||||
|
|
|
@ -154,10 +154,6 @@ void DataReaderHelper::loadData()
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
// create autorelease pool for iOS
|
|
||||||
Thread thread;
|
|
||||||
thread.createAutoreleasePool();
|
|
||||||
|
|
||||||
std::queue<AsyncStruct *> *pQueue = _asyncStructQueue;
|
std::queue<AsyncStruct *> *pQueue = _asyncStructQueue;
|
||||||
_asyncStructQueueMutex.lock(); // get async struct from queue
|
_asyncStructQueueMutex.lock(); // get async struct from queue
|
||||||
if (pQueue->empty())
|
if (pQueue->empty())
|
||||||
|
|
|
@ -193,10 +193,10 @@ void UIButton::loadTextureNormal(const char* normal,TextureResType texType)
|
||||||
switch (_normalTexType)
|
switch (_normalTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->initWithFile(normal);
|
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->setTexture(normal);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->initWithSpriteFrameName(normal);
|
dynamic_cast<cocos2d::Sprite*>(_buttonNormalRenderer)->setSpriteFrame(normal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -239,10 +239,10 @@ void UIButton::loadTexturePressed(const char* selected,TextureResType texType)
|
||||||
switch (_pressedTexType)
|
switch (_pressedTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->initWithFile(selected);
|
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->setTexture(selected);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->initWithSpriteFrameName(selected);
|
dynamic_cast<cocos2d::Sprite*>(_buttonClickedRenderer)->setSpriteFrame(selected);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -285,10 +285,10 @@ void UIButton::loadTextureDisabled(const char* disabled,TextureResType texType)
|
||||||
switch (_disabledTexType)
|
switch (_disabledTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->initWithFile(disabled);
|
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->setTexture(disabled);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->initWithSpriteFrameName(disabled);
|
dynamic_cast<cocos2d::Sprite*>(_buttonDisableRenderer)->setSpriteFrame(disabled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -112,10 +112,10 @@ void UICheckBox::loadTextureBackGround(const char *backGround,TextureResType tex
|
||||||
switch (_backGroundTexType)
|
switch (_backGroundTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_backGroundBoxRenderer->initWithFile(backGround);
|
_backGroundBoxRenderer->setTexture(backGround);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_backGroundBoxRenderer->initWithSpriteFrameName(backGround);
|
_backGroundBoxRenderer->setSpriteFrame(backGround);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -136,10 +136,10 @@ void UICheckBox::loadTextureBackGroundSelected(const char *backGroundSelected,Te
|
||||||
switch (_backGroundSelectedTexType)
|
switch (_backGroundSelectedTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_backGroundSelectedBoxRenderer->initWithFile(backGroundSelected);
|
_backGroundSelectedBoxRenderer->setTexture(backGroundSelected);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_backGroundSelectedBoxRenderer->initWithSpriteFrameName(backGroundSelected);
|
_backGroundSelectedBoxRenderer->setSpriteFrame(backGroundSelected);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -160,10 +160,10 @@ void UICheckBox::loadTextureFrontCross(const char *cross,TextureResType texType)
|
||||||
switch (_frontCrossTexType)
|
switch (_frontCrossTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_frontCrossRenderer->initWithFile(cross);
|
_frontCrossRenderer->setTexture(cross);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_frontCrossRenderer->initWithSpriteFrameName(cross);
|
_frontCrossRenderer->setSpriteFrame(cross);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -184,10 +184,10 @@ void UICheckBox::loadTextureBackGroundDisabled(const char *backGroundDisabled,Te
|
||||||
switch (_backGroundDisabledTexType)
|
switch (_backGroundDisabledTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_backGroundBoxDisabledRenderer->initWithFile(backGroundDisabled);
|
_backGroundBoxDisabledRenderer->setTexture(backGroundDisabled);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_backGroundBoxDisabledRenderer->initWithSpriteFrameName(backGroundDisabled);
|
_backGroundBoxDisabledRenderer->setSpriteFrame(backGroundDisabled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -208,10 +208,10 @@ void UICheckBox::loadTextureFrontCrossDisabled(const char *frontCrossDisabled,Te
|
||||||
switch (_frontCrossDisabledTexType)
|
switch (_frontCrossDisabledTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_frontCrossDisabledRenderer->initWithFile(frontCrossDisabled);
|
_frontCrossDisabledRenderer->setTexture(frontCrossDisabled);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_frontCrossDisabledRenderer->initWithSpriteFrameName(frontCrossDisabled);
|
_frontCrossDisabledRenderer->setSpriteFrame(frontCrossDisabled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -92,7 +92,7 @@ void UIImageView::loadTexture(const char *fileName, TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DYNAMIC_CAST_CCSPRITE->initWithFile(fileName);
|
DYNAMIC_CAST_CCSPRITE->setTexture(fileName);
|
||||||
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
||||||
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ void UIImageView::loadTexture(const char *fileName, TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
DYNAMIC_CAST_CCSPRITE->initWithSpriteFrameName(fileName);
|
DYNAMIC_CAST_CCSPRITE->setSpriteFrame(fileName);
|
||||||
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
DYNAMIC_CAST_CCSPRITE->setColor(getColor());
|
||||||
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
DYNAMIC_CAST_CCSPRITE->setOpacity(getOpacity());
|
||||||
}
|
}
|
||||||
|
|
|
@ -214,10 +214,10 @@ void UILayout::setBackGroundImage(const char* fileName,TextureResType texType)
|
||||||
switch (_bgImageTexType)
|
switch (_bgImageTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->initWithFile(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->setTexture(fileName);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->initWithSpriteFrameName(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_backGroundImage)->setSpriteFrame(fileName);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -121,7 +121,7 @@ void UILoadingBar::loadTexture(const char* texture,TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithFile(texture);
|
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setTexture(texture);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
|
@ -132,7 +132,7 @@ void UILoadingBar::loadTexture(const char* texture,TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithSpriteFrameName(texture);
|
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setSpriteFrame(texture);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
|
@ -111,7 +111,7 @@ void UISlider::loadBarTexture(const char* fileName, TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithFile(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setTexture(fileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
|
@ -121,7 +121,7 @@ void UISlider::loadBarTexture(const char* fileName, TextureResType texType)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->initWithSpriteFrameName(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_barRenderer)->setSpriteFrame(fileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -157,7 +157,7 @@ void UISlider::loadProgressBarTexture(const char *fileName, TextureResType texTy
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->initWithFile(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->setTexture(fileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
|
@ -167,7 +167,7 @@ void UISlider::loadProgressBarTexture(const char *fileName, TextureResType texTy
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->initWithSpriteFrameName(fileName);
|
dynamic_cast<cocos2d::Sprite*>(_progressBarRenderer)->setSpriteFrame(fileName);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -281,10 +281,10 @@ void UISlider::loadSlidBallTextureNormal(const char* normal,TextureResType texTy
|
||||||
switch (_ballNTexType)
|
switch (_ballNTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_slidBallNormalRenderer->initWithFile(normal);
|
_slidBallNormalRenderer->setTexture(normal);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_slidBallNormalRenderer->initWithSpriteFrameName(normal);
|
_slidBallNormalRenderer->setSpriteFrame(normal);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -304,10 +304,10 @@ void UISlider::loadSlidBallTexturePressed(const char* pressed,TextureResType tex
|
||||||
switch (_ballPTexType)
|
switch (_ballPTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_slidBallPressedRenderer->initWithFile(pressed);
|
_slidBallPressedRenderer->setTexture(pressed);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_slidBallPressedRenderer->initWithSpriteFrameName(pressed);
|
_slidBallPressedRenderer->setSpriteFrame(pressed);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -327,10 +327,10 @@ void UISlider::loadSlidBallTextureDisabled(const char* disabled,TextureResType t
|
||||||
switch (_ballDTexType)
|
switch (_ballDTexType)
|
||||||
{
|
{
|
||||||
case UI_TEX_TYPE_LOCAL:
|
case UI_TEX_TYPE_LOCAL:
|
||||||
_slidBallDisabledRenderer->initWithFile(disabled);
|
_slidBallDisabledRenderer->setTexture(disabled);
|
||||||
break;
|
break;
|
||||||
case UI_TEX_TYPE_PLIST:
|
case UI_TEX_TYPE_PLIST:
|
||||||
_slidBallDisabledRenderer->initWithSpriteFrameName(disabled);
|
_slidBallDisabledRenderer->setSpriteFrame(disabled);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -71,7 +71,7 @@ typedef enum
|
||||||
}PositionType;
|
}PositionType;
|
||||||
|
|
||||||
typedef void (cocos2d::Object::*SEL_TouchEvent)(cocos2d::Object*,TouchEventType);
|
typedef void (cocos2d::Object::*SEL_TouchEvent)(cocos2d::Object*,TouchEventType);
|
||||||
#define toucheventselector(_SELECTOR) (SEL_TouchEvent)(&_SELECTOR)
|
#define toucheventselector(_SELECTOR) (gui::SEL_TouchEvent)(&_SELECTOR)
|
||||||
|
|
||||||
class UIWidget : public cocos2d::Object
|
class UIWidget : public cocos2d::Object
|
||||||
{
|
{
|
||||||
|
|
|
@ -116,7 +116,7 @@ private:
|
||||||
//c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind)
|
//c++11 style callbacks entities will be created using CC_CALLBACK (which uses std::bind)
|
||||||
typedef std::function<void(SIOClient*, const std::string&)> SIOEvent;
|
typedef std::function<void(SIOClient*, const std::string&)> SIOEvent;
|
||||||
//c++11 map to callbacks
|
//c++11 map to callbacks
|
||||||
typedef std::map<std::string, SIOEvent> EventRegistry;
|
typedef std::unordered_map<std::string, SIOEvent> EventRegistry;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief A single connection to a socket.io endpoint
|
* @brief A single connection to a socket.io endpoint
|
||||||
|
|
|
@ -27,31 +27,20 @@
|
||||||
#include <climits>
|
#include <climits>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
#include "chipmunk.h"
|
#include "chipmunk.h"
|
||||||
#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D)
|
|
||||||
#include "Box2D.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CCPhysicsShape.h"
|
#include "CCPhysicsShape.h"
|
||||||
#include "CCPhysicsJoint.h"
|
#include "CCPhysicsJoint.h"
|
||||||
#include "CCPhysicsWorld.h"
|
#include "CCPhysicsWorld.h"
|
||||||
|
|
||||||
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsBodyInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsJointInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsJointInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsJointInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsWorldInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsWorldInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsWorldInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsShapeInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsHelper_box2d.h"
|
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
extern const float PHYSICS_INFINITY;
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
|
@ -526,18 +515,18 @@ void PhysicsBody::addMoment(float moment)
|
||||||
{
|
{
|
||||||
if (moment == PHYSICS_INFINITY)
|
if (moment == PHYSICS_INFINITY)
|
||||||
{
|
{
|
||||||
// if moment is INFINITY, the moment of the body will become INFINITY
|
// if moment is PHYSICS_INFINITY, the moment of the body will become PHYSICS_INFINITY
|
||||||
_moment = PHYSICS_INFINITY;
|
_moment = PHYSICS_INFINITY;
|
||||||
_momentDefault = false;
|
_momentDefault = false;
|
||||||
}
|
}
|
||||||
else if (moment == -PHYSICS_INFINITY)
|
else if (moment == -PHYSICS_INFINITY)
|
||||||
{
|
{
|
||||||
// if moment is -INFINITY, it won't change
|
// if moment is -PHYSICS_INFINITY, it won't change
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// if moment of the body is INFINITY is has no effect
|
// if moment of the body is PHYSICS_INFINITY is has no effect
|
||||||
if (_moment != PHYSICS_INFINITY)
|
if (_moment != PHYSICS_INFINITY)
|
||||||
{
|
{
|
||||||
if (_momentDefault)
|
if (_momentDefault)
|
||||||
|
@ -811,11 +800,6 @@ Point PhysicsBody::local2World(const Point& point)
|
||||||
return PhysicsHelper::cpv2point(cpBodyLocal2World(_info->getBody(), PhysicsHelper::point2cpv(point)));
|
return PhysicsHelper::cpv2point(cpBodyLocal2World(_info->getBody(), PhysicsHelper::point2cpv(point)));
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#ifndef __CCPHYSICS_BODY_H__
|
#ifndef __CCPHYSICS_BODY_H__
|
||||||
#define __CCPHYSICS_BODY_H__
|
#define __CCPHYSICS_BODY_H__
|
||||||
|
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
|
@ -40,9 +39,10 @@ NS_CC_BEGIN
|
||||||
class Sprite;
|
class Sprite;
|
||||||
class PhysicsWorld;
|
class PhysicsWorld;
|
||||||
class PhysicsJoint;
|
class PhysicsJoint;
|
||||||
|
|
||||||
class PhysicsBodyInfo;
|
class PhysicsBodyInfo;
|
||||||
|
|
||||||
|
typedef Point Vect;
|
||||||
|
|
||||||
|
|
||||||
const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(0.1f, 0.5f, 0.5f);
|
const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(0.1f, 0.5f, 0.5f);
|
||||||
|
|
||||||
|
@ -50,7 +50,7 @@ const PhysicsMaterial PHYSICSBODY_MATERIAL_DEFAULT(0.1f, 0.5f, 0.5f);
|
||||||
* A body affect by physics.
|
* A body affect by physics.
|
||||||
* it can attach one or more shapes.
|
* it can attach one or more shapes.
|
||||||
* if you create body with createXXX, it will automatically compute mass and moment with density your specified(which is PHYSICSBODY_MATERIAL_DEFAULT by default, and the density value is 0.1f), and it based on the formular: mass = density * area.
|
* if you create body with createXXX, it will automatically compute mass and moment with density your specified(which is PHYSICSBODY_MATERIAL_DEFAULT by default, and the density value is 0.1f), and it based on the formular: mass = density * area.
|
||||||
* if you create body with createEdgeXXX, the mass and moment will be INFINITY by default. and it's a static body.
|
* if you create body with createEdgeXXX, the mass and moment will be PHYSICS_INFINITY by default. and it's a static body.
|
||||||
* you can change mass and moment with setMass() and setMoment(). and you can change the body to be dynamic or static by use function setDynamic().
|
* you can change mass and moment with setMass() and setMoment(). and you can change the body to be dynamic or static by use function setDynamic().
|
||||||
*/
|
*/
|
||||||
class PhysicsBody : public Object
|
class PhysicsBody : public Object
|
||||||
|
|
|
@ -23,19 +23,12 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#include "CCPhysicsContact.h"
|
#include "CCPhysicsContact.h"
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
#include "chipmunk.h"
|
#include "chipmunk.h"
|
||||||
#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D)
|
|
||||||
#include "Box2D.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CCPhysicsBody.h"
|
#include "CCPhysicsBody.h"
|
||||||
|
|
||||||
#include "chipmunk/CCPhysicsContactInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsContactInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsContactInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsHelper_box2d.h"
|
|
||||||
|
|
||||||
#include "CCEventCustom.h"
|
#include "CCEventCustom.h"
|
||||||
|
|
||||||
|
@ -105,7 +98,7 @@ void PhysicsContact::generateContactData()
|
||||||
cpArbiter* arb = static_cast<cpArbiter*>(_contactInfo);
|
cpArbiter* arb = static_cast<cpArbiter*>(_contactInfo);
|
||||||
_contactData = new PhysicsContactData();
|
_contactData = new PhysicsContactData();
|
||||||
_contactData->count = cpArbiterGetCount(arb);
|
_contactData->count = cpArbiterGetCount(arb);
|
||||||
for (int i=0; i<_contactData->count; ++i)
|
for (int i=0; i<_contactData->count && i<PhysicsContactData::POINT_MAX; ++i)
|
||||||
{
|
{
|
||||||
_contactData->points[i] = PhysicsHelper::cpv2point(cpArbiterGetPoint(arb, i));
|
_contactData->points[i] = PhysicsHelper::cpv2point(cpArbiterGetPoint(arb, i));
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#ifndef __CCPHYSICS_CONTACT_H__
|
#ifndef __CCPHYSICS_CONTACT_H__
|
||||||
#define __CCPHYSICS_CONTACT_H__
|
#define __CCPHYSICS_CONTACT_H__
|
||||||
|
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
|
@ -41,10 +40,12 @@ class PhysicsWorld;
|
||||||
|
|
||||||
class PhysicsContactInfo;
|
class PhysicsContactInfo;
|
||||||
|
|
||||||
|
typedef Point Vect;
|
||||||
|
|
||||||
typedef struct PhysicsContactData
|
typedef struct PhysicsContactData
|
||||||
{
|
{
|
||||||
Point points[PHYSICS_CONTACT_POINT_MAX];
|
static const long POINT_MAX = 4;
|
||||||
|
Point points[POINT_MAX];
|
||||||
int count;
|
int count;
|
||||||
Point normal;
|
Point normal;
|
||||||
|
|
||||||
|
|
|
@ -24,24 +24,15 @@
|
||||||
|
|
||||||
#include "CCPhysicsJoint.h"
|
#include "CCPhysicsJoint.h"
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
#include "chipmunk.h"
|
#include "chipmunk.h"
|
||||||
#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D)
|
|
||||||
#include "Box2D.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CCPhysicsBody.h"
|
#include "CCPhysicsBody.h"
|
||||||
#include "CCPhysicsWorld.h"
|
#include "CCPhysicsWorld.h"
|
||||||
|
|
||||||
#include "chipmunk/CCPhysicsJointInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsJointInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsJointInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsBodyInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsShapeInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsHelper_box2d.h"
|
|
||||||
#include "CCNode.h"
|
#include "CCNode.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
@ -71,19 +62,15 @@ bool PhysicsJoint::init(cocos2d::PhysicsBody *a, cocos2d::PhysicsBody *b)
|
||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
CCASSERT(a != nullptr && b != nullptr, "the body passed in is nil");
|
||||||
|
CCASSERT(a != b, "the two bodies are equal");
|
||||||
|
|
||||||
CC_BREAK_IF(!(_info = new PhysicsJointInfo(this)));
|
CC_BREAK_IF(!(_info = new PhysicsJointInfo(this)));
|
||||||
|
|
||||||
if (a != nullptr)
|
_bodyA = a;
|
||||||
{
|
_bodyA->_joints.push_back(this);
|
||||||
_bodyA = a;
|
_bodyB = b;
|
||||||
_bodyA->_joints.push_back(this);
|
_bodyB->_joints.push_back(this);
|
||||||
}
|
|
||||||
|
|
||||||
if (b != nullptr)
|
|
||||||
{
|
|
||||||
_bodyB = b;
|
|
||||||
_bodyB->_joints.push_back(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
} while (false);
|
} while (false);
|
||||||
|
@ -150,7 +137,6 @@ PhysicsJointDistance::~PhysicsJointDistance()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
PhysicsBodyInfo* PhysicsJoint::getBodyInfo(PhysicsBody* body) const
|
PhysicsBodyInfo* PhysicsJoint::getBodyInfo(PhysicsBody* body) const
|
||||||
{
|
{
|
||||||
return body->_info;
|
return body->_info;
|
||||||
|
@ -375,9 +361,5 @@ bool PhysicsJointDistance::init(PhysicsBody* a, PhysicsBody* b, const Point& anc
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#ifndef __CCPHYSICS_JOINT_H__
|
#ifndef __CCPHYSICS_JOINT_H__
|
||||||
#define __CCPHYSICS_JOINT_H__
|
#define __CCPHYSICS_JOINT_H__
|
||||||
|
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __CCPHYSICS_SETTING_H__
|
|
||||||
#define __CCPHYSICS_SETTING_H__
|
|
||||||
|
|
||||||
#define CC_PHYSICS_UNKNOWN 0
|
|
||||||
#define CC_PHYSICS_BOX2D 1
|
|
||||||
#define CC_PHYSICS_CHIPMUNK 2
|
|
||||||
|
|
||||||
#define CC_USE_CHIPMUNK
|
|
||||||
|
|
||||||
#ifdef CC_USE_BOX2D
|
|
||||||
#define CC_PHYSICS_ENGINE CC_PHYSICS_BOX2D
|
|
||||||
#elif defined(CC_USE_CHIPMUNK)
|
|
||||||
#define CC_PHYSICS_ENGINE CC_PHYSICS_CHIPMUNK
|
|
||||||
#else
|
|
||||||
#define CC_PHYSICS_ENGINE CC_PHYSICS_UNKNOWN
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE != CC_PHYSICS_UNKNOWN)
|
|
||||||
#define CC_USE_PHYSICS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace cocos2d
|
|
||||||
{
|
|
||||||
extern const float PHYSICS_INFINITY;
|
|
||||||
|
|
||||||
class Point;
|
|
||||||
typedef Point Vect;
|
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
static const int PHYSICS_CONTACT_POINT_MAX = 4;
|
|
||||||
#else
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif // __CCPHYSICS_SETTING_H__
|
|
|
@ -27,22 +27,17 @@
|
||||||
|
|
||||||
#include <climits>
|
#include <climits>
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
#include "chipmunk.h"
|
#include "chipmunk.h"
|
||||||
#elif (CC_PHYSICS_ENGINE == CCPHYSICS_BOX2D)
|
|
||||||
#include "Box2D.h"
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include "CCPhysicsBody.h"
|
#include "CCPhysicsBody.h"
|
||||||
#include "CCPhysicsWorld.h"
|
#include "CCPhysicsWorld.h"
|
||||||
|
|
||||||
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsBodyInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsBodyInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
#include "chipmunk/CCPhysicsShapeInfo_chipmunk.h"
|
||||||
#include "box2d/CCPhysicsShapeInfo_box2d.h"
|
|
||||||
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
#include "chipmunk/CCPhysicsHelper_chipmunk.h"
|
||||||
|
|
||||||
NS_CC_BEGIN
|
NS_CC_BEGIN
|
||||||
|
extern const float PHYSICS_INFINITY;
|
||||||
|
|
||||||
PhysicsShape::PhysicsShape()
|
PhysicsShape::PhysicsShape()
|
||||||
: _body(nullptr)
|
: _body(nullptr)
|
||||||
|
@ -195,7 +190,6 @@ PhysicsShapeEdgeSegment::~PhysicsShapeEdgeSegment()
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_CHIPMUNK)
|
|
||||||
void PhysicsShape::setDensity(float density)
|
void PhysicsShape::setDensity(float density)
|
||||||
{
|
{
|
||||||
if (density < 0)
|
if (density < 0)
|
||||||
|
@ -810,10 +804,6 @@ bool PhysicsShape::containsPoint(const Point& point) const
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#elif (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#ifndef __CCPHYSICS_SHAPE_H__
|
#ifndef __CCPHYSICS_SHAPE_H__
|
||||||
#define __CCPHYSICS_SHAPE_H__
|
#define __CCPHYSICS_SHAPE_H__
|
||||||
|
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#include "CCObject.h"
|
#include "CCObject.h"
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -25,7 +25,6 @@
|
||||||
#ifndef __CCPHYSICS_WORLD_H__
|
#ifndef __CCPHYSICS_WORLD_H__
|
||||||
#define __CCPHYSICS_WORLD_H__
|
#define __CCPHYSICS_WORLD_H__
|
||||||
|
|
||||||
#include "CCPhysicsSetting.h"
|
|
||||||
#ifdef CC_USE_PHYSICS
|
#ifdef CC_USE_PHYSICS
|
||||||
|
|
||||||
#include <list>
|
#include <list>
|
||||||
|
@ -43,6 +42,8 @@ class PhysicsShape;
|
||||||
class PhysicsContact;
|
class PhysicsContact;
|
||||||
class Array;
|
class Array;
|
||||||
|
|
||||||
|
typedef Point Vect;
|
||||||
|
|
||||||
class Sprite;
|
class Sprite;
|
||||||
class Scene;
|
class Scene;
|
||||||
class DrawNode;
|
class DrawNode;
|
||||||
|
@ -201,6 +202,7 @@ protected:
|
||||||
|
|
||||||
friend class PhysicsWorld;
|
friend class PhysicsWorld;
|
||||||
};
|
};
|
||||||
|
extern const float PHYSICS_INFINITY;
|
||||||
|
|
||||||
NS_CC_END
|
NS_CC_END
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,4 @@
|
||||||
set(COCOS_PHYSICS_SRC
|
set(COCOS_PHYSICS_SRC
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsContactInfo_box2d.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsJointInfo_box2d.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsShapeInfo_box2d.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsBodyInfo_box2d.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/box2d/CCPhysicsWorldInfo_box2d.cpp
|
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp
|
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsContactInfo_chipmunk.cpp
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp
|
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsJointInfo_chipmunk.cpp
|
||||||
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp
|
${CMAKE_SOURCE_DIR}/cocos/physics/chipmunk/CCPhysicsShapeInfo_chipmunk.cpp
|
||||||
|
|
|
@ -1,39 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "CCPhysicsBodyInfo_box2d.h"
|
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
NS_CC_BEGIN
|
|
||||||
|
|
||||||
PhysicsBodyInfo::PhysicsBodyInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysicsBodyInfo::~PhysicsBodyInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_CC_END
|
|
||||||
#endif // CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D
|
|
|
@ -1,45 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#ifndef __CCPHYSICS_BODY_INFO_BOX2D_H__
|
|
||||||
#define __CCPHYSICS_BODY_INFO_BOX2D_H__
|
|
||||||
|
|
||||||
#include "../CCPhysicsSetting.h"
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
|
|
||||||
#include "CCPlatformMacros.h"
|
|
||||||
|
|
||||||
NS_CC_BEGIN
|
|
||||||
|
|
||||||
class PhysicsBodyInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
PhysicsBodyInfo();
|
|
||||||
~PhysicsBodyInfo();
|
|
||||||
};
|
|
||||||
|
|
||||||
NS_CC_END
|
|
||||||
|
|
||||||
#endif // CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D
|
|
||||||
#endif // __CCPHYSICS_BODY_INFO_BOX2D_H__
|
|
|
@ -1,39 +0,0 @@
|
||||||
/****************************************************************************
|
|
||||||
Copyright (c) 2013 cocos2d-x.org
|
|
||||||
|
|
||||||
http://www.cocos2d-x.org
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "CCPhysicsContactInfo_box2d.h"
|
|
||||||
|
|
||||||
#if (CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D)
|
|
||||||
NS_CC_BEGIN
|
|
||||||
|
|
||||||
PhysicsContactInfo::PhysicsContactInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
PhysicsContactInfo::~PhysicsContactInfo()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_CC_END
|
|
||||||
#endif // CC_PHYSICS_ENGINE == CC_PHYSICS_BOX2D
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue