mirror of https://github.com/axmolengine/axmol.git
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-x into iss2771_physical
This commit is contained in:
commit
72f2d68edd
6
AUTHORS
6
AUTHORS
|
@ -659,6 +659,12 @@ Developers:
|
|||
bopohaa
|
||||
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:
|
||||
WenSheng Yang
|
||||
Author of windows port, CCTextField,
|
||||
|
|
|
@ -1,3 +1,9 @@
|
|||
cocos2d-x-3.0beta0 ?? 2013
|
||||
[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
|
||||
[all platforms]
|
||||
[DOC] Added RELEASE_NOTES and CODING_STYLE.md files
|
||||
|
@ -43,6 +49,7 @@ cocos2d-x-3.0alpha1 Nov.19 2013
|
|||
[NEW] Performance Test: Sprite drawing
|
||||
[NEW] Adjusted folder structure
|
||||
[NEW] Added tools to simplify upgrading game codes from v2.x to v3.x
|
||||
[FIX] Added virtual destructors on Interfaces
|
||||
[Android]
|
||||
[FIX] Added EGL_RENDERABLE_TYPE to OpenGL attributes
|
||||
[FIX] Fixed application will crash when pause and resume.
|
||||
|
|
|
@ -15,8 +15,10 @@ ALL_SAMPLES = CPP_SAMPLES + LUA_SAMPLES + JSB_SAMPLES
|
|||
|
||||
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
|
||||
|crystalcraze|moonwarriors|testjavascript|watermelonwithme]
|
||||
|
||||
|
@ -33,6 +35,18 @@ def check_environment_variables():
|
|||
sys.exit(1)
|
||||
|
||||
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():
|
||||
'''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)
|
||||
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")
|
||||
|
||||
|
@ -97,7 +111,19 @@ def do_build(cocos_root, ndk_root, app_android_root, ndk_build_param):
|
|||
else:
|
||||
command = '%s -C %s %s %s' % (ndk_path, app_android_root, ndk_build_param, ndk_module_path)
|
||||
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):
|
||||
|
||||
|
@ -169,15 +195,29 @@ def copy_resources(target, app_android_root):
|
|||
resources_dir = os.path.join(app_android_root, "../../../Cpp/TestCpp/Resources")
|
||||
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()
|
||||
sdk_root = None
|
||||
select_toolchain_version()
|
||||
build_targets = caculate_built_samples(target)
|
||||
|
||||
current_dir = os.path.dirname(os.path.realpath(__file__))
|
||||
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 = ''
|
||||
for target in build_targets:
|
||||
if target == 'hellocpp':
|
||||
|
@ -207,7 +247,7 @@ def build_samples(target,ndk_build_param):
|
|||
continue
|
||||
|
||||
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 --------------
|
||||
if __name__ == '__main__':
|
||||
|
@ -215,13 +255,15 @@ if __name__ == '__main__':
|
|||
#parse the params
|
||||
parser = OptionParser()
|
||||
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()
|
||||
|
||||
if len(args) == 0:
|
||||
usage()
|
||||
else:
|
||||
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:
|
||||
print e
|
||||
sys.exit(1)
|
||||
|
|
|
@ -1 +1 @@
|
|||
da0114d4d804843cb56ee8294fbe42f645c0183c
|
||||
f9416b73efef54140650372b509bfe22727cb00f
|
|
@ -1 +1 @@
|
|||
9fd236eacc216f0d21f06bfa698d92e28cc4a92a
|
||||
2c04a1aefcf0da7137ddc5e3ca807fe82d975f4d
|
|
@ -46,15 +46,6 @@ class CC_DLL Action : public Object, public Clonable
|
|||
public:
|
||||
/// Default tag used for all the actions
|
||||
static const int INVALID_TAG = -1;
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Action();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Action();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -108,6 +99,9 @@ public:
|
|||
inline void setTag(int tag) { _tag = tag; }
|
||||
|
||||
protected:
|
||||
Action();
|
||||
virtual ~Action();
|
||||
|
||||
Node *_originalTarget;
|
||||
/** The "target".
|
||||
The target will be set with the 'startWithTarget' method.
|
||||
|
@ -117,6 +111,9 @@ protected:
|
|||
Node *_target;
|
||||
/** The action tag. An identifier of the action */
|
||||
int _tag;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Action);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -131,17 +128,6 @@ protected:
|
|||
class CC_DLL FiniteTimeAction : public Action
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
FiniteTimeAction()
|
||||
: _duration(0)
|
||||
{}
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~FiniteTimeAction(){}
|
||||
//! get duration in seconds of the action
|
||||
inline float getDuration() const { return _duration; }
|
||||
//! set duration in seconds of the action
|
||||
|
@ -154,8 +140,16 @@ public:
|
|||
virtual FiniteTimeAction* clone() const override = 0;
|
||||
|
||||
protected:
|
||||
FiniteTimeAction()
|
||||
: _duration(0)
|
||||
{}
|
||||
virtual ~FiniteTimeAction(){}
|
||||
|
||||
//! duration in seconds
|
||||
float _duration;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
||||
};
|
||||
|
||||
class ActionInterval;
|
||||
|
@ -172,22 +166,11 @@ class CC_DLL Speed : public Action
|
|||
public:
|
||||
/** create the action */
|
||||
static Speed* create(ActionInterval* action, float speed);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Speed();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Speed(void);
|
||||
|
||||
inline float getSpeed(void) const { return _speed; }
|
||||
/** alter the speed of the inner function in runtime */
|
||||
inline void setSpeed(float speed) { _speed = speed; }
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action, float speed);
|
||||
|
||||
void setInnerAction(ActionInterval *action);
|
||||
|
||||
|
@ -204,8 +187,16 @@ public:
|
|||
virtual bool isDone() const override;
|
||||
|
||||
protected:
|
||||
Speed();
|
||||
virtual ~Speed(void);
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action, float speed);
|
||||
|
||||
float _speed;
|
||||
ActionInterval *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Speed);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -230,38 +221,11 @@ public:
|
|||
* with no boundary.
|
||||
*/
|
||||
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; }
|
||||
/** alter behavior - turn on/off boundary */
|
||||
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
|
||||
//
|
||||
|
@ -272,6 +236,33 @@ public:
|
|||
virtual void stop() override;
|
||||
|
||||
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 *_followedNode;
|
||||
|
||||
|
@ -292,6 +283,8 @@ protected:
|
|||
float _bottomBoundary;
|
||||
Rect _worldRect;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Follow);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -44,14 +44,6 @@ class Object;
|
|||
class CC_DLL ActionEase : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ActionEase(void);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action);
|
||||
|
||||
virtual ActionInterval* getInnerAction();
|
||||
|
||||
|
@ -65,8 +57,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ActionEase() {}
|
||||
virtual ~ActionEase();
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *action);
|
||||
|
||||
/** The inner action */
|
||||
ActionInterval *_inner;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -76,15 +76,6 @@ protected:
|
|||
class CC_DLL EaseRateAction : public ActionEase
|
||||
{
|
||||
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 */
|
||||
inline void setRate(float rate) { _rate = rate; }
|
||||
/** get rate value for the actions */
|
||||
|
@ -97,7 +88,15 @@ public:
|
|||
virtual EaseRateAction* reverse() const override = 0;
|
||||
|
||||
protected:
|
||||
EaseRateAction() {}
|
||||
virtual ~EaseRateAction();
|
||||
/** Initializes the action with the inner action and the rate parameter */
|
||||
bool initWithAction(ActionInterval *pAction, float fRate);
|
||||
|
||||
float _rate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -114,6 +113,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseIn* clone() 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 EaseOut* clone() 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 EaseInOut* clone() 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 EaseExponentialIn* clone() 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 EaseExponentialOut* clone() 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 EaseExponentialInOut* clone() 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 EaseSineIn* clone() 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 EaseSineOut* clone() 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 EaseSineInOut* clone() 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
|
||||
{
|
||||
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 */
|
||||
inline float getPeriod() const { return _period; }
|
||||
|
@ -267,7 +327,16 @@ public:
|
|||
virtual EaseElastic* reverse() const override = 0;
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -287,6 +356,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual EaseElasticIn* clone() 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 EaseElasticOut* clone() 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 EaseElasticInOut* clone() const override;
|
||||
virtual EaseElasticInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseElasticInOut() {}
|
||||
virtual ~EaseElasticInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElasticInOut);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -340,6 +430,13 @@ public:
|
|||
// Overrides
|
||||
virtual EaseBounce* clone() 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 EaseBounceIn* clone() 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 EaseBounceOut* clone() 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 EaseBounceInOut* clone() 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 EaseBackIn* clone() 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 EaseBackOut* clone() 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 EaseBackInOut* clone() const override;
|
||||
virtual EaseBackInOut* reverse() const override;
|
||||
|
||||
protected:
|
||||
EaseBackInOut() {}
|
||||
virtual ~EaseBackInOut() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBackInOut);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -41,8 +41,6 @@ class GridBase;
|
|||
class CC_DLL GridAction : public ActionInterval
|
||||
{
|
||||
public:
|
||||
/** initializes the action with size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize);
|
||||
|
||||
/** returns the grid */
|
||||
virtual GridBase* getGrid();
|
||||
|
@ -53,7 +51,15 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
GridAction() {}
|
||||
virtual ~GridAction() {}
|
||||
/** initializes the action with size and duration */
|
||||
bool initWithDuration(float duration, const Size& gridSize);
|
||||
|
||||
Size _gridSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -153,18 +159,6 @@ class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
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 */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
|
@ -174,10 +168,20 @@ public:
|
|||
// Overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual AccelDeccelAmplitude* clone() const override;
|
||||
virtual AccelDeccelAmplitude* reverse() const override;
|
||||
|
||||
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;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief AccelAmplitude action */
|
||||
|
@ -186,14 +190,6 @@ class CC_DLL AccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
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 */
|
||||
inline float getRate() const { return _rate; }
|
||||
|
@ -207,8 +203,15 @@ public:
|
|||
virtual AccelAmplitude* reverse() const override;
|
||||
|
||||
protected:
|
||||
AccelAmplitude() {}
|
||||
virtual ~AccelAmplitude();
|
||||
bool initWithAction(Action *action, float duration);
|
||||
|
||||
float _rate;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief DeccelAmplitude action */
|
||||
|
@ -217,13 +220,6 @@ class CC_DLL DeccelAmplitude : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an inner action that has the amplitude property, and a duration time */
|
||||
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 */
|
||||
inline float getRate(void) const { return _rate; }
|
||||
|
@ -233,12 +229,20 @@ public:
|
|||
// overrides
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual void update(float time) override;
|
||||
virtual DeccelAmplitude* clone() const;
|
||||
virtual DeccelAmplitude* reverse() const;
|
||||
virtual DeccelAmplitude* clone() const override;
|
||||
virtual DeccelAmplitude* reverse() const override;
|
||||
|
||||
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;
|
||||
ActionInterval *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
||||
};
|
||||
|
||||
/** @brief StopGrid action.
|
||||
|
@ -256,6 +260,13 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual StopGrid* clone() const override;
|
||||
virtual StopGrid* reverse() const override;
|
||||
|
||||
protected:
|
||||
StopGrid() {}
|
||||
virtual ~StopGrid() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
||||
};
|
||||
|
||||
/** @brief ReuseGrid action */
|
||||
|
@ -265,16 +276,21 @@ public:
|
|||
/** creates an action with the number of times that the current grid will be reused */
|
||||
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
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual ReuseGrid* clone() const override;
|
||||
virtual ReuseGrid* reverse() const override;
|
||||
|
||||
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;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -53,17 +53,22 @@ public:
|
|||
/** sets the ampliture rate */
|
||||
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
|
||||
virtual Waves3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
||||
};
|
||||
|
||||
/** @brief FlipX3D action */
|
||||
|
@ -73,25 +78,36 @@ public:
|
|||
/** creates the action with 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 */
|
||||
bool initWithDuration(float duration);
|
||||
virtual bool initWithSize(const Size& gridSize, float duration);
|
||||
|
||||
// Override
|
||||
virtual FlipX3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
||||
};
|
||||
|
||||
/** @brief FlipY3D action */
|
||||
class CC_DLL FlipY3D : public FlipX3D
|
||||
{
|
||||
public:
|
||||
FlipY3D() {}
|
||||
virtual ~FlipY3D() {}
|
||||
/** creates the action with duration */
|
||||
static FlipY3D* create(float duration);
|
||||
|
||||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FlipY3D* clone() const override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
||||
};
|
||||
|
||||
/** @brief Lens3D action */
|
||||
|
@ -111,14 +127,16 @@ public:
|
|||
inline const Point& getPosition() const { return _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
|
||||
virtual Lens3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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 */
|
||||
Point _position;
|
||||
float _radius;
|
||||
|
@ -128,6 +146,9 @@ protected:
|
|||
bool _concave;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
||||
};
|
||||
|
||||
/** @brief Ripple3D action */
|
||||
|
@ -148,45 +169,57 @@ public:
|
|||
inline float getAmplitudeRate() const { return _amplitudeRate; }
|
||||
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
|
||||
virtual Ripple3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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 */
|
||||
Point _position;
|
||||
float _radius;
|
||||
unsigned int _waves;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
||||
};
|
||||
|
||||
/** @brief Shaky3D action */
|
||||
class CC_DLL Shaky3D : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Shaky3D() {}
|
||||
virtual ~Shaky3D() {}
|
||||
/** 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);
|
||||
|
||||
/** 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
|
||||
virtual Shaky3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
bool _shakeZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
||||
};
|
||||
|
||||
/** @brief Liquid action */
|
||||
class CC_DLL Liquid : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Liquid() {}
|
||||
virtual ~Liquid() {}
|
||||
/** creates the action with amplitude, a grid and duration */
|
||||
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 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
|
||||
virtual Liquid* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
||||
};
|
||||
|
||||
/** @brief Waves action */
|
||||
class CC_DLL Waves : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Waves() {}
|
||||
virtual ~Waves() {}
|
||||
/** 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);
|
||||
|
||||
|
@ -222,25 +260,30 @@ public:
|
|||
inline float getAmplitudeRate() const { return _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
|
||||
virtual Waves* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
bool _vertical;
|
||||
bool _horizontal;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
|
||||
};
|
||||
|
||||
/** @brief Twirl action */
|
||||
class CC_DLL Twirl : public Grid3DAction
|
||||
{
|
||||
public:
|
||||
Twirl() {}
|
||||
virtual ~Twirl() {}
|
||||
/** 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);
|
||||
|
||||
|
@ -255,19 +298,23 @@ public:
|
|||
inline float getAmplitudeRate() const { return _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
|
||||
virtual Twirl* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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 */
|
||||
Point _position;
|
||||
unsigned int _twirls;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -472,7 +472,7 @@ CallFuncN * CallFuncN::clone() const
|
|||
if( _selectorTarget) {
|
||||
a->initWithTarget(_selectorTarget, _callFuncN);
|
||||
}
|
||||
else if( _function ){
|
||||
else if( _functionN ){
|
||||
a->initWithFunction(_functionN);
|
||||
}
|
||||
|
||||
|
|
|
@ -65,7 +65,6 @@ public:
|
|||
/** Allocates and initializes the action */
|
||||
static Show * create();
|
||||
|
||||
Show(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -73,6 +72,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual ActionInstant* reverse() 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 */
|
||||
static Hide * create();
|
||||
|
||||
Hide(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void update(float time) override;
|
||||
virtual ActionInstant* reverse() 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
|
||||
|
@ -102,14 +113,19 @@ public:
|
|||
/** Allocates and initializes the action */
|
||||
static ToggleVisibility * create();
|
||||
|
||||
ToggleVisibility(){}
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void update(float time) override;
|
||||
virtual ToggleVisibility* reverse() 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 */
|
||||
static RemoveSelf * create(bool isNeedCleanUp = true);
|
||||
|
||||
RemoveSelf():_isNeedCleanUp(true)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool init(bool isNeedCleanUp);
|
||||
|
||||
//
|
||||
// Override
|
||||
//
|
||||
|
@ -135,7 +145,15 @@ public:
|
|||
virtual RemoveSelf* reverse() const override;
|
||||
|
||||
protected:
|
||||
RemoveSelf() : _isNeedCleanUp(true){}
|
||||
virtual ~RemoveSelf(){}
|
||||
/** init the action */
|
||||
bool init(bool isNeedCleanUp);
|
||||
|
||||
bool _isNeedCleanUp;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -148,13 +166,6 @@ public:
|
|||
/** create the action */
|
||||
static FlipX * create(bool x);
|
||||
|
||||
FlipX()
|
||||
:_flipX(false)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool initWithFlipX(bool x);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -163,7 +174,15 @@ public:
|
|||
virtual FlipX* clone() const override;
|
||||
|
||||
protected:
|
||||
FlipX() :_flipX(false) {}
|
||||
virtual ~FlipX() {}
|
||||
/** init the action */
|
||||
bool initWithFlipX(bool x);
|
||||
|
||||
bool _flipX;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -176,13 +195,6 @@ public:
|
|||
/** create the action */
|
||||
static FlipY * create(bool y);
|
||||
|
||||
FlipY()
|
||||
:_flipY(false)
|
||||
{}
|
||||
|
||||
/** init the action */
|
||||
bool initWithFlipY(bool y);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -191,7 +203,15 @@ public:
|
|||
virtual FlipY* clone() const override;
|
||||
|
||||
protected:
|
||||
FlipY() :_flipY(false) {}
|
||||
virtual ~FlipY() {}
|
||||
/** init the action */
|
||||
bool initWithFlipY(bool y);
|
||||
|
||||
bool _flipY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
||||
};
|
||||
|
||||
/** @brief Places the node in a certain position
|
||||
|
@ -199,12 +219,9 @@ protected:
|
|||
class CC_DLL Place : public ActionInstant //<NSCopying>
|
||||
{
|
||||
public:
|
||||
Place(){}
|
||||
|
||||
/** creates a Place action with a position */
|
||||
static Place * create(const Point& pos);
|
||||
/** Initializes a Place action with a position */
|
||||
bool initWithPosition(const Point& pos);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -214,7 +231,15 @@ public:
|
|||
virtual Place* clone() const override;
|
||||
|
||||
protected:
|
||||
Place(){}
|
||||
virtual ~Place(){}
|
||||
/** Initializes a Place action with a position */
|
||||
bool initWithPosition(const Point& pos);
|
||||
|
||||
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);
|
||||
|
||||
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 */
|
||||
virtual void execute();
|
||||
|
||||
|
@ -293,6 +291,26 @@ public:
|
|||
virtual CallFunc* clone() const override;
|
||||
|
||||
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 */
|
||||
Object* _selectorTarget;
|
||||
|
||||
|
@ -304,6 +322,9 @@ protected:
|
|||
|
||||
/** function that will be called */
|
||||
std::function<void()> _function;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -324,19 +345,6 @@ public:
|
|||
@deprecated Use the std::function API instead.
|
||||
*/
|
||||
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
|
||||
|
@ -345,8 +353,24 @@ public:
|
|||
virtual void execute() override;
|
||||
|
||||
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 */
|
||||
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 */
|
||||
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
|
||||
//
|
||||
|
@ -373,8 +392,17 @@ public:
|
|||
virtual void execute() override;
|
||||
|
||||
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;
|
||||
void* _data;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncND);
|
||||
};
|
||||
|
||||
|
||||
|
@ -393,24 +421,6 @@ public:
|
|||
typedef void (Object::*SEL_CallFuncO)(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
|
||||
//
|
||||
|
@ -421,9 +431,21 @@ public:
|
|||
void setObject(Object* obj);
|
||||
|
||||
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* _object;
|
||||
SEL_CallFuncO _callFuncO;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(__CCCallFuncO);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -149,13 +149,13 @@ void ActionInterval::startWithTarget(Node *target)
|
|||
// Sequence
|
||||
//
|
||||
|
||||
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo)
|
||||
Sequence* Sequence::createWithTwoActions(FiniteTimeAction *actionOne, FiniteTimeAction *actionTwo)
|
||||
{
|
||||
Sequence *pSequence = new Sequence();
|
||||
pSequence->initWithTwoActions(pActionOne, pActionTwo);
|
||||
pSequence->autorelease();
|
||||
Sequence *sequence = new Sequence();
|
||||
sequence->initWithTwoActions(actionOne, actionTwo);
|
||||
sequence->autorelease();
|
||||
|
||||
return pSequence;
|
||||
return sequence;
|
||||
}
|
||||
|
||||
Sequence* Sequence::create(FiniteTimeAction *pAction1, ...)
|
||||
|
@ -210,7 +210,7 @@ Sequence* Sequence::create(Array* arrayOfActions)
|
|||
|
||||
if (count > 1)
|
||||
{
|
||||
for (unsigned int i = 1; i < count; ++i)
|
||||
for (long i = 1; i < count; ++i)
|
||||
{
|
||||
prev = createWithTwoActions(prev, static_cast<FiniteTimeAction*>(arrayOfActions->getObjectAtIndex(i)));
|
||||
}
|
||||
|
@ -220,7 +220,7 @@ Sequence* Sequence::create(Array* arrayOfActions)
|
|||
// If only one action is added to Sequence, make up a Sequence by adding a simplest finite time action.
|
||||
prev = createWithTwoActions(prev, ExtraAction::create());
|
||||
}
|
||||
pRet = (Sequence*)prev;
|
||||
pRet = static_cast<Sequence*>(prev);
|
||||
}while (0);
|
||||
return pRet;
|
||||
}
|
||||
|
@ -597,13 +597,13 @@ Spawn* Spawn::create(Array *arrayOfActions)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
||||
Spawn* Spawn::createWithTwoActions(FiniteTimeAction *action1, FiniteTimeAction *action2)
|
||||
{
|
||||
Spawn *pSpawn = new Spawn();
|
||||
pSpawn->initWithTwoActions(pAction1, pAction2);
|
||||
pSpawn->autorelease();
|
||||
Spawn *spawn = new Spawn();
|
||||
spawn->initWithTwoActions(action1, action2);
|
||||
spawn->autorelease();
|
||||
|
||||
return pSpawn;
|
||||
return spawn;
|
||||
}
|
||||
|
||||
bool Spawn:: initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2)
|
||||
|
|
|
@ -64,9 +64,6 @@ public:
|
|||
/** how many seconds had elapsed since the actions started to run. */
|
||||
inline float getElapsed(void) { return _elapsed; }
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float d);
|
||||
|
||||
//extension in GridAction
|
||||
void setAmplitudeRate(float amp);
|
||||
float getAmplitudeRate(void);
|
||||
|
@ -80,8 +77,10 @@ public:
|
|||
virtual ActionInterval* reverse() const override = 0;
|
||||
virtual ActionInterval *clone() const override = 0;
|
||||
|
||||
|
||||
protected:
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float d);
|
||||
|
||||
float _elapsed;
|
||||
bool _firstTick;
|
||||
};
|
||||
|
@ -105,14 +104,6 @@ public:
|
|||
static Sequence* createWithVariableList(FiniteTimeAction *pAction1, va_list args);
|
||||
/** creates the action */
|
||||
static Sequence* createWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Sequence(void);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -124,9 +115,17 @@ public:
|
|||
virtual void update(float t) override;
|
||||
|
||||
protected:
|
||||
Sequence() {}
|
||||
virtual ~Sequence(void);
|
||||
/** initializes the action */
|
||||
bool initWithTwoActions(FiniteTimeAction *pActionOne, FiniteTimeAction *pActionTwo);
|
||||
|
||||
FiniteTimeAction *_actions[2];
|
||||
float _split;
|
||||
int _last;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
||||
};
|
||||
|
||||
/** @brief Repeats an action a number of times.
|
||||
|
@ -137,14 +136,6 @@ class CC_DLL Repeat : public ActionInterval
|
|||
public:
|
||||
/** creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30) */
|
||||
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)
|
||||
{
|
||||
|
@ -172,12 +163,20 @@ public:
|
|||
virtual bool isDone(void) const override;
|
||||
|
||||
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 _total;
|
||||
float _nextDt;
|
||||
bool _actionInstant;
|
||||
/** Inner action */
|
||||
FiniteTimeAction *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
||||
};
|
||||
|
||||
/** @brief Repeats an action for ever.
|
||||
|
@ -189,20 +188,6 @@ class CC_DLL RepeatForever : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
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)
|
||||
{
|
||||
|
@ -229,8 +214,18 @@ public:
|
|||
virtual bool isDone(void) const override;
|
||||
|
||||
protected:
|
||||
RepeatForever()
|
||||
: _innerAction(nullptr)
|
||||
{}
|
||||
virtual ~RepeatForever();
|
||||
/** initializes the action */
|
||||
bool initWithAction(ActionInterval *pAction);
|
||||
|
||||
/** Inner action */
|
||||
ActionInterval *_innerAction;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
||||
};
|
||||
|
||||
/** @brief Spawn a new action immediately
|
||||
|
@ -255,14 +250,6 @@ public:
|
|||
|
||||
/** creates the Spawn action */
|
||||
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
|
||||
|
@ -274,8 +261,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
Spawn() {}
|
||||
virtual ~Spawn();
|
||||
/** initializes the Spawn action with the 2 actions to spawn */
|
||||
bool initWithTwoActions(FiniteTimeAction *pAction1, FiniteTimeAction *pAction2);
|
||||
|
||||
FiniteTimeAction *_one;
|
||||
FiniteTimeAction *_two;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
||||
};
|
||||
|
||||
/** @brief Rotates a Node object to a certain angle by modifying it's
|
||||
|
@ -290,10 +285,6 @@ public:
|
|||
|
||||
/** creates the action */
|
||||
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
|
||||
|
@ -304,6 +295,12 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
RotateTo() {}
|
||||
virtual ~RotateTo() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
float _dstAngleX;
|
||||
float _startAngleX;
|
||||
float _diffAngleX;
|
||||
|
@ -311,6 +308,9 @@ protected:
|
|||
float _dstAngleY;
|
||||
float _startAngleY;
|
||||
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.
|
||||
|
@ -320,12 +320,7 @@ class CC_DLL RotateBy : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
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);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
//
|
||||
// Override
|
||||
|
@ -336,10 +331,19 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
RotateBy() {}
|
||||
virtual ~RotateBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float fDuration, float fDeltaAngle);
|
||||
bool initWithDuration(float fDuration, float fDeltaAngleX, float fDeltaAngleY);
|
||||
|
||||
float _angleX;
|
||||
float _startAngleX;
|
||||
float _angleY;
|
||||
float _startAngleY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||
};
|
||||
|
||||
/** Moves a Node object x,y pixels by modifying it's position attribute.
|
||||
|
@ -354,9 +358,6 @@ public:
|
|||
/** creates the action */
|
||||
static MoveBy* create(float duration, const Point& deltaPosition);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& deltaPosition);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -366,9 +367,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
MoveBy() {}
|
||||
virtual ~MoveBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& deltaPosition);
|
||||
|
||||
Point _positionDelta;
|
||||
Point _startPosition;
|
||||
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.
|
||||
|
@ -382,9 +391,6 @@ public:
|
|||
/** creates the action */
|
||||
static MoveTo* create(float duration, const Point& position);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -392,7 +398,15 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
protected:
|
||||
MoveTo() {}
|
||||
virtual ~MoveTo() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position);
|
||||
|
||||
Point _endPosition;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
||||
};
|
||||
|
||||
/** Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
||||
|
@ -404,9 +418,6 @@ public:
|
|||
/** creates the action */
|
||||
static SkewTo* create(float t, float sx, float sy);
|
||||
|
||||
SkewTo();
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -416,6 +427,10 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
SkewTo();
|
||||
virtual ~SkewTo() {}
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
float _skewX;
|
||||
float _skewY;
|
||||
float _startSkewX;
|
||||
|
@ -424,6 +439,9 @@ protected:
|
|||
float _endSkewY;
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
||||
};
|
||||
|
||||
/** Skews a Node object by skewX and skewY degrees
|
||||
|
@ -435,14 +453,20 @@ public:
|
|||
/** creates the action */
|
||||
static SkewBy* create(float t, float deltaSkewX, float deltaSkewY);
|
||||
|
||||
bool initWithDuration(float t, float sx, float sy);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
virtual SkewBy* clone() 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.
|
||||
|
@ -453,9 +477,6 @@ public:
|
|||
/** creates the action */
|
||||
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
|
||||
//
|
||||
|
@ -465,11 +486,19 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
JumpBy() {}
|
||||
virtual ~JumpBy() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, const Point& position, float height, int jumps);
|
||||
|
||||
Point _startPosition;
|
||||
Point _delta;
|
||||
float _height;
|
||||
int _jumps;
|
||||
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.
|
||||
|
@ -486,6 +515,11 @@ public:
|
|||
virtual void startWithTarget(Node *target) override;
|
||||
virtual JumpTo* clone() const override;
|
||||
virtual JumpTo* reverse(void) const override;
|
||||
|
||||
private:
|
||||
JumpTo() {}
|
||||
virtual ~JumpTo() {}
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
||||
};
|
||||
|
||||
/** Bezier configuration structure
|
||||
|
@ -513,9 +547,6 @@ public:
|
|||
*/
|
||||
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
|
||||
//
|
||||
|
@ -525,9 +556,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
BezierBy() {}
|
||||
virtual ~BezierBy() {}
|
||||
/** initializes the action with a duration and a bezier configuration */
|
||||
bool initWithDuration(float t, const ccBezierConfig& c);
|
||||
|
||||
ccBezierConfig _config;
|
||||
Point _startPosition;
|
||||
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.
|
||||
|
@ -544,7 +583,6 @@ public:
|
|||
* @endcode
|
||||
*/
|
||||
static BezierTo* create(float t, const ccBezierConfig& c);
|
||||
bool initWithDuration(float t, const ccBezierConfig &c);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -554,7 +592,14 @@ public:
|
|||
virtual BezierTo* reverse(void) const override;
|
||||
|
||||
protected:
|
||||
BezierTo() {}
|
||||
virtual ~BezierTo() {}
|
||||
bool initWithDuration(float t, const ccBezierConfig &c);
|
||||
|
||||
ccBezierConfig _toConfig;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
||||
};
|
||||
|
||||
/** @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 */
|
||||
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
|
||||
//
|
||||
|
@ -584,6 +623,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
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 _scaleY;
|
||||
float _startScaleX;
|
||||
|
@ -592,6 +638,9 @@ protected:
|
|||
float _endScaleY;
|
||||
float _deltaX;
|
||||
float _deltaY;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
||||
};
|
||||
|
||||
/** @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 ScaleBy* clone() 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
|
||||
|
@ -621,9 +677,6 @@ public:
|
|||
/** creates the action */
|
||||
static Blink* create(float duration, int blinks);
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, int blinks);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -634,8 +687,16 @@ public:
|
|||
virtual void stop() override;
|
||||
|
||||
protected:
|
||||
Blink() {}
|
||||
virtual ~Blink() {}
|
||||
/** initializes the action */
|
||||
bool initWithDuration(float duration, int blinks);
|
||||
|
||||
int _times;
|
||||
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.
|
||||
|
@ -653,6 +714,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual FadeIn* clone() 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.
|
||||
|
@ -670,6 +738,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual FadeOut* clone() 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.
|
||||
|
@ -681,9 +756,6 @@ public:
|
|||
/** creates an action with duration and opacity */
|
||||
static FadeTo* create(float duration, GLubyte opacity);
|
||||
|
||||
/** initializes the action with duration and opacity */
|
||||
bool initWithDuration(float duration, GLubyte opacity);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -693,8 +765,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
FadeTo() {}
|
||||
virtual ~FadeTo() {}
|
||||
/** initializes the action with duration and opacity */
|
||||
bool initWithDuration(float duration, GLubyte opacity);
|
||||
|
||||
GLubyte _toOpacity;
|
||||
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.
|
||||
|
@ -707,9 +787,6 @@ public:
|
|||
/** creates an action with duration and color */
|
||||
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
|
||||
//
|
||||
|
@ -719,8 +796,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
TintTo() {}
|
||||
virtual ~TintTo() {}
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLubyte red, GLubyte green, GLubyte blue);
|
||||
|
||||
Color3B _to;
|
||||
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.
|
||||
|
@ -732,9 +817,6 @@ public:
|
|||
/** creates an action with duration and color */
|
||||
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
|
||||
//
|
||||
|
@ -744,6 +826,11 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
TintBy() {}
|
||||
virtual ~TintBy() {}
|
||||
/** initializes the action with duration and color */
|
||||
bool initWithDuration(float duration, GLshort deltaRed, GLshort deltaGreen, GLshort deltaBlue);
|
||||
|
||||
GLshort _deltaR;
|
||||
GLshort _deltaG;
|
||||
GLshort _deltaB;
|
||||
|
@ -751,6 +838,9 @@ protected:
|
|||
GLshort _fromR;
|
||||
GLshort _fromG;
|
||||
GLshort _fromB;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
||||
};
|
||||
|
||||
/** @brief Delays the action a certain amount of seconds
|
||||
|
@ -767,6 +857,13 @@ public:
|
|||
virtual void update(float time) override;
|
||||
virtual DelayTime* reverse() 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
|
||||
|
@ -781,18 +878,6 @@ class CC_DLL ReverseTime : public ActionInterval
|
|||
public:
|
||||
/** creates the action */
|
||||
static ReverseTime* create(FiniteTimeAction *pAction);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ReverseTime(void);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ReverseTime();
|
||||
|
||||
/** initializes the action */
|
||||
bool initWithAction(FiniteTimeAction *pAction);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -804,7 +889,15 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ReverseTime();
|
||||
virtual ~ReverseTime(void);
|
||||
/** initializes the action */
|
||||
bool initWithAction(FiniteTimeAction *pAction);
|
||||
|
||||
FiniteTimeAction *_other;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
||||
};
|
||||
|
||||
class Texture2D;
|
||||
|
@ -814,18 +907,6 @@ class CC_DLL Animate : public ActionInterval
|
|||
public:
|
||||
/** creates the action with an Animation and will restore the original frame when the animation is over */
|
||||
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 */
|
||||
void setAnimation( Animation* animation );
|
||||
|
@ -843,11 +924,19 @@ public:
|
|||
virtual void update(float t) override;
|
||||
|
||||
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;
|
||||
int _nextFrame;
|
||||
SpriteFrame* _origFrame;
|
||||
unsigned int _executedLoops;
|
||||
Animation* _animation;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
|
||||
};
|
||||
|
||||
/** 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
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TargetedAction();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TargetedAction();
|
||||
|
||||
/** Create an action with the specified action and forced target */
|
||||
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 */
|
||||
void setForcedTarget(Node* forcedTarget);
|
||||
/** returns the target that the action is forced to run with */
|
||||
|
@ -887,9 +963,17 @@ public:
|
|||
virtual void stop(void) 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;
|
||||
Node* _forcedTarget;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -44,9 +44,6 @@ public:
|
|||
/** Creates and initializes with a duration and a percent */
|
||||
static ProgressTo* create(float duration, float fPercent);
|
||||
|
||||
/** Initializes with a duration and a percent */
|
||||
bool initWithDuration(float duration, float fPercent);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
@ -56,8 +53,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
protected:
|
||||
ProgressTo() {}
|
||||
virtual ~ProgressTo() {}
|
||||
/** Initializes with a duration and a percent */
|
||||
bool initWithDuration(float duration, float fPercent);
|
||||
|
||||
float _to;
|
||||
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 */
|
||||
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
|
||||
//
|
||||
|
@ -82,8 +84,16 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
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 _from;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
||||
};
|
||||
|
||||
// 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 */
|
||||
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
|
||||
virtual ShakyTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
bool _shakeZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
||||
};
|
||||
|
||||
/** @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 */
|
||||
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
|
||||
virtual ShatteredTiles3D* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
bool _once;
|
||||
bool _shatterZ;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
||||
};
|
||||
|
||||
struct Tile;
|
||||
|
@ -82,13 +92,6 @@ class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
|||
public:
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
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);
|
||||
Size getDelta(const Size& pos) const;
|
||||
|
@ -100,10 +103,18 @@ public:
|
|||
virtual ShuffleTiles* clone() const override;
|
||||
|
||||
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 _tilesCount;
|
||||
unsigned int* _tilesOrder;
|
||||
Tile* _tiles;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutTRTiles action
|
||||
|
@ -123,6 +134,13 @@ public:
|
|||
// Overrides
|
||||
virtual void update(float time) override;
|
||||
virtual FadeOutTRTiles* clone() const override;
|
||||
|
||||
protected:
|
||||
FadeOutTRTiles() {}
|
||||
virtual ~FadeOutTRTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutBLTiles action.
|
||||
|
@ -137,6 +155,13 @@ public:
|
|||
// Overrides
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
virtual FadeOutBLTiles* clone() const override;
|
||||
|
||||
protected:
|
||||
FadeOutBLTiles() {}
|
||||
virtual ~FadeOutBLTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutUpTiles action.
|
||||
|
@ -153,6 +178,13 @@ public:
|
|||
// Overrides
|
||||
virtual FadeOutUpTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
|
||||
protected:
|
||||
FadeOutUpTiles() {}
|
||||
virtual ~FadeOutUpTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
||||
};
|
||||
|
||||
/** @brief FadeOutDownTiles action.
|
||||
|
@ -167,6 +199,13 @@ public:
|
|||
// Overrides
|
||||
virtual FadeOutDownTiles* clone() const override;
|
||||
virtual float testFunc(const Size& pos, float time) override;
|
||||
|
||||
protected:
|
||||
FadeOutDownTiles() {}
|
||||
virtual ~FadeOutDownTiles() {}
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
||||
};
|
||||
|
||||
/** @brief TurnOffTiles action.
|
||||
|
@ -179,13 +218,6 @@ public:
|
|||
static TurnOffTiles* create(float duration, const Size& gridSize);
|
||||
/** creates the action with a random seed, the grid size and the duration */
|
||||
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 turnOnTile(const Point& pos);
|
||||
|
@ -197,9 +229,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
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 _tilesCount;
|
||||
unsigned int* _tilesOrder;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
||||
};
|
||||
|
||||
/** @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 */
|
||||
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 */
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -225,9 +262,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
||||
};
|
||||
|
||||
/** @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 */
|
||||
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*/
|
||||
inline float getAmplitude(void) const { return _amplitude; }
|
||||
inline void setAmplitude(float fAmplitude) { _amplitude = fAmplitude; }
|
||||
|
@ -255,9 +297,17 @@ public:
|
|||
virtual void update(float time) override;
|
||||
|
||||
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;
|
||||
float _amplitude;
|
||||
float _amplitudeRate;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
||||
};
|
||||
|
||||
/** @brief SplitRows action */
|
||||
|
@ -267,17 +317,22 @@ public :
|
|||
/** creates the action with the number of rows to split and the duration */
|
||||
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
|
||||
virtual SplitRows* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
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;
|
||||
Size _winSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
||||
};
|
||||
|
||||
/** @brief SplitCols action */
|
||||
|
@ -287,17 +342,22 @@ public:
|
|||
/** creates the action with the number of columns to split and the duration */
|
||||
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
|
||||
virtual SplitCols* clone() const override;
|
||||
virtual void update(float time) override;
|
||||
virtual void startWithTarget(Node *target) override;
|
||||
|
||||
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;
|
||||
Size _winSize;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
||||
};
|
||||
|
||||
// end of actions group
|
||||
|
|
|
@ -27,7 +27,7 @@ THE SOFTWARE.
|
|||
|
||||
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();
|
||||
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;
|
||||
}
|
||||
|
||||
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))
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual ~ActionTweenDelegate() {}
|
||||
virtual void updateTweenAction(float value, const char* key) = 0;
|
||||
virtual void updateTweenAction(float value, const std::string& key) = 0;
|
||||
};
|
||||
|
||||
/** ActionTween
|
||||
|
@ -69,9 +69,9 @@ class CC_DLL ActionTween : public ActionInterval
|
|||
{
|
||||
public:
|
||||
/** 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. */
|
||||
bool initWithDuration(float duration, const char* key, float from, float to);
|
||||
bool initWithDuration(float duration, const std::string& key, float from, float to);
|
||||
|
||||
// Overrides
|
||||
void startWithTarget(Node *target) override;
|
||||
|
|
|
@ -175,7 +175,7 @@ void Animation::addSpriteFrame(SpriteFrame *pFrame)
|
|||
_totalDelayUnits++;
|
||||
}
|
||||
|
||||
void Animation::addSpriteFrameWithFile(const char *filename)
|
||||
void Animation::addSpriteFrameWithFile(const std::string& filename)
|
||||
{
|
||||
Texture2D *texture = Director::getInstance()->getTextureCache()->addImage(filename);
|
||||
Rect rect = Rect::ZERO;
|
||||
|
|
|
@ -173,11 +173,11 @@ public:
|
|||
The frame will be added with one "delay unit".
|
||||
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
|
||||
*/
|
||||
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.
|
||||
The frame will be added with one "delay unit".
|
||||
|
|
|
@ -53,22 +53,7 @@ class CC_DLL AtlasNode : public NodeRGBA, public TextureProtocol
|
|||
public:
|
||||
/** 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);
|
||||
/**
|
||||
* @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).
|
||||
* Shall be overridden in subclasses
|
||||
*/
|
||||
|
@ -104,15 +89,24 @@ public:
|
|||
*/
|
||||
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 updateBlendFunc();
|
||||
void updateOpacityModifyRGB();
|
||||
|
||||
|
||||
friend class Director;
|
||||
void setIgnoreContentScaleFactor(bool bIgnoreContentScaleFactor);
|
||||
|
||||
protected:
|
||||
//! chars per row
|
||||
long _itemsPerRow;
|
||||
//! chars per column
|
||||
|
@ -136,6 +130,10 @@ protected:
|
|||
GLint _uniformColor;
|
||||
// This varible is only used for LabelAtlas FPS display. So plz don't modify its value.
|
||||
bool _ignoreContentScaleFactor;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
||||
|
||||
};
|
||||
|
||||
// end of base_node group
|
||||
|
|
|
@ -49,21 +49,7 @@ public:
|
|||
The stencil node will be retained.
|
||||
*/
|
||||
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 stencil node will be retained.
|
||||
This default to nil.
|
||||
|
@ -109,18 +95,34 @@ public:
|
|||
virtual void onExit() 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
|
||||
*/
|
||||
void drawFullScreenQuadClearStencil();
|
||||
|
||||
protected:
|
||||
ClippingNode();
|
||||
|
||||
protected:
|
||||
Node* _stencil;
|
||||
GLfloat _alphaThreshold;
|
||||
bool _inverted;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -78,6 +78,12 @@ bool Configuration::init()
|
|||
_valueDict->setObject(Bool::create(true), "cocos2d.x.compiled_with_gl_state_cache");
|
||||
#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;
|
||||
}
|
||||
|
||||
|
|
|
@ -346,7 +346,7 @@ void DrawNode::drawPolygon(Point *verts, long count, const Color4F &fillColor, f
|
|||
struct ExtrudeVerts* extrude = (struct ExtrudeVerts*)malloc(sizeof(struct ExtrudeVerts)*count);
|
||||
memset(extrude, 0, sizeof(struct ExtrudeVerts)*count);
|
||||
|
||||
for(unsigned int i = 0; i < count; i++)
|
||||
for (long i = 0; i < count; i++)
|
||||
{
|
||||
Vertex2F v0 = __v2f(verts[(i-1+count)%count]);
|
||||
Vertex2F v1 = __v2f(verts[i]);
|
||||
|
@ -370,7 +370,7 @@ void DrawNode::drawPolygon(Point *verts, long count, const Color4F &fillColor, f
|
|||
V2F_C4B_T2F_Triangle *cursor = triangles;
|
||||
|
||||
float inset = (outline == false ? 0.5 : 0.0);
|
||||
for(unsigned int i = 0; i < count-2; i++)
|
||||
for (long i = 0; i < count-2; i++)
|
||||
{
|
||||
Vertex2F v0 = v2fsub(__v2f(verts[0 ]), v2fmult(extrude[0 ].offset, inset));
|
||||
Vertex2F v1 = v2fsub(__v2f(verts[i+1]), v2fmult(extrude[i+1].offset, inset));
|
||||
|
|
|
@ -46,17 +46,6 @@ class CC_DLL DrawNode : public Node
|
|||
public:
|
||||
/** creates and initialize a DrawNode node */
|
||||
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 */
|
||||
void drawDot(const Point &pos, float radius, const Color4F &color);
|
||||
|
@ -99,6 +88,10 @@ public:
|
|||
virtual void draw() override;
|
||||
|
||||
protected:
|
||||
DrawNode();
|
||||
virtual ~DrawNode();
|
||||
virtual bool init();
|
||||
|
||||
void ensureCapacity(long count);
|
||||
void render();
|
||||
|
||||
|
@ -112,6 +105,9 @@ protected:
|
|||
BlendFunc _blendFunc;
|
||||
|
||||
bool _dirty;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -491,7 +491,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, s
|
|||
auto fixedPriorityListeners = listeners->getFixedPriorityListeners();
|
||||
auto sceneGraphPriorityListeners = listeners->getSceneGraphPriorityListeners();
|
||||
|
||||
int i = 0;
|
||||
long i = 0;
|
||||
// priority < 0
|
||||
if (fixedPriorityListeners)
|
||||
{
|
||||
|
@ -527,7 +527,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners, s
|
|||
if (!shouldStopPropagation)
|
||||
{
|
||||
// priority > 0
|
||||
for (; i < fixedPriorityListeners->size(); ++i)
|
||||
for (; i < static_cast<long>(fixedPriorityListeners->size()); ++i)
|
||||
{
|
||||
auto l = fixedPriorityListeners->at(i);
|
||||
|
||||
|
@ -976,7 +976,7 @@ void EventDispatcher::sortEventListenersOfFixedPriority(EventListener::ListenerI
|
|||
});
|
||||
|
||||
// FIXME: Should use binary search
|
||||
int index = 0;
|
||||
long index = 0;
|
||||
for (auto& listener : *fixedlisteners)
|
||||
{
|
||||
if (listener->getFixedPriority() >= 0)
|
||||
|
|
|
@ -136,12 +136,12 @@ private:
|
|||
|
||||
inline std::vector<EventListener*>* getFixedPriorityListeners() const { return _fixedListeners; };
|
||||
inline std::vector<EventListener*>* getSceneGraphPriorityListeners() const { return _sceneGraphListeners; };
|
||||
inline int getGt0Index() const { return _gt0Index; };
|
||||
inline void setGt0Index(int index) { _gt0Index = index; };
|
||||
inline long getGt0Index() const { return _gt0Index; };
|
||||
inline void setGt0Index(long index) { _gt0Index = index; };
|
||||
private:
|
||||
std::vector<EventListener*>* _fixedListeners;
|
||||
std::vector<EventListener*>* _sceneGraphListeners;
|
||||
int _gt0Index;
|
||||
long _gt0Index;
|
||||
};
|
||||
|
||||
/** Adds event listener with item */
|
||||
|
|
|
@ -251,7 +251,7 @@ private:
|
|||
GLint _uniforms[UNIFORM_MAX];
|
||||
struct _hashUniformEntry* _hashForUniforms;
|
||||
|
||||
struct flag_struct {
|
||||
struct flag_struct {
|
||||
unsigned int usesTime:1;
|
||||
unsigned int usesMVP:1;
|
||||
unsigned int usesMV:1;
|
||||
|
|
|
@ -119,16 +119,16 @@ Label::~Label()
|
|||
if (_fontAtlas)
|
||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||
|
||||
delete _reusedLetter;
|
||||
_reusedLetter->release();
|
||||
}
|
||||
|
||||
bool Label::init()
|
||||
{
|
||||
if(_fontAtlas)
|
||||
{
|
||||
_reusedLetter = new Sprite;
|
||||
_reusedLetter->initWithTexture(&_fontAtlas->getTexture(0));
|
||||
_reusedLetter = Sprite::createWithTexture(&_fontAtlas->getTexture(0));
|
||||
_reusedLetter->setOpacityModifyRGB(_isOpacityModifyRGB);
|
||||
_reusedLetter->retain();
|
||||
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.y = _lettersInfo[ID].def.V;
|
||||
|
||||
sp = new Sprite();
|
||||
sp->initWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID),uvRect);
|
||||
sp = Sprite::createWithTexture(&_fontAtlas->getTexture(_lettersInfo[ID].def.textureID), uvRect);
|
||||
sp->setBatchNode(this);
|
||||
sp->setAnchorPoint(Point(_lettersInfo[ID].def.anchorX, _lettersInfo[ID].def.anchorY));
|
||||
sp->setPosition(_lettersInfo[ID].position);
|
||||
sp->setOpacity(_realOpacity);
|
||||
|
||||
this->addSpriteWithoutQuad(sp, ID, ID);
|
||||
sp->release();
|
||||
}
|
||||
return sp;
|
||||
}
|
||||
|
|
|
@ -511,8 +511,8 @@ bool LabelBMFont::initWithString(const std::string& theString, const std::string
|
|||
|
||||
_imageOffset = imageOffset;
|
||||
|
||||
_reusedChar = new Sprite();
|
||||
_reusedChar->initWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0), false);
|
||||
_reusedChar = Sprite::createWithTexture(_textureAtlas->getTexture(), Rect(0, 0, 0, 0));
|
||||
_reusedChar->retain();
|
||||
_reusedChar->setBatchNode(this);
|
||||
|
||||
this->setString(theString, true);
|
||||
|
@ -663,10 +663,8 @@ void LabelBMFont::createFontChars()
|
|||
}
|
||||
else
|
||||
{
|
||||
fontChar = new Sprite();
|
||||
fontChar->initWithTexture(_textureAtlas->getTexture(), rect);
|
||||
fontChar = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||
addChild(fontChar, i, i);
|
||||
fontChar->release();
|
||||
}
|
||||
|
||||
// Apply label properties
|
||||
|
@ -1199,9 +1197,9 @@ float LabelBMFont::getLetterPosXRight( Sprite* sp )
|
|||
}
|
||||
|
||||
// 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);
|
||||
|
||||
|
@ -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 void setCascadeColorEnabled(bool cascadeColorEnabled);
|
||||
|
||||
void setFntFile(const char* fntFile);
|
||||
const char* getFntFile();
|
||||
void setFntFile(const std::string& fntFile);
|
||||
const std::string& getFntFile() const;
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
virtual void draw();
|
||||
#endif // CC_LABELBMFONT_DEBUG_DRAW
|
||||
|
|
|
@ -42,36 +42,38 @@ struct LetterInfo
|
|||
class CC_DLL LabelTextFormatProtocol
|
||||
{
|
||||
public:
|
||||
virtual bool recordLetterInfo(const cocos2d::Point& point,unsigned short int theChar, int spriteIndex) = 0;
|
||||
virtual bool recordPlaceholderInfo(int spriteIndex) = 0;
|
||||
virtual std::vector<LetterInfo> *getLettersInfo() = 0;
|
||||
virtual float getLetterPosXLeft(int index) const = 0;
|
||||
virtual float getLetterPosXRight(int index) const = 0;
|
||||
|
||||
virtual ~LabelTextFormatProtocol() {}
|
||||
|
||||
virtual bool recordLetterInfo(const cocos2d::Point& point,unsigned short int theChar, int spriteIndex) = 0;
|
||||
virtual bool recordPlaceholderInfo(int spriteIndex) = 0;
|
||||
virtual std::vector<LetterInfo> *getLettersInfo() = 0;
|
||||
virtual float getLetterPosXLeft(int index) const = 0;
|
||||
virtual float getLetterPosXRight(int index) const = 0;
|
||||
// sprite related stuff
|
||||
virtual cocos2d::Sprite *getLetter(int ID) = 0;
|
||||
virtual cocos2d::Sprite *getLetter(int ID) = 0;
|
||||
|
||||
// font related stuff
|
||||
virtual int getCommonLineHeight() const = 0;
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second) const = 0;
|
||||
virtual int getXOffsetForChar(unsigned short c) const = 0;
|
||||
virtual int getYOffsetForChar(unsigned short c) const = 0;
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) const = 0;
|
||||
virtual cocos2d::Rect getRectForChar(unsigned short c) const = 0;
|
||||
virtual int getCommonLineHeight() const = 0;
|
||||
virtual int getKerningForCharsPair(unsigned short first, unsigned short second) const = 0;
|
||||
virtual int getXOffsetForChar(unsigned short c) const = 0;
|
||||
virtual int getYOffsetForChar(unsigned short c) const = 0;
|
||||
virtual int getAdvanceForChar(unsigned short c, int hintPositionInString) const = 0;
|
||||
virtual cocos2d::Rect getRectForChar(unsigned short c) const = 0;
|
||||
|
||||
// string related stuff
|
||||
virtual int getStringNumLines() const = 0;
|
||||
virtual int getStringLenght() const = 0;
|
||||
virtual unsigned short getCharAtStringPosition(int position) const = 0;
|
||||
virtual unsigned short * getUTF8String() const = 0;
|
||||
virtual void assignNewUTF8String(unsigned short *newString) = 0;
|
||||
virtual TextHAlignment getTextAlignment() const = 0;
|
||||
virtual int getStringNumLines() const = 0;
|
||||
virtual int getStringLenght() const = 0;
|
||||
virtual unsigned short getCharAtStringPosition(int position) const = 0;
|
||||
virtual unsigned short * getUTF8String() const = 0;
|
||||
virtual void assignNewUTF8String(unsigned short *newString) = 0;
|
||||
virtual TextHAlignment getTextAlignment() const = 0;
|
||||
|
||||
// label related stuff
|
||||
virtual float getMaxLineWidth() const = 0;
|
||||
virtual bool breakLineWithoutSpace() const = 0;
|
||||
virtual cocos2d::Size getLabelContentSize() const = 0;
|
||||
virtual void setLabelContentSize(const Size &newSize) = 0;
|
||||
|
||||
virtual float getMaxLineWidth() const = 0;
|
||||
virtual bool breakLineWithoutSpace() const = 0;
|
||||
virtual cocos2d::Size getLabelContentSize() const = 0;
|
||||
virtual void setLabelContentSize(const Size &newSize) = 0;
|
||||
};
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -48,6 +48,14 @@ NS_CC_BEGIN
|
|||
|
||||
// Layer
|
||||
Layer::Layer()
|
||||
: _touchEnabled(false)
|
||||
, _accelerometerEnabled(false)
|
||||
, _keyboardEnabled(false)
|
||||
, _touchMode(Touch::DispatchMode::ALL_AT_ONCE)
|
||||
, _swallowsTouches(true)
|
||||
, _touchListener(nullptr)
|
||||
, _keyboardListener(nullptr)
|
||||
, _accelerationListener(nullptr)
|
||||
{
|
||||
_ignoreAnchorPointForPosition = true;
|
||||
setAnchorPoint(Point(0.5f, 0.5f));
|
||||
|
@ -87,6 +95,321 @@ Layer *Layer::create()
|
|||
}
|
||||
}
|
||||
|
||||
int Layer::executeScriptTouchHandler(EventTouch::EventCode eventType, Touch* touch)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
TouchScriptData data(eventType, this, touch);
|
||||
ScriptEvent event(kTouchEvent, &data);
|
||||
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
||||
//can not reach it
|
||||
return 0;
|
||||
}
|
||||
|
||||
int Layer::executeScriptTouchesHandler(EventTouch::EventCode eventType, const std::vector<Touch*>& touches)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
TouchesScriptData data(eventType, this, touches);
|
||||
ScriptEvent event(kTouchesEvent, &data);
|
||||
return ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996)
|
||||
#endif
|
||||
|
||||
/// isTouchEnabled getter
|
||||
bool Layer::isTouchEnabled() const
|
||||
{
|
||||
return _touchEnabled;
|
||||
}
|
||||
|
||||
/// isTouchEnabled setter
|
||||
void Layer::setTouchEnabled(bool enabled)
|
||||
{
|
||||
if (_touchEnabled != enabled)
|
||||
{
|
||||
_touchEnabled = enabled;
|
||||
if (enabled)
|
||||
{
|
||||
if (_touchListener != nullptr)
|
||||
return;
|
||||
|
||||
if( _touchMode == Touch::DispatchMode::ALL_AT_ONCE )
|
||||
{
|
||||
// Register Touch Event
|
||||
auto listener = EventListenerTouchAllAtOnce::create();
|
||||
|
||||
listener->onTouchesBegan = CC_CALLBACK_2(Layer::onTouchesBegan, this);
|
||||
listener->onTouchesMoved = CC_CALLBACK_2(Layer::onTouchesMoved, this);
|
||||
listener->onTouchesEnded = CC_CALLBACK_2(Layer::onTouchesEnded, this);
|
||||
listener->onTouchesCancelled = CC_CALLBACK_2(Layer::onTouchesCancelled, this);
|
||||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
_touchListener = listener;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Register Touch Event
|
||||
auto listener = EventListenerTouchOneByOne::create();
|
||||
listener->setSwallowTouches(_swallowsTouches);
|
||||
|
||||
listener->onTouchBegan = CC_CALLBACK_2(Layer::onTouchBegan, this);
|
||||
listener->onTouchMoved = CC_CALLBACK_2(Layer::onTouchMoved, this);
|
||||
listener->onTouchEnded = CC_CALLBACK_2(Layer::onTouchEnded, this);
|
||||
listener->onTouchCancelled = CC_CALLBACK_2(Layer::onTouchCancelled, this);
|
||||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
_touchListener = listener;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_eventDispatcher->removeEventListener(_touchListener);
|
||||
_touchListener = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::setTouchMode(Touch::DispatchMode mode)
|
||||
{
|
||||
if(_touchMode != mode)
|
||||
{
|
||||
_touchMode = mode;
|
||||
|
||||
if( _touchEnabled)
|
||||
{
|
||||
setTouchEnabled(false);
|
||||
setTouchEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::setSwallowsTouches(bool swallowsTouches)
|
||||
{
|
||||
if (_swallowsTouches != swallowsTouches)
|
||||
{
|
||||
_swallowsTouches = swallowsTouches;
|
||||
|
||||
if( _touchEnabled)
|
||||
{
|
||||
setTouchEnabled(false);
|
||||
setTouchEnabled(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Touch::DispatchMode Layer::getTouchMode() const
|
||||
{
|
||||
return _touchMode;
|
||||
}
|
||||
|
||||
bool Layer::isSwallowsTouches() const
|
||||
{
|
||||
return _swallowsTouches;
|
||||
}
|
||||
|
||||
/// isAccelerometerEnabled getter
|
||||
bool Layer::isAccelerometerEnabled() const
|
||||
{
|
||||
return _accelerometerEnabled;
|
||||
}
|
||||
/// isAccelerometerEnabled setter
|
||||
void Layer::setAccelerometerEnabled(bool enabled)
|
||||
{
|
||||
if (enabled != _accelerometerEnabled)
|
||||
{
|
||||
_accelerometerEnabled = enabled;
|
||||
|
||||
Device::setAccelerometerEnabled(enabled);
|
||||
|
||||
_eventDispatcher->removeEventListener(_accelerationListener);
|
||||
_accelerationListener = nullptr;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
_accelerationListener = EventListenerAcceleration::create(CC_CALLBACK_2(Layer::onAcceleration, this));
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(_accelerationListener, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::setAccelerometerInterval(double interval) {
|
||||
if (_accelerometerEnabled)
|
||||
{
|
||||
if (_running)
|
||||
{
|
||||
Device::setAccelerometerInterval(interval);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::onAcceleration(Acceleration* acc, Event* unused_event)
|
||||
{
|
||||
CC_UNUSED_PARAM(acc);
|
||||
|
||||
if(kScriptTypeNone != _scriptType)
|
||||
{
|
||||
BasicScriptData data(this,(void*)acc);
|
||||
ScriptEvent event(kAccelerometerEvent,&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onKeyPressed(EventKeyboard::KeyCode keyCode, Event* unused_event)
|
||||
{
|
||||
CC_UNUSED_PARAM(keyCode);
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onKeyReleased(EventKeyboard::KeyCode keyCode, Event* unused_event)
|
||||
{
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
if(kScriptTypeNone != _scriptType)
|
||||
{
|
||||
KeypadScriptData data(keyCode, this);
|
||||
ScriptEvent event(kKeypadEvent,&data);
|
||||
ScriptEngineManager::getInstance()->getScriptEngine()->sendEvent(&event);
|
||||
}
|
||||
}
|
||||
|
||||
/// isKeyboardEnabled getter
|
||||
bool Layer::isKeyboardEnabled() const
|
||||
{
|
||||
return _keyboardEnabled;
|
||||
}
|
||||
/// isKeyboardEnabled setter
|
||||
void Layer::setKeyboardEnabled(bool enabled)
|
||||
{
|
||||
if (enabled != _keyboardEnabled)
|
||||
{
|
||||
_keyboardEnabled = enabled;
|
||||
|
||||
_eventDispatcher->removeEventListener(_keyboardListener);
|
||||
_keyboardListener = nullptr;
|
||||
|
||||
if (enabled)
|
||||
{
|
||||
auto listener = EventListenerKeyboard::create();
|
||||
listener->onKeyPressed = CC_CALLBACK_2(Layer::onKeyPressed, this);
|
||||
listener->onKeyReleased = CC_CALLBACK_2(Layer::onKeyReleased, this);
|
||||
|
||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||
_keyboardListener = listener;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Layer::setKeypadEnabled(bool enabled)
|
||||
{
|
||||
setKeyboardEnabled(enabled);
|
||||
}
|
||||
/// Callbacks
|
||||
|
||||
bool Layer::onTouchBegan(Touch *touch, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
return executeScriptTouchHandler(EventTouch::EventCode::BEGAN, touch) == 0 ? false : true;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
CCASSERT(false, "Layer#ccTouchBegan override me");
|
||||
return true;
|
||||
}
|
||||
|
||||
void Layer::onTouchMoved(Touch *touch, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchHandler(EventTouch::EventCode::MOVED, touch);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchEnded(Touch *touch, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchHandler(EventTouch::EventCode::ENDED, touch);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchCancelled(Touch *touch, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchHandler(EventTouch::EventCode::CANCELLED, touch);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchesBegan(const std::vector<Touch*>& touches, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchesHandler(EventTouch::EventCode::BEGAN, touches);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchesMoved(const std::vector<Touch*>& touches, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchesHandler(EventTouch::EventCode::MOVED, touches);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchesEnded(const std::vector<Touch*>& touches, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchesHandler(EventTouch::EventCode::ENDED, touches);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
void Layer::onTouchesCancelled(const std::vector<Touch*>& touches, Event *unused_event)
|
||||
{
|
||||
if (kScriptTypeNone != _scriptType)
|
||||
{
|
||||
executeScriptTouchesHandler(EventTouch::EventCode::CANCELLED, touches);
|
||||
return;
|
||||
}
|
||||
|
||||
CC_UNUSED_PARAM(unused_event);
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (pop)
|
||||
#endif
|
||||
// LayerRGBA
|
||||
LayerRGBA::LayerRGBA()
|
||||
: _displayedOpacity(255)
|
||||
|
|
|
@ -45,6 +45,10 @@ NS_CC_BEGIN
|
|||
|
||||
class TouchScriptHandlerEntry;
|
||||
|
||||
class EventListenerTouch;
|
||||
class EventListenerKeyboard;
|
||||
class EventListenerAcceleration;
|
||||
|
||||
//
|
||||
// Layer
|
||||
//
|
||||
|
@ -58,18 +62,8 @@ class CC_DLL Layer : public Node
|
|||
{
|
||||
public:
|
||||
/** creates a fullscreen black layer */
|
||||
static Layer *create(void);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Layer();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Layer();
|
||||
virtual bool init();
|
||||
|
||||
static Layer *create();
|
||||
|
||||
// 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 void ccTouchMoved(Touch *pTouch, Event *pEvent) final {CC_UNUSED_PARAM(pTouch); CC_UNUSED_PARAM(pEvent);}
|
||||
|
@ -81,10 +75,26 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesEnded(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void ccTouchesCancelled(Set *pTouches, Event *pEvent) final {CC_UNUSED_PARAM(pTouches); CC_UNUSED_PARAM(pEvent);}
|
||||
|
||||
|
||||
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||
Since 'setTouchEnabled' was deprecated, it will make warnings if developer overrides onTouchXXX and invokes setTouchEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||
*/
|
||||
virtual bool onTouchBegan(Touch *touch, Event *unused_event);
|
||||
virtual void onTouchMoved(Touch *touch, Event *unused_event);
|
||||
virtual void onTouchEnded(Touch *touch, Event *unused_event);
|
||||
virtual void onTouchCancelled(Touch *touch, Event *unused_event);
|
||||
|
||||
virtual void onTouchesBegan(const std::vector<Touch*>& touches, Event *unused_event);
|
||||
virtual void onTouchesMoved(const std::vector<Touch*>& touches, Event *unused_event);
|
||||
virtual void onTouchesEnded(const std::vector<Touch*>& touches, Event *unused_event);
|
||||
virtual void onTouchesCancelled(const std::vector<Touch*>&touches, Event *unused_event);
|
||||
/** @deprecated Please override onAcceleration */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void didAccelerate(Acceleration* accelerationValue) final {};
|
||||
|
||||
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||
Since 'setAccelerometerEnabled' was deprecated, it will make warnings if developer overrides onAcceleration and invokes setAccelerometerEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||
*/
|
||||
virtual void onAcceleration(Acceleration* acc, Event* unused_event);
|
||||
|
||||
/** If isTouchEnabled, this method is called onEnter. Override it to change the
|
||||
way Layer receives touch events.
|
||||
( Default: TouchDispatcher::sharedDispatcher()->addStandardDelegate(this,0); )
|
||||
|
@ -97,26 +107,83 @@ public:
|
|||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void registerWithTouchDispatcher() final {};
|
||||
|
||||
/** whether or not it will receive Touch events.
|
||||
You can enable / disable touch events with this property.
|
||||
Only the touches of this node will be affected. This "method" is not propagated to it's children.
|
||||
@since v0.8.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE bool isTouchEnabled() const;
|
||||
CC_DEPRECATED_ATTRIBUTE void setTouchEnabled(bool value);
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setTouchMode(Touch::DispatchMode mode);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual Touch::DispatchMode getTouchMode() const;
|
||||
|
||||
/** swallowsTouches of the touch events. Default is true */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setSwallowsTouches(bool swallowsTouches);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool isSwallowsTouches() const;
|
||||
|
||||
/** whether or not it will receive Accelerometer events
|
||||
You can enable / disable accelerometer events with this property.
|
||||
@since v0.8.1
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool isAccelerometerEnabled() const;
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setAccelerometerEnabled(bool value);
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setAccelerometerInterval(double interval);
|
||||
|
||||
/** whether or not it will receive keyboard or keypad events
|
||||
You can enable / disable accelerometer events with this property.
|
||||
it's new in cocos2d-x
|
||||
*/
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool isKeyboardEnabled() const;
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setKeyboardEnabled(bool value);
|
||||
|
||||
/** Please use onKeyPressed instead. */
|
||||
virtual void keyPressed(int keyCode) final {};
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void keyPressed(int keyCode) final {};
|
||||
|
||||
/** Please use onKeyReleased instead. */
|
||||
virtual void keyReleased(int keyCode) final {};
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void keyReleased(int keyCode) final {};
|
||||
|
||||
/* Callback function should not be deprecated, it will generate lots of warnings.
|
||||
Since 'setKeyboardEnabled' was deprecated, it will make warnings if developer overrides onKeyXXX and invokes setKeyboardEnabled(true) instead of using EventDispatcher::addEventListenerWithXXX.
|
||||
*/
|
||||
virtual void onKeyPressed(EventKeyboard::KeyCode keyCode, Event* event);
|
||||
virtual void onKeyReleased(EventKeyboard::KeyCode keyCode, Event* event);
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool isKeypadEnabled() const final { return _keyboardEnabled; }
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void setKeypadEnabled(bool value);
|
||||
|
||||
/** @deprecated Please override onKeyReleased and check the keycode of KeyboardEvent::KeyCode::Menu(KEY_BACKSPACE) instead. */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void keyBackClicked() final {};
|
||||
CC_DEPRECATED_ATTRIBUTE virtual void keyMenuClicked() final {};
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
|
||||
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 _accelerometerEnabled;
|
||||
bool _keyboardEnabled;
|
||||
EventListener* _touchListener;
|
||||
EventListenerKeyboard* _keyboardListener;
|
||||
EventListenerAcceleration* _accelerationListener;
|
||||
|
||||
Touch::DispatchMode _touchMode;
|
||||
bool _swallowsTouches;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Layer);
|
||||
|
||||
};
|
||||
|
||||
#ifdef __apple__
|
||||
#pragma mark -
|
||||
#pragma mark LayerRGBA
|
||||
#endif
|
||||
|
||||
/** LayerRGBA is a subclass of Layer that implements the RGBAProtocol protocol using a solid color as the background.
|
||||
|
||||
|
@ -129,17 +196,7 @@ class CC_DLL LayerRGBA : public Layer, public RGBAProtocol
|
|||
{
|
||||
public:
|
||||
CREATE_FUNC(LayerRGBA);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
LayerRGBA();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~LayerRGBA();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -160,10 +217,18 @@ public:
|
|||
|
||||
virtual void setOpacityModifyRGB(bool bValue) override {CC_UNUSED_PARAM(bValue);}
|
||||
virtual bool isOpacityModifyRGB() const override { return false; }
|
||||
|
||||
protected:
|
||||
LayerRGBA();
|
||||
virtual ~LayerRGBA();
|
||||
virtual bool init();
|
||||
|
||||
GLubyte _displayedOpacity, _realOpacity;
|
||||
Color3B _displayedColor, _realColor;
|
||||
bool _cascadeOpacityEnabled, _cascadeColorEnabled;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerRGBA);
|
||||
};
|
||||
|
||||
//
|
||||
|
@ -187,27 +252,6 @@ public:
|
|||
static LayerColor * create(const Color4B& color, GLfloat width, GLfloat height);
|
||||
/** creates a Layer with color. Width and height are the window size. */
|
||||
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*/
|
||||
void changeWidth(GLfloat w);
|
||||
|
@ -241,11 +285,21 @@ public:
|
|||
virtual void setBlendFunc(const BlendFunc& blendFunc) override;
|
||||
|
||||
protected:
|
||||
LayerColor();
|
||||
virtual ~LayerColor();
|
||||
virtual bool init();
|
||||
bool initWithColor(const Color4B& color, GLfloat width, GLfloat height);
|
||||
bool initWithColor(const Color4B& color);
|
||||
|
||||
virtual void updateColor();
|
||||
|
||||
BlendFunc _blendFunc;
|
||||
Vertex2F _squareVertices[4];
|
||||
Color4F _squareColors[4];
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
||||
|
||||
};
|
||||
|
||||
//
|
||||
|
|
|
@ -73,17 +73,6 @@ public:
|
|||
|
||||
/** creates a Menu with MenuItem objects */
|
||||
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 */
|
||||
void alignItemsVertically();
|
||||
|
@ -130,12 +119,27 @@ public:
|
|||
virtual bool isOpacityModifyRGB(void) const override { return false;}
|
||||
|
||||
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 */
|
||||
bool _enabled;
|
||||
|
||||
MenuItem* itemForTouch(Touch * touch);
|
||||
State _state;
|
||||
MenuItem *_selectedItem;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Menu);
|
||||
};
|
||||
|
||||
// end of GUI group
|
||||
|
|
|
@ -65,31 +65,6 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE static MenuItem* create(Object *rec, SEL_MenuHandler selector);
|
||||
/** Creates a MenuItem with a target/selector */
|
||||
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 */
|
||||
Rect rect() const;
|
||||
|
@ -120,12 +95,41 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE void setTarget(Object *rec, SEL_MenuHandler selector);
|
||||
|
||||
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 _enabled;
|
||||
// callback
|
||||
ccMenuCallback _callback;
|
||||
// If using the old API, the _target needs to be retained / released
|
||||
Object *_target;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
||||
};
|
||||
|
||||
/** @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 */
|
||||
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 */
|
||||
void setString(const std::string& label);
|
||||
|
@ -187,6 +173,25 @@ public:
|
|||
virtual void setEnabled(bool enabled) override;
|
||||
|
||||
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;
|
||||
float _originalScale;
|
||||
|
||||
|
@ -194,6 +199,9 @@ protected:
|
|||
Color3B _disabledColor;
|
||||
/** Label that is rendered. It can be any Node that implements the LabelProtocol */
|
||||
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);
|
||||
/** 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);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @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);
|
||||
/** 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);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
||||
};
|
||||
|
||||
|
||||
|
@ -233,25 +246,11 @@ class CC_DLL MenuItemFont : public MenuItemLabel
|
|||
{
|
||||
public:
|
||||
/** 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 */
|
||||
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 */
|
||||
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 */
|
||||
static void setFontSize(long size);
|
||||
|
@ -293,10 +292,28 @@ public:
|
|||
CC_DEPRECATED_ATTRIBUTE const std::string& fontNameObj() const { return getFontNameObj(); }
|
||||
|
||||
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();
|
||||
|
||||
long _fontSize;
|
||||
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 */
|
||||
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 */
|
||||
inline Node* getNormalImage() const { return _normalImage; };
|
||||
|
||||
|
@ -359,6 +365,17 @@ public:
|
|||
virtual void setEnabled(bool bEnabled);
|
||||
|
||||
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();
|
||||
|
||||
/** the image used when the item is not selected */
|
||||
|
@ -367,6 +384,9 @@ protected:
|
|||
Node* _selectedImage;
|
||||
/** the image used when the item is disabled */
|
||||
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);
|
||||
/** 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);
|
||||
|
||||
/** 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
|
||||
*/
|
||||
|
@ -412,12 +441,8 @@ public:
|
|||
/** 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);
|
||||
|
||||
/** 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);
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
||||
};
|
||||
|
||||
|
||||
|
@ -436,39 +461,6 @@ public:
|
|||
static MenuItemToggle* create();
|
||||
/** creates a menu item with a 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 */
|
||||
void addSubItem(MenuItem *item);
|
||||
|
||||
|
@ -506,6 +498,40 @@ public:
|
|||
virtual void setEnabled(bool var) override;
|
||||
|
||||
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 */
|
||||
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.
|
||||
|
@ -513,6 +539,9 @@ protected:
|
|||
*/
|
||||
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);
|
||||
/** 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);
|
||||
/**
|
||||
* @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 */
|
||||
void tintWithColor(const Color3B& colors);
|
||||
|
@ -114,9 +100,24 @@ public:
|
|||
virtual bool isOpacityModifyRGB() const override;
|
||||
|
||||
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 _startingPositionInitialized;
|
||||
private:
|
||||
|
||||
/** texture used for the motion streak */
|
||||
Texture2D* _texture;
|
||||
BlendFunc _blendFunc;
|
||||
|
@ -138,6 +139,9 @@ private:
|
|||
Vertex2F* _vertices;
|
||||
GLubyte* _colorPointer;
|
||||
Tex2F* _texCoords;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
||||
};
|
||||
|
||||
// end of misc_nodes group
|
||||
|
|
|
@ -151,25 +151,6 @@ public:
|
|||
*/
|
||||
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.
|
||||
* @return A string terminated with '\0'
|
||||
|
@ -1410,7 +1391,11 @@ public:
|
|||
#endif
|
||||
|
||||
protected:
|
||||
|
||||
// Nodes should be created using create();
|
||||
Node();
|
||||
virtual ~Node();
|
||||
virtual bool init();
|
||||
|
||||
/// lazy allocs
|
||||
void childrenAlloc(void);
|
||||
|
||||
|
@ -1493,6 +1478,9 @@ protected:
|
|||
#ifdef CC_USE_PHYSICS
|
||||
PhysicsBody* _physicsBody; ///< the physicsBody the node have
|
||||
#endif
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||
};
|
||||
|
||||
//#pragma mark - NodeRGBA
|
||||
|
@ -1509,18 +1497,6 @@ protected:
|
|||
class CC_DLL NodeRGBA : public Node, public RGBAProtocol
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
NodeRGBA();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~NodeRGBA();
|
||||
|
||||
virtual bool init();
|
||||
|
||||
// overrides
|
||||
virtual GLubyte getOpacity() const override;
|
||||
virtual GLubyte getDisplayedOpacity() const override;
|
||||
|
@ -1540,12 +1516,19 @@ public:
|
|||
virtual bool isOpacityModifyRGB() const override { return false; };
|
||||
|
||||
protected:
|
||||
NodeRGBA();
|
||||
virtual ~NodeRGBA();
|
||||
virtual bool init();
|
||||
|
||||
GLubyte _displayedOpacity;
|
||||
GLubyte _realOpacity;
|
||||
Color3B _displayedColor;
|
||||
Color3B _realColor;
|
||||
bool _cascadeColorEnabled;
|
||||
bool _cascadeOpacityEnabled;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(NodeRGBA);
|
||||
};
|
||||
|
||||
// end of base_node group
|
||||
|
|
|
@ -48,18 +48,6 @@ class CC_DLL ParallaxNode : public Node
|
|||
public:
|
||||
// Create a Parallax node
|
||||
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"
|
||||
using Node::addChild;
|
||||
|
@ -81,10 +69,25 @@ public:
|
|||
virtual void visit(void) override;
|
||||
|
||||
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 _lastPosition;
|
||||
struct _ccArray* _parallaxArray;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
||||
};
|
||||
|
||||
// end of tilemap_parallax_nodes group
|
||||
|
|
|
@ -59,7 +59,7 @@ ParticleBatchNode::~ParticleBatchNode()
|
|||
* creation with Texture2D
|
||||
*/
|
||||
|
||||
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned int capacity/* = kParticleDefaultCapacity*/)
|
||||
ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, int capacity/* = kParticleDefaultCapacity*/)
|
||||
{
|
||||
ParticleBatchNode * p = new ParticleBatchNode();
|
||||
if( p && p->initWithTexture(tex, capacity))
|
||||
|
@ -75,7 +75,7 @@ ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D *tex, unsigned
|
|||
* 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();
|
||||
if( p && p->initWithFile(imageFile, capacity))
|
||||
|
@ -90,7 +90,7 @@ ParticleBatchNode* ParticleBatchNode::create(const char* imageFile, unsigned int
|
|||
/*
|
||||
* init with Texture2D
|
||||
*/
|
||||
bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
||||
bool ParticleBatchNode::initWithTexture(Texture2D *tex, int capacity)
|
||||
{
|
||||
_textureAtlas = new TextureAtlas();
|
||||
_textureAtlas->initWithTexture(tex, capacity);
|
||||
|
@ -109,7 +109,7 @@ bool ParticleBatchNode::initWithTexture(Texture2D *tex, unsigned int capacity)
|
|||
/*
|
||||
* 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);
|
||||
return initWithTexture(tex, capacity);
|
||||
|
|
|
@ -68,10 +68,10 @@ class CC_DLL ParticleBatchNode : public Node, public TextureProtocol
|
|||
{
|
||||
public:
|
||||
/** 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 */
|
||||
static ParticleBatchNode* create(const char* fileImage, unsigned int capacity = kParticleDefaultCapacity);
|
||||
static ParticleBatchNode* create(const std::string& fileImage, int capacity = kParticleDefaultCapacity);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -83,10 +83,10 @@ public:
|
|||
virtual ~ParticleBatchNode();
|
||||
|
||||
/** 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 */
|
||||
bool initWithFile(const char* fileImage, unsigned int capacity);
|
||||
bool initWithFile(const std::string& fileImage, int capacity);
|
||||
|
||||
/** Inserts a child into the ParticleBatchNode */
|
||||
void insertChild(ParticleSystem* system, int index);
|
||||
|
|
|
@ -72,7 +72,7 @@ ParticleFire* ParticleFire::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFire* ParticleFire::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFire* pRet = new ParticleFire();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -86,7 +86,7 @@ ParticleFire* ParticleFire::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFire::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFire::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -177,7 +177,7 @@ ParticleFireworks* ParticleFireworks::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFireworks* ParticleFireworks::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFireworks* pRet = new ParticleFireworks();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -191,7 +191,7 @@ ParticleFireworks* ParticleFireworks::createWithTotalParticles(unsigned int numb
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFireworks::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFireworks::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -278,7 +278,7 @@ ParticleSun* ParticleSun::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSun* ParticleSun::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSun* pRet = new ParticleSun();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -292,7 +292,7 @@ ParticleSun* ParticleSun::createWithTotalParticles(unsigned int numberOfParticle
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSun::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSun::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -385,7 +385,7 @@ ParticleGalaxy* ParticleGalaxy::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleGalaxy* pRet = new ParticleGalaxy();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -399,7 +399,7 @@ ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleGalaxy::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleGalaxy::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -494,7 +494,7 @@ ParticleFlower* ParticleFlower::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleFlower* ParticleFlower::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleFlower* pRet = new ParticleFlower();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -508,7 +508,7 @@ ParticleFlower* ParticleFlower::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleFlower::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleFlower::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -602,7 +602,7 @@ ParticleMeteor * ParticleMeteor::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleMeteor* ParticleMeteor::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleMeteor* pRet = new ParticleMeteor();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -616,7 +616,7 @@ ParticleMeteor* ParticleMeteor::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleMeteor::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleMeteor::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -711,7 +711,7 @@ ParticleSpiral* ParticleSpiral::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSpiral* ParticleSpiral::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSpiral* pRet = new ParticleSpiral();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -725,7 +725,7 @@ ParticleSpiral* ParticleSpiral::createWithTotalParticles(unsigned int numberOfPa
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSpiral::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSpiral::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -820,7 +820,7 @@ ParticleExplosion* ParticleExplosion::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleExplosion* pRet = new ParticleExplosion();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -834,7 +834,7 @@ ParticleExplosion* ParticleExplosion::createWithTotalParticles(unsigned int numb
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleExplosion::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleExplosion::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -928,7 +928,7 @@ ParticleSmoke* ParticleSmoke::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSmoke* ParticleSmoke::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSmoke* pRet = new ParticleSmoke();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -942,7 +942,7 @@ ParticleSmoke* ParticleSmoke::createWithTotalParticles(unsigned int numberOfPart
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSmoke::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSmoke::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -1033,7 +1033,7 @@ ParticleSnow* ParticleSnow::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSnow* ParticleSnow::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSnow* pRet = new ParticleSnow();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -1047,7 +1047,7 @@ ParticleSnow* ParticleSnow::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleSnow::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSnow::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
@ -1141,7 +1141,7 @@ ParticleRain* ParticleRain::create()
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleRain* ParticleRain::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleRain* pRet = new ParticleRain();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -1155,7 +1155,7 @@ ParticleRain* ParticleRain::createWithTotalParticles(unsigned int numberOfPartic
|
|||
return pRet;
|
||||
}
|
||||
|
||||
bool ParticleRain::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleRain::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
if( ParticleSystemQuad::initWithTotalParticles(numberOfParticles) )
|
||||
{
|
||||
|
|
|
@ -39,6 +39,10 @@ NS_CC_BEGIN
|
|||
class CC_DLL ParticleFire : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFire* create();
|
||||
static ParticleFire* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -49,16 +53,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFire(){}
|
||||
bool init(){ return initWithTotalParticles(250); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFire* create();
|
||||
static ParticleFire* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
||||
};
|
||||
|
||||
//! @brief A fireworks particle system
|
||||
class CC_DLL ParticleFireworks : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFireworks* create();
|
||||
static ParticleFireworks* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -69,16 +77,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFireworks(){}
|
||||
bool init(){ return initWithTotalParticles(1500); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFireworks* create();
|
||||
static ParticleFireworks* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A sun particle system
|
||||
class CC_DLL ParticleSun : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSun* create();
|
||||
static ParticleSun* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -89,16 +102,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSun(){}
|
||||
bool init(){ return initWithTotalParticles(350); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSun* create();
|
||||
static ParticleSun* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A galaxy particle system
|
||||
class CC_DLL ParticleGalaxy : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleGalaxy* create();
|
||||
static ParticleGalaxy* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -109,16 +127,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleGalaxy(){}
|
||||
bool init(){ return initWithTotalParticles(200); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleGalaxy* create();
|
||||
static ParticleGalaxy* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
||||
|
||||
};
|
||||
|
||||
//! @brief A flower particle system
|
||||
class CC_DLL ParticleFlower : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleFlower* create();
|
||||
static ParticleFlower* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -129,16 +152,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleFlower(){}
|
||||
bool init(){ return initWithTotalParticles(250); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleFlower* create();
|
||||
static ParticleFlower* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
||||
};
|
||||
|
||||
//! @brief A meteor particle system
|
||||
class CC_DLL ParticleMeteor : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleMeteor * create();
|
||||
static ParticleMeteor* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -149,16 +176,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleMeteor(){}
|
||||
bool init(){ return initWithTotalParticles(150); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
static ParticleMeteor * create();
|
||||
static ParticleMeteor* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
||||
};
|
||||
|
||||
//! @brief An spiral particle system
|
||||
class CC_DLL ParticleSpiral : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSpiral* create();
|
||||
static ParticleSpiral* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -169,16 +200,21 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSpiral(){}
|
||||
bool init(){ return initWithTotalParticles(500); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSpiral* create();
|
||||
static ParticleSpiral* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
||||
|
||||
};
|
||||
|
||||
//! @brief An explosion particle system
|
||||
class CC_DLL ParticleExplosion : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleExplosion* create();
|
||||
static ParticleExplosion* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -189,16 +225,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleExplosion(){}
|
||||
bool init(){ return initWithTotalParticles(700); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleExplosion* create();
|
||||
static ParticleExplosion* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
||||
};
|
||||
|
||||
//! @brief An smoke particle system
|
||||
class CC_DLL ParticleSmoke : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSmoke* create();
|
||||
static ParticleSmoke* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -209,16 +249,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSmoke(){}
|
||||
bool init(){ return initWithTotalParticles(200); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSmoke* create();
|
||||
static ParticleSmoke* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
||||
};
|
||||
|
||||
//! @brief An snow particle system
|
||||
class CC_DLL ParticleSnow : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleSnow* create();
|
||||
static ParticleSnow* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -229,16 +273,20 @@ public:
|
|||
*/
|
||||
virtual ~ParticleSnow(){}
|
||||
bool init(){ return initWithTotalParticles(700); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleSnow* create();
|
||||
static ParticleSnow* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
||||
};
|
||||
|
||||
//! @brief A rain particle system
|
||||
class CC_DLL ParticleRain : public ParticleSystemQuad
|
||||
{
|
||||
public:
|
||||
static ParticleRain* create();
|
||||
static ParticleRain* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
@ -249,10 +297,10 @@ public:
|
|||
*/
|
||||
virtual ~ParticleRain(){}
|
||||
bool init(){ return initWithTotalParticles(1000); }
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles);
|
||||
|
||||
static ParticleRain* create();
|
||||
static ParticleRain* createWithTotalParticles(unsigned int numberOfParticles);
|
||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -148,7 +148,7 @@ ParticleSystem * ParticleSystem::create(const std::string& plistFile)
|
|||
return pRet;
|
||||
}
|
||||
|
||||
ParticleSystem* ParticleSystem::createWithTotalParticles(unsigned int numberOfParticles)
|
||||
ParticleSystem* ParticleSystem::createWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
ParticleSystem *pRet = new ParticleSystem();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
|
@ -425,7 +425,7 @@ bool ParticleSystem::initWithDictionary(Dictionary *dictionary, const std::strin
|
|||
return bRet;
|
||||
}
|
||||
|
||||
bool ParticleSystem::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
_totalParticles = numberOfParticles;
|
||||
|
||||
|
|
|
@ -170,38 +170,7 @@ public:
|
|||
static ParticleSystem * create(const std::string& plistFile);
|
||||
|
||||
//! create a system with a fixed number of particles
|
||||
static ParticleSystem* createWithTotalParticles(unsigned 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);
|
||||
static ParticleSystem* createWithTotalParticles(int numberOfParticles);
|
||||
|
||||
//! Add a particle to the emitter
|
||||
bool addParticle();
|
||||
|
@ -393,10 +362,42 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual const BlendFunc &getBlendFunc() const override;
|
||||
protected:
|
||||
virtual void updateBlendFunc();
|
||||
|
||||
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.
|
||||
If enabled, the following blending function will be used.
|
||||
@code
|
||||
|
@ -551,6 +552,9 @@ protected:
|
|||
@since v0.8
|
||||
*/
|
||||
PositionType _positionType;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -46,7 +46,7 @@ NS_CC_BEGIN
|
|||
|
||||
//implementation ParticleSystemQuad
|
||||
// overriding the init method
|
||||
bool ParticleSystemQuad::initWithTotalParticles(unsigned int numberOfParticles)
|
||||
bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
|
||||
{
|
||||
// base initialization
|
||||
if( ParticleSystem::initWithTotalParticles(numberOfParticles) )
|
||||
|
@ -111,27 +111,27 @@ ParticleSystemQuad::~ParticleSystemQuad()
|
|||
|
||||
// implementation ParticleSystemQuad
|
||||
|
||||
ParticleSystemQuad * ParticleSystemQuad::create(const char *plistFile)
|
||||
ParticleSystemQuad * ParticleSystemQuad::create(const std::string& filename)
|
||||
{
|
||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
||||
if (pRet && pRet->initWithFile(plistFile))
|
||||
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||
if (ret && ret->initWithFile(filename))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return pRet;
|
||||
CC_SAFE_DELETE(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(unsigned int numberOfParticles) {
|
||||
ParticleSystemQuad *pRet = new ParticleSystemQuad();
|
||||
if (pRet && pRet->initWithTotalParticles(numberOfParticles))
|
||||
ParticleSystemQuad * ParticleSystemQuad::createWithTotalParticles(int numberOfParticles) {
|
||||
ParticleSystemQuad *ret = new ParticleSystemQuad();
|
||||
if (ret && ret->initWithTotalParticles(numberOfParticles))
|
||||
{
|
||||
pRet->autorelease();
|
||||
return pRet;
|
||||
ret->autorelease();
|
||||
return ret;
|
||||
}
|
||||
CC_SAFE_DELETE(pRet);
|
||||
return pRet;
|
||||
CC_SAFE_DELETE(ret);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -57,26 +57,11 @@ public:
|
|||
/** creates a Particle Emitter */
|
||||
static ParticleSystemQuad * create();
|
||||
/** 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.
|
||||
This plist files can be created manually or with Particle Designer:
|
||||
*/
|
||||
static ParticleSystemQuad * create(const char *plistFile);
|
||||
/**
|
||||
* @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);
|
||||
static ParticleSystemQuad * create(const std::string& filename);
|
||||
|
||||
/** Sets a new SpriteFrame as particle.
|
||||
WARNING: this method is experimental. Use setTextureWithRect instead.
|
||||
|
@ -102,7 +87,7 @@ public:
|
|||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual bool initWithTotalParticles(unsigned int numberOfParticles) override;
|
||||
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
@ -134,18 +119,36 @@ public:
|
|||
*/
|
||||
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 setupVBO();
|
||||
bool allocMemory();
|
||||
|
||||
protected:
|
||||
|
||||
V3F_C4B_T2F_Quad *_quads; // quads to be rendered
|
||||
GLushort *_indices; // indices
|
||||
|
||||
GLuint _VAOname;
|
||||
|
||||
GLuint _buffersVBO[2]; //0: vertex 1: indices
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
||||
};
|
||||
|
||||
// end of particle_nodes group
|
||||
|
|
|
@ -62,18 +62,6 @@ public:
|
|||
|
||||
/** Creates a progress timer with the sprite as the shape the timer goes through */
|
||||
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. */
|
||||
inline Type getType() const { return _type; }
|
||||
|
@ -129,6 +117,19 @@ public:
|
|||
virtual void setOpacity(GLubyte opacity) override;
|
||||
|
||||
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);
|
||||
Vertex2F vertexFromAlphaPoint(Point alpha);
|
||||
void updateProgress(void);
|
||||
|
@ -146,6 +147,9 @@ protected:
|
|||
V2F_C4B_T2F *_vertexData;
|
||||
|
||||
bool _reverseDirection;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
||||
};
|
||||
|
||||
// end of misc_nodes group
|
||||
|
|
|
@ -38,7 +38,9 @@ NS_CC_BEGIN
|
|||
class CC_DLL RGBAProtocol
|
||||
{
|
||||
public:
|
||||
/**
|
||||
virtual ~RGBAProtocol() {}
|
||||
|
||||
/**
|
||||
* Changes the color with R,G,B bytes
|
||||
*
|
||||
* @param color Example: Color3B(255,100,0) means R=255, G=100, B=0
|
||||
|
@ -165,6 +167,8 @@ public:
|
|||
class CC_DLL BlendProtocol
|
||||
{
|
||||
public:
|
||||
virtual ~BlendProtocol() {}
|
||||
|
||||
/**
|
||||
* Sets the source blending function.
|
||||
*
|
||||
|
@ -197,6 +201,7 @@ public:
|
|||
class CC_DLL TextureProtocol : public BlendProtocol
|
||||
{
|
||||
public:
|
||||
virtual ~TextureProtocol() {}
|
||||
/**
|
||||
* Returns the currently used texture
|
||||
*
|
||||
|
@ -222,6 +227,8 @@ public:
|
|||
class CC_DLL LabelProtocol
|
||||
{
|
||||
public:
|
||||
virtual ~LabelProtocol() {}
|
||||
|
||||
/**
|
||||
* Sets a new label using a string
|
||||
*
|
||||
|
@ -247,7 +254,9 @@ public:
|
|||
class CC_DLL DirectorDelegate
|
||||
{
|
||||
public:
|
||||
/**
|
||||
virtual ~DirectorDelegate() {}
|
||||
|
||||
/**
|
||||
* Will be called by Director when the projection is updated, and "custom" projection is used
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
|
@ -543,20 +543,20 @@ void RenderTexture::draw()
|
|||
}
|
||||
}
|
||||
|
||||
bool RenderTexture::saveToFile(const char *szFilePath)
|
||||
bool RenderTexture::saveToFile(const std::string& filename)
|
||||
{
|
||||
bool ret = false;
|
||||
|
||||
Image *image = newImage(true);
|
||||
if (image)
|
||||
{
|
||||
ret = image->saveToFile(szFilePath);
|
||||
ret = image->saveToFile(filename);
|
||||
}
|
||||
|
||||
CC_SAFE_DELETE(image);
|
||||
return ret;
|
||||
}
|
||||
bool RenderTexture::saveToFile(const char *fileName, Image::Format format)
|
||||
bool RenderTexture::saveToFile(const std::string& fileName, Image::Format format)
|
||||
{
|
||||
bool bRet = false;
|
||||
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 */
|
||||
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 */
|
||||
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.
|
||||
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.
|
||||
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.
|
||||
It only has effect on Android.
|
||||
|
@ -167,10 +152,20 @@ public:
|
|||
virtual void visit() override;
|
||||
virtual void draw() override;
|
||||
|
||||
private:
|
||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||
public:
|
||||
// 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:
|
||||
void beginWithClear(float r, float g, float b, float a, float depthValue, int stencilValue, GLbitfield flags);
|
||||
|
||||
GLuint _FBO;
|
||||
GLuint _depthRenderBufffer;
|
||||
GLint _oldFBO;
|
||||
|
@ -192,6 +187,10 @@ protected:
|
|||
- [[renderTexture sprite] setBlendFunc:(BlendFunc){GL_ONE, GL_ONE_MINUS_SRC_ALPHA}];
|
||||
*/
|
||||
Sprite* _sprite;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(RenderTexture);
|
||||
|
||||
};
|
||||
|
||||
// end of textures group
|
||||
|
|
|
@ -56,18 +56,9 @@ public:
|
|||
static Scene *createWithPhysics();
|
||||
#endif
|
||||
|
||||
Scene();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~Scene();
|
||||
|
||||
bool init();
|
||||
|
||||
|
||||
#ifdef CC_USE_PHYSICS
|
||||
public:
|
||||
bool initWithPhysics();
|
||||
|
||||
inline PhysicsWorld* getPhysicsWorld() { return _physicsWorld; }
|
||||
|
||||
|
@ -77,14 +68,23 @@ public:
|
|||
virtual void update(float delta) override;
|
||||
|
||||
protected:
|
||||
virtual void addChildToPhysicsWorld(Node* child);
|
||||
|
||||
protected:
|
||||
bool initWithPhysics();
|
||||
void addChildToPhysicsWorld(Node* child);
|
||||
|
||||
PhysicsWorld* _physicsWorld;
|
||||
#endif // CC_USE_PHYSICS
|
||||
|
||||
|
||||
|
||||
protected:
|
||||
Scene();
|
||||
virtual ~Scene();
|
||||
bool init();
|
||||
|
||||
friend class Node;
|
||||
friend class SpriteBatchNode;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Scene);
|
||||
};
|
||||
|
||||
// end of scene group
|
||||
|
|
|
@ -70,10 +70,10 @@ Sprite* Sprite::createWithTexture(Texture2D *texture)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect)
|
||||
Sprite* Sprite::createWithTexture(Texture2D *texture, const Rect& rect, bool rotated)
|
||||
{
|
||||
Sprite *sprite = new Sprite();
|
||||
if (sprite && sprite->initWithTexture(texture, rect))
|
||||
if (sprite && sprite->initWithTexture(texture, rect, rotated))
|
||||
{
|
||||
sprite->autorelease();
|
||||
return sprite;
|
||||
|
@ -145,7 +145,74 @@ Sprite* Sprite::create()
|
|||
|
||||
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
|
||||
|
@ -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)
|
||||
: _shouldBeHidden(false)
|
||||
, _texture(nullptr)
|
||||
|
@ -304,12 +278,83 @@ Sprite::~Sprite(void)
|
|||
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)
|
||||
{
|
||||
setTextureRect(rect, false, rect.size);
|
||||
}
|
||||
|
||||
|
||||
void Sprite::setTextureRect(const Rect& rect, bool rotated, const Size& untrimmedSize)
|
||||
{
|
||||
_rectRotated = rotated;
|
||||
|
@ -614,7 +659,7 @@ void Sprite::draw(void)
|
|||
|
||||
// Node overrides
|
||||
|
||||
void Sprite::addChild(Node* child)
|
||||
void Sprite::addChild(Node *child)
|
||||
{
|
||||
Node::addChild(child);
|
||||
}
|
||||
|
@ -673,7 +718,6 @@ void Sprite::removeChild(Node *child, bool cleanup)
|
|||
}
|
||||
|
||||
Node::removeChild(child, cleanup);
|
||||
|
||||
}
|
||||
|
||||
void Sprite::removeAllChildrenWithCleanup(bool cleanup)
|
||||
|
@ -982,20 +1026,30 @@ void Sprite::updateDisplayedOpacity(GLubyte opacity)
|
|||
|
||||
// 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
|
||||
if (pNewTexture != _texture)
|
||||
if (texture != _texture)
|
||||
{
|
||||
setTexture(pNewTexture);
|
||||
setTexture(texture);
|
||||
}
|
||||
|
||||
// update rect
|
||||
_rectRotated = pNewFrame->isRotated();
|
||||
setTextureRect(pNewFrame->getRect(), _rectRotated, pNewFrame->getOriginalSize());
|
||||
_rectRotated = spriteFrame->isRotated();
|
||||
setTextureRect(spriteFrame->getRect(), _rectRotated, spriteFrame->getOriginalSize());
|
||||
}
|
||||
|
||||
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");
|
||||
|
||||
setDisplayFrame(frame->getSpriteFrame());
|
||||
setSpriteFrame(frame->getSpriteFrame());
|
||||
}
|
||||
|
||||
bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
||||
|
@ -1022,7 +1076,7 @@ bool Sprite::isFrameDisplayed(SpriteFrame *frame) const
|
|||
frame->getOffset().equals(_unflippedOffsetPositionFromCenter));
|
||||
}
|
||||
|
||||
SpriteFrame* Sprite::getDisplayFrame()
|
||||
SpriteFrame* Sprite::getSpriteFrame() const
|
||||
{
|
||||
return SpriteFrame::createWithTexture(_texture,
|
||||
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
|
||||
|
|
|
@ -78,9 +78,6 @@ struct transformValues_;
|
|||
* The default anchorPoint in Sprite is (0.5, 0.5).
|
||||
*/
|
||||
class CC_DLL Sprite : public NodeRGBA, public TextureProtocol
|
||||
#ifdef EMSCRIPTEN
|
||||
, public GLBufferedNode
|
||||
#endif // EMSCRIPTEN
|
||||
{
|
||||
public:
|
||||
|
||||
|
@ -133,9 +130,10 @@ public:
|
|||
* @param texture A pointer to an existing Texture2D object.
|
||||
* 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 rotated Whether or not the rect is rotated
|
||||
* @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.
|
||||
|
@ -159,113 +157,6 @@ public:
|
|||
/// @} 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
|
||||
|
||||
|
@ -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.
|
||||
|
@ -320,30 +225,28 @@ public:
|
|||
*/
|
||||
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
|
||||
*/
|
||||
virtual bool isFrameDisplayed(SpriteFrame *pFrame) const;
|
||||
|
||||
/** @deprecated Use getDisplayFrame() instead */
|
||||
CC_DEPRECATED_ATTRIBUTE virtual SpriteFrame* displayFrame() { return getDisplayFrame(); };
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
|
@ -473,8 +376,6 @@ public:
|
|||
//
|
||||
/// @{
|
||||
/// @name Functions inherited from TextureProtocol
|
||||
virtual void setTexture(Texture2D *texture) override;
|
||||
virtual Texture2D* getTexture() const override;
|
||||
/**
|
||||
*@code
|
||||
*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 removeAllChildrenWithCleanup(bool cleanup) override;
|
||||
virtual void reorderChild(Node *child, int zOrder) override;
|
||||
virtual void addChild(Node *child) override;
|
||||
virtual void addChild(Node *child, int zOrder) override;
|
||||
// Should also override addChild(Node*) and addChild(Node*, int), or binding generator will only
|
||||
// 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 sortAllChildren() override;
|
||||
virtual void setScale(float scale) override;
|
||||
|
@ -531,6 +434,97 @@ public:
|
|||
/// @}
|
||||
|
||||
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);
|
||||
virtual void setTextureCoords(Rect rect);
|
||||
virtual void updateBlendFunc(void);
|
||||
|
@ -575,8 +569,11 @@ protected:
|
|||
bool _opacityModifyRGB;
|
||||
|
||||
// image is flipped
|
||||
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
||||
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
||||
bool _flippedX; /// Whether the sprite is flipped horizontally or not
|
||||
bool _flippedY; /// Whether the sprite is flipped vertically or not
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(Sprite);
|
||||
};
|
||||
|
||||
|
||||
|
|
|
@ -319,7 +319,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames(void)
|
|||
void SpriteFrameCache::removeSpriteFrameByName(const std::string& name)
|
||||
{
|
||||
// explicit nil handling
|
||||
if( ! name.size()>0 )
|
||||
if( !(name.size()>0) )
|
||||
return;
|
||||
|
||||
// Is this an alias ?
|
||||
|
|
|
@ -294,9 +294,9 @@ Sprite* TMXLayer::reusedTileWithRect(Rect rect)
|
|||
{
|
||||
if (! _reusedTile)
|
||||
{
|
||||
_reusedTile = new Sprite();
|
||||
_reusedTile->initWithTexture(_textureAtlas->getTexture(), rect, false);
|
||||
_reusedTile = Sprite::createWithTexture(_textureAtlas->getTexture(), rect);
|
||||
_reusedTile->setBatchNode(this);
|
||||
_reusedTile->retain();
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -335,8 +335,7 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
|||
Rect rect = _tileSet->rectForGID(gid);
|
||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
||||
|
||||
tile = new Sprite();
|
||||
tile->initWithTexture(this->getTexture(), rect);
|
||||
tile = Sprite::createWithTexture(this->getTexture(), rect);
|
||||
tile->setBatchNode(this);
|
||||
tile->setPosition(getPositionAt(pos));
|
||||
tile->setVertexZ((float)getVertexZForPos(pos));
|
||||
|
@ -345,7 +344,6 @@ Sprite * TMXLayer::getTileAt(const Point& pos)
|
|||
|
||||
unsigned int indexForZ = atlasIndexForExistantZ(z);
|
||||
this->addSpriteWithoutQuad(tile, indexForZ, z);
|
||||
tile->release();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -109,28 +109,12 @@ object->getProperty(name_of_the_property);
|
|||
class CC_DLL TMXTiledMap : public Node
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TMXTiledMap();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TMXTiledMap();
|
||||
|
||||
/** creates a TMX Tiled Map with a TMX file.*/
|
||||
static TMXTiledMap* create(const std::string& tmxFile);
|
||||
|
||||
/** 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);
|
||||
|
||||
/** 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 */
|
||||
TMXLayer* getLayer(const std::string& layerName) const;
|
||||
/**
|
||||
|
@ -187,11 +171,27 @@ public:
|
|||
_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);
|
||||
TMXTilesetInfo * tilesetForLayer(TMXLayerInfo *layerInfo, TMXMapInfo *mapInfo);
|
||||
void buildWithMapInfo(TMXMapInfo* mapInfo);
|
||||
protected:
|
||||
|
||||
/** the map's size property measured in tiles */
|
||||
Size _mapSize;
|
||||
/** the tiles's size property measured in pixels */
|
||||
|
@ -206,6 +206,9 @@ protected:
|
|||
//! tile properties
|
||||
Dictionary* _tileProperties;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TMXTiledMap);
|
||||
|
||||
};
|
||||
|
||||
// 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.
|
||||
****************************************************************************/
|
||||
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include <sstream>
|
||||
#include "CCTMXXMLParser.h"
|
||||
#include "CCTMXTiledMap.h"
|
||||
|
@ -38,11 +38,11 @@ using namespace std;
|
|||
|
||||
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)
|
||||
{
|
||||
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 "";
|
||||
|
@ -244,7 +244,7 @@ void TMXMapInfo::startElement(void *ctx, const char *name, const char **atts)
|
|||
CC_UNUSED_PARAM(ctx);
|
||||
TMXMapInfo *pTMXMapInfo = this;
|
||||
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])
|
||||
{
|
||||
for(int i = 0; atts[i]; i += 2)
|
||||
|
|
|
@ -40,6 +40,8 @@ class TextFieldTTF;
|
|||
class CC_DLL TextFieldDelegate
|
||||
{
|
||||
public:
|
||||
virtual ~TextFieldDelegate() {}
|
||||
|
||||
/**
|
||||
@brief If the sender doesn't want to attach to the IME, return true;
|
||||
*/
|
||||
|
|
|
@ -28,6 +28,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <map>
|
||||
|
||||
#include "CCObject.h"
|
||||
#include "CCGeometry.h"
|
||||
|
|
|
@ -36,7 +36,7 @@ NS_CC_BEGIN
|
|||
|
||||
// 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();
|
||||
if (pRet->initWithTileFile(tile, mapFile, tileWidth, tileHeight))
|
||||
|
@ -48,7 +48,7 @@ TileMapAtlas * TileMapAtlas::create(const char *tile, const char *mapFile, int t
|
|||
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->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);
|
||||
|
||||
// //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.
|
||||
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
|
||||
*/
|
||||
|
@ -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.
|
||||
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.
|
||||
For the moment only channel R is used
|
||||
*/
|
||||
|
@ -89,13 +89,14 @@ public:
|
|||
|
||||
inline struct sImageTGA* getTGAInfo() const { return _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 updateAtlasValueAt(const Point& pos, const Color3B& value, int index);
|
||||
void updateAtlasValues();
|
||||
|
||||
protected:
|
||||
|
||||
//! x,y to atlas dictionary
|
||||
Dictionary* _posToAtlasIndex;
|
||||
//! numbers of tiles to render
|
||||
|
|
|
@ -77,7 +77,6 @@ bool TransitionScene::initWithDuration(float t, Scene *scene)
|
|||
if (_outScene == NULL)
|
||||
{
|
||||
_outScene = Scene::create();
|
||||
_outScene->init();
|
||||
}
|
||||
_outScene->retain();
|
||||
|
||||
|
|
|
@ -50,6 +50,8 @@ class Node;
|
|||
class CC_DLL TransitionEaseScene// : public Object
|
||||
{
|
||||
public:
|
||||
virtual ~TransitionEaseScene() {}
|
||||
|
||||
/** returns the Ease action that will be performed on a linear action.
|
||||
@since v0.8.2
|
||||
*/
|
||||
|
@ -77,18 +79,6 @@ public:
|
|||
|
||||
/** creates a base transition with duration and incoming 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 */
|
||||
void finish(void);
|
||||
|
@ -100,30 +90,27 @@ public:
|
|||
// Overrides
|
||||
//
|
||||
virtual void draw() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onExit() override;
|
||||
virtual void cleanup() override;
|
||||
|
||||
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);
|
||||
|
||||
protected:
|
||||
Scene * _inScene;
|
||||
Scene * _outScene;
|
||||
float _duration;
|
||||
bool _isInSceneOnTop;
|
||||
bool _isSendCleanupToScene;
|
||||
Scene *_inScene;
|
||||
Scene *_outScene;
|
||||
float _duration;
|
||||
bool _isInSceneOnTop;
|
||||
bool _isSendCleanupToScene;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionScene);
|
||||
};
|
||||
|
||||
/** @brief A Transition that supports orientation like.
|
||||
|
@ -134,21 +121,18 @@ class CC_DLL TransitionSceneOriented : public TransitionScene
|
|||
public:
|
||||
/** creates a base transition with duration and incoming scene */
|
||||
static TransitionSceneOriented * create(float t,Scene* scene, Orientation orientation);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionSceneOriented();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSceneOriented();
|
||||
|
||||
/** initializes a transition with duration and incoming scene */
|
||||
bool initWithDuration(float t,Scene* scene,Orientation orientation);
|
||||
|
||||
protected:
|
||||
Orientation _orientation;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSceneOriented);
|
||||
};
|
||||
|
||||
/** @brief TransitionRotoZoom:
|
||||
|
@ -159,21 +143,18 @@ class CC_DLL TransitionRotoZoom : public TransitionScene
|
|||
public:
|
||||
static TransitionRotoZoom* create(float t, Scene* scene);
|
||||
|
||||
TransitionRotoZoom();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionRotoZoom();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionRotoZoom();
|
||||
virtual ~TransitionRotoZoom();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionRotoZoom);
|
||||
|
||||
};
|
||||
|
||||
/** @brief TransitionJumpZoom:
|
||||
|
@ -183,24 +164,18 @@ class CC_DLL TransitionJumpZoom : public TransitionScene
|
|||
{
|
||||
public:
|
||||
static TransitionJumpZoom* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionJumpZoom();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionJumpZoom();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionJumpZoom();
|
||||
virtual ~TransitionJumpZoom();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionJumpZoom);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInL:
|
||||
|
@ -210,17 +185,7 @@ class CC_DLL TransitionMoveInL : public TransitionScene, public TransitionEaseSc
|
|||
{
|
||||
public:
|
||||
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 */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
|
@ -229,11 +194,17 @@ public:
|
|||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionMoveInL();
|
||||
virtual ~TransitionMoveInL();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInL);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInR:
|
||||
|
@ -243,16 +214,15 @@ class CC_DLL TransitionMoveInR : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInR* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInR();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInR();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInR);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInT:
|
||||
|
@ -262,16 +232,15 @@ class CC_DLL TransitionMoveInT : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInT* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInT();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInT();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInT);
|
||||
};
|
||||
|
||||
/** @brief TransitionMoveInB:
|
||||
|
@ -281,16 +250,15 @@ class CC_DLL TransitionMoveInB : public TransitionMoveInL
|
|||
{
|
||||
public:
|
||||
static TransitionMoveInB* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
|
||||
protected:
|
||||
TransitionMoveInB();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionMoveInB();
|
||||
|
||||
virtual void initScenes();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionMoveInB);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInL:
|
||||
|
@ -300,34 +268,28 @@ class CC_DLL TransitionSlideInL : public TransitionScene, public TransitionEaseS
|
|||
{
|
||||
public:
|
||||
static TransitionSlideInL* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSlideInL();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSlideInL();
|
||||
|
||||
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 */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
|
||||
protected:
|
||||
TransitionSlideInL();
|
||||
virtual ~TransitionSlideInL();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInL);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInR:
|
||||
|
@ -337,23 +299,21 @@ class CC_DLL TransitionSlideInR : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
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 */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInR();
|
||||
virtual ~TransitionSlideInR();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInR);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInB:
|
||||
|
@ -363,23 +323,21 @@ class CC_DLL TransitionSlideInB : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
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 */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInB();
|
||||
virtual ~TransitionSlideInB();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes();
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInB);
|
||||
};
|
||||
|
||||
/** @brief TransitionSlideInT:
|
||||
|
@ -389,23 +347,21 @@ class CC_DLL TransitionSlideInT : public TransitionSlideInL
|
|||
{
|
||||
public:
|
||||
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 */
|
||||
virtual ActionInterval* action(void);
|
||||
|
||||
protected:
|
||||
TransitionSlideInT();
|
||||
virtual ~TransitionSlideInT();
|
||||
|
||||
/** initializes the scenes */
|
||||
virtual void initScenes(void);
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSlideInT);
|
||||
};
|
||||
|
||||
/**
|
||||
|
@ -415,21 +371,23 @@ class CC_DLL TransitionShrinkGrow : public TransitionScene , public TransitionEa
|
|||
{
|
||||
public:
|
||||
static TransitionShrinkGrow* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionShrinkGrow();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionShrinkGrow();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionShrinkGrow();
|
||||
virtual ~TransitionShrinkGrow();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionShrinkGrow);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipX:
|
||||
|
@ -441,15 +399,6 @@ class CC_DLL TransitionFlipX : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipX* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipX* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipX();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipX();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -459,6 +408,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipX();
|
||||
virtual ~TransitionFlipX();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipX);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipY:
|
||||
|
@ -470,15 +426,6 @@ class CC_DLL TransitionFlipY : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipY* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipY* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipY();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipY();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -488,6 +435,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipY();
|
||||
virtual ~TransitionFlipY();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipY);
|
||||
};
|
||||
|
||||
/** @brief TransitionFlipAngular:
|
||||
|
@ -499,15 +453,6 @@ class CC_DLL TransitionFlipAngular : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionFlipAngular* create(float t, Scene* s, Orientation o);
|
||||
static TransitionFlipAngular* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFlipAngular();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFlipAngular();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -517,6 +462,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionFlipAngular();
|
||||
virtual ~TransitionFlipAngular();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFlipAngular);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipX:
|
||||
|
@ -528,15 +480,6 @@ class CC_DLL TransitionZoomFlipX : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipX* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipX* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipX();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipX();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -546,6 +489,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipX();
|
||||
virtual ~TransitionZoomFlipX();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipX);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipY:
|
||||
|
@ -557,15 +507,6 @@ class CC_DLL TransitionZoomFlipY : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipY* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipY* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipY();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipY();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -575,6 +516,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipY();
|
||||
virtual ~TransitionZoomFlipY();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipY);
|
||||
};
|
||||
|
||||
/** @brief TransitionZoomFlipAngular:
|
||||
|
@ -586,15 +534,6 @@ class CC_DLL TransitionZoomFlipAngular : public TransitionSceneOriented
|
|||
public:
|
||||
static TransitionZoomFlipAngular* create(float t, Scene* s, Orientation o);
|
||||
static TransitionZoomFlipAngular* create(float t, Scene* s);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionZoomFlipAngular();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionZoomFlipAngular();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -604,6 +543,13 @@ public:
|
|||
* @lua NA
|
||||
*/
|
||||
virtual void onEnter() override;
|
||||
|
||||
protected:
|
||||
TransitionZoomFlipAngular();
|
||||
virtual ~TransitionZoomFlipAngular();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionZoomFlipAngular);
|
||||
};
|
||||
|
||||
/** @brief TransitionFade:
|
||||
|
@ -615,25 +561,9 @@ public:
|
|||
/** creates the transition with a duration and with an RGB 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);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFade();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFade();
|
||||
static TransitionFade* create(float duration, Scene* scene, const Color3B& color);
|
||||
static TransitionFade* create(float duration, Scene* scene);
|
||||
|
||||
/** 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
|
||||
* @lua NA
|
||||
|
@ -646,7 +576,18 @@ public:
|
|||
virtual void onExit();
|
||||
|
||||
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;
|
||||
|
@ -658,19 +599,14 @@ class CC_DLL TransitionCrossFade : public TransitionScene
|
|||
{
|
||||
public :
|
||||
static TransitionCrossFade* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionCrossFade();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionCrossFade();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void draw() override;
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -683,6 +619,12 @@ public :
|
|||
*/
|
||||
virtual void onExit() override;
|
||||
|
||||
protected:
|
||||
TransitionCrossFade();
|
||||
virtual ~TransitionCrossFade();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionCrossFade);
|
||||
};
|
||||
|
||||
/** @brief TransitionTurnOffTiles:
|
||||
|
@ -692,15 +634,6 @@ class CC_DLL TransitionTurnOffTiles : public TransitionScene ,public TransitionE
|
|||
{
|
||||
public :
|
||||
static TransitionTurnOffTiles* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionTurnOffTiles();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionTurnOffTiles();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -713,7 +646,13 @@ public :
|
|||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionTurnOffTiles();
|
||||
virtual ~TransitionTurnOffTiles();
|
||||
|
||||
virtual void sceneOrder() override;
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionTurnOffTiles);
|
||||
};
|
||||
|
||||
/** @brief TransitionSplitCols:
|
||||
|
@ -723,17 +662,8 @@ class CC_DLL TransitionSplitCols : public TransitionScene , public TransitionEas
|
|||
{
|
||||
public:
|
||||
static TransitionSplitCols* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSplitCols();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSplitCols();
|
||||
|
||||
virtual ActionInterval* action(void);
|
||||
virtual ActionInterval* action();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
|
@ -744,6 +674,13 @@ public:
|
|||
*/
|
||||
virtual void onEnter() override;
|
||||
virtual ActionInterval * easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionSplitCols();
|
||||
virtual ~TransitionSplitCols();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitCols);
|
||||
};
|
||||
|
||||
/** @brief TransitionSplitRows:
|
||||
|
@ -753,20 +690,18 @@ class CC_DLL TransitionSplitRows : public TransitionSplitCols
|
|||
{
|
||||
public:
|
||||
static TransitionSplitRows* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionSplitRows();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionSplitRows();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* action(void) override;
|
||||
|
||||
protected:
|
||||
TransitionSplitRows();
|
||||
virtual ~TransitionSplitRows();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionSplitRows);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeTR:
|
||||
|
@ -776,15 +711,7 @@ class CC_DLL TransitionFadeTR : public TransitionScene , public TransitionEaseSc
|
|||
{
|
||||
public:
|
||||
static TransitionFadeTR* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeTR();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeTR();
|
||||
|
||||
virtual ActionInterval* actionWithSize(const Size& size);
|
||||
|
||||
//
|
||||
|
@ -798,7 +725,13 @@ public:
|
|||
virtual ActionInterval* easeActionWithAction(ActionInterval * action) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeTR();
|
||||
virtual ~TransitionFadeTR();
|
||||
|
||||
virtual void sceneOrder();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeTR);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeBL:
|
||||
|
@ -808,21 +741,18 @@ class CC_DLL TransitionFadeBL : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeBL* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeBL();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeBL();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeBL();
|
||||
virtual ~TransitionFadeBL();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeBL);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeUp:
|
||||
|
@ -832,20 +762,18 @@ class CC_DLL TransitionFadeUp : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeUp* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeUp();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeUp();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeUp();
|
||||
virtual ~TransitionFadeUp();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeUp);
|
||||
};
|
||||
|
||||
/** @brief TransitionFadeDown:
|
||||
|
@ -855,20 +783,19 @@ class CC_DLL TransitionFadeDown : public TransitionFadeTR
|
|||
{
|
||||
public:
|
||||
static TransitionFadeDown* create(float t, Scene* scene);
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
TransitionFadeDown();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~TransitionFadeDown();
|
||||
|
||||
//
|
||||
// Overrides
|
||||
//
|
||||
virtual ActionInterval* actionWithSize(const Size& size) override;
|
||||
|
||||
protected:
|
||||
TransitionFadeDown();
|
||||
virtual ~TransitionFadeDown();
|
||||
|
||||
private:
|
||||
CC_DISALLOW_COPY_AND_ASSIGN(TransitionFadeDown);
|
||||
|
||||
};
|
||||
|
||||
// end of transition group
|
||||
|
|
|
@ -511,7 +511,7 @@ public:
|
|||
unzFile zipFile;
|
||||
|
||||
// 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;
|
||||
};
|
||||
|
||||
|
|
|
@ -30,7 +30,7 @@ NS_CC_BEGIN
|
|||
|
||||
const char* cocos2dVersion()
|
||||
{
|
||||
return "3.0-alpha1";
|
||||
return "3.0-beta0-pre";
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -2,13 +2,12 @@
|
|||
#define __CCDEVICE_H__
|
||||
|
||||
#include "CCPlatformMacros.h"
|
||||
#include "ccMacros.h"
|
||||
|
||||
NS_CC_BEGIN
|
||||
|
||||
class CC_DLL Device
|
||||
{
|
||||
private:
|
||||
Device();
|
||||
public:
|
||||
/**
|
||||
* Gets the DPI of device
|
||||
|
@ -24,6 +23,9 @@ public:
|
|||
* Sets the interval of accelerometer.
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
Rect EGLViewProtocol::getScissorRect()
|
||||
Rect EGLViewProtocol::getScissorRect() const
|
||||
{
|
||||
GLfloat params[4];
|
||||
glGetFloatv(GL_SCISSOR_BOX, params);
|
||||
|
@ -188,15 +188,12 @@ Rect EGLViewProtocol::getScissorRect()
|
|||
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)
|
||||
{
|
||||
strncpy(_viewName, pszViewName, sizeof(_viewName));
|
||||
}
|
||||
_viewName = viewname;
|
||||
}
|
||||
|
||||
const char* EGLViewProtocol::getViewName()
|
||||
const std::string& EGLViewProtocol::getViewName() const
|
||||
{
|
||||
return _viewName;
|
||||
}
|
||||
|
|
|
@ -129,11 +129,10 @@ public:
|
|||
/**
|
||||
* Get the current scissor rectangle
|
||||
*/
|
||||
virtual Rect getScissorRect();
|
||||
virtual Rect getScissorRect() const;
|
||||
|
||||
virtual void setViewName(const char* pszViewName);
|
||||
|
||||
const char* getViewName();
|
||||
virtual void setViewName(const std::string& viewname);
|
||||
const std::string& getViewName() const;
|
||||
|
||||
/** 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[]);
|
||||
|
@ -155,10 +154,11 @@ public:
|
|||
* Get scale factor of the vertical direction.
|
||||
*/
|
||||
float getScaleY() const;
|
||||
private:
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
||||
|
||||
|
||||
protected:
|
||||
void handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, int num, long ids[], float xs[], float ys[]);
|
||||
|
||||
EGLTouchDelegate* _delegate;
|
||||
|
||||
// real screen size
|
||||
|
@ -168,7 +168,7 @@ protected:
|
|||
// the view port size
|
||||
Rect _viewPortRect;
|
||||
// the view name
|
||||
char _viewName[50];
|
||||
std::string _viewName;
|
||||
|
||||
float _scaleX;
|
||||
float _scaleY;
|
||||
|
|
|
@ -26,7 +26,7 @@ THE SOFTWARE.
|
|||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <unordered_map>
|
||||
#include "CCPlatformMacros.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.
|
||||
* 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.
|
||||
|
|
|
@ -193,7 +193,7 @@ public:
|
|||
@param filePath the file's absolute path, including file suffix.
|
||||
@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:
|
||||
bool initWithJpgData(const unsigned char * data, int dataLen);
|
||||
|
@ -207,8 +207,8 @@ protected:
|
|||
bool initWithS3TCData(const unsigned char * data, int dataLen);
|
||||
bool initWithATITCData(const unsigned char *data, int dataLen);
|
||||
|
||||
bool saveImageToPNG(const char *filePath, bool isToRGB = true);
|
||||
bool saveImageToJPG(const char *filePath);
|
||||
bool saveImageToPNG(const std::string& filePath, bool isToRGB = true);
|
||||
bool saveImageToJPG(const std::string& filePath);
|
||||
|
||||
private:
|
||||
/**
|
||||
|
|
|
@ -1784,7 +1784,7 @@ bool Image::initWithRawData(const unsigned char * data, long dataLen, long width
|
|||
|
||||
|
||||
#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
|
||||
if (isCompressed() || (_renderFormat != Texture2D::PixelFormat::RGB888 && _renderFormat != Texture2D::PixelFormat::RGBA8888))
|
||||
|
@ -1797,24 +1797,22 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == pszFilePath);
|
||||
|
||||
std::string strFilePath(pszFilePath);
|
||||
CC_BREAK_IF(strFilePath.size() <= 4);
|
||||
CC_BREAK_IF(filename.size() <= 4);
|
||||
|
||||
std::string strLowerCasePath(strFilePath);
|
||||
std::string strLowerCasePath(filename);
|
||||
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"))
|
||||
{
|
||||
CC_BREAK_IF(!saveImageToPNG(pszFilePath, bIsToRGB));
|
||||
CC_BREAK_IF(!saveImageToPNG(filename, bIsToRGB));
|
||||
}
|
||||
else if (std::string::npos != strLowerCasePath.find(".jpg"))
|
||||
{
|
||||
CC_BREAK_IF(!saveImageToJPG(pszFilePath));
|
||||
CC_BREAK_IF(!saveImageToJPG(filename));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1828,20 +1826,18 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
}
|
||||
#endif
|
||||
|
||||
bool Image::saveImageToPNG(const char * filePath, bool isToRGB)
|
||||
bool Image::saveImageToPNG(const std::string& filePath, bool isToRGB)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == filePath);
|
||||
|
||||
FILE *fp;
|
||||
png_structp png_ptr;
|
||||
png_infop info_ptr;
|
||||
png_colorp palette;
|
||||
png_bytep *row_pointers;
|
||||
|
||||
fp = fopen(filePath, "wb");
|
||||
fp = fopen(filePath.c_str(), "wb");
|
||||
CC_BREAK_IF(NULL == fp);
|
||||
|
||||
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);
|
||||
return bRet;
|
||||
}
|
||||
bool Image::saveImageToJPG(const char * filePath)
|
||||
bool Image::saveImageToJPG(const std::string& filePath)
|
||||
{
|
||||
bool bRet = false;
|
||||
do
|
||||
{
|
||||
CC_BREAK_IF(NULL == filePath);
|
||||
|
||||
struct jpeg_compress_struct cinfo;
|
||||
struct jpeg_error_mgr jerr;
|
||||
FILE * outfile; /* target file */
|
||||
|
@ -1985,7 +1979,7 @@ bool Image::saveImageToJPG(const char * filePath)
|
|||
/* Now we can initialize the JPEG compression object. */
|
||||
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);
|
||||
|
||||
|
|
|
@ -39,6 +39,8 @@ typedef unsigned char CC_XML_CHAR;
|
|||
class CC_DLL SAXDelegator
|
||||
{
|
||||
public:
|
||||
virtual ~SAXDelegator() {}
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
|
@ -380,12 +380,12 @@ bool Image::initWithStringShadowStroke(
|
|||
return true;
|
||||
}
|
||||
|
||||
bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
||||
bool Image::saveToFile(const std::string& filename, bool bIsToRGB)
|
||||
{
|
||||
bool saveToPNG = false;
|
||||
bool needToCopyPixels = false;
|
||||
std::string filePath(pszFilePath);
|
||||
if (std::string::npos != filePath.find(".png"))
|
||||
|
||||
if (std::string::npos != filename.find(".png"))
|
||||
{
|
||||
saveToPNG = true;
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ bool Image::saveToFile(const char *pszFilePath, bool bIsToRGB)
|
|||
data = UIImageJPEGRepresentation(image, 1.0f);
|
||||
}
|
||||
|
||||
[data writeToFile:[NSString stringWithUTF8String:pszFilePath] atomically:YES];
|
||||
[data writeToFile:[NSString stringWithUTF8String:filename.c_str()] atomically:YES];
|
||||
|
||||
[image release];
|
||||
|
||||
|
|
|
@ -478,8 +478,7 @@ static CCEAGLView *__view = 0;
|
|||
cocos2d::EGLView::getInstance()->handleTouchesCancel(i, (long*)ids, xs, ys);
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UIView - Responder
|
||||
#pragma mark - UIView - Responder
|
||||
|
||||
- (BOOL)canBecomeFirstResponder
|
||||
{
|
||||
|
@ -506,8 +505,7 @@ static CCEAGLView *__view = 0;
|
|||
return [super resignFirstResponder];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UIKeyInput protocol
|
||||
#pragma mark - UIKeyInput protocol
|
||||
|
||||
|
||||
- (BOOL)hasText
|
||||
|
@ -534,16 +532,14 @@ static CCEAGLView *__view = 0;
|
|||
cocos2d::IMEDispatcher::sharedDispatcher()->dispatchDeleteBackward();
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UITextInputTrait protocol
|
||||
#pragma mark - UITextInputTrait protocol
|
||||
|
||||
-(UITextAutocapitalizationType) autocapitalizationType
|
||||
{
|
||||
return UITextAutocapitalizationTypeNone;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UITextInput protocol
|
||||
#pragma mark - UITextInput protocol
|
||||
|
||||
#pragma mark UITextInput - properties
|
||||
|
||||
|
@ -727,8 +723,7 @@ static CCEAGLView *__view = 0;
|
|||
return nil;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark UIKeyboard notification
|
||||
#pragma mark - UIKeyboard notification
|
||||
|
||||
- (void)onUIKeyboardNotification:(NSNotification *)notif;
|
||||
{
|
||||
|
|
|
@ -290,7 +290,7 @@ EGLView::EGLView()
|
|||
{
|
||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||
s_pEglView = this;
|
||||
strcpy(_viewName, "Cocos2dxWin32");
|
||||
_viewName = "Cocos2dxWin32";
|
||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||
glfwInit();
|
||||
}
|
||||
|
@ -310,7 +310,7 @@ bool EGLView::init(const char* viewName, float width, float height, float frameZ
|
|||
setFrameZoomFactor(frameZoomFactor);
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
THE SOFTWARE.
|
||||
****************************************************************************/
|
||||
|
||||
#include "CCEGLView.h"
|
||||
|
||||
#include <unordered_map>
|
||||
|
||||
#include "EAGLView.h"
|
||||
#include "CCDirector.h"
|
||||
#include "CCSet.h"
|
||||
|
@ -34,7 +38,7 @@
|
|||
NS_CC_BEGIN
|
||||
|
||||
|
||||
static std::map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
||||
static std::unordered_map<int, EventKeyboard::KeyCode> g_keyCodeMap = {
|
||||
/* The unknown key */
|
||||
{ GLFW_KEY_UNKNOWN , EventKeyboard::KeyCode::KEY_NONE },
|
||||
|
||||
|
@ -308,8 +312,8 @@ EGLView::EGLView()
|
|||
, _mainWindow(nullptr)
|
||||
{
|
||||
CCASSERT(nullptr == s_pEglView, "EGLView is singleton, Should be inited only one time\n");
|
||||
_viewName = "cocos2dx";
|
||||
s_pEglView = this;
|
||||
strcpy(_viewName, "Cocos2dxWin32");
|
||||
glfwSetErrorCallback(EGLViewEventHandler::OnGLFWError);
|
||||
glfwInit();
|
||||
}
|
||||
|
@ -330,7 +334,7 @@ bool EGLView::init(const char *viewName, float width, float height, float frameZ
|
|||
setFrameZoomFactor(frameZoomFactor);
|
||||
|
||||
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);
|
||||
|
||||
glfwGetFramebufferSize(_mainWindow, &_frameBufferSize[0], &_frameBufferSize[1]);
|
||||
|
|
|
@ -37,8 +37,7 @@
|
|||
#import "ccConfig.h"
|
||||
|
||||
//NS_CC_BEGIN;
|
||||
#pragma mark -
|
||||
#pragma mark MouseEventDelegate
|
||||
#pragma mark - MouseEventDelegate
|
||||
|
||||
/** MouseEventDelegate protocol.
|
||||
Implement it in your node to receive any of mouse events
|
||||
|
@ -135,8 +134,7 @@
|
|||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark KeyboardEventDelegate
|
||||
#pragma mark - KeyboardEventDelegate
|
||||
|
||||
/** KeyboardEventDelegate protocol.
|
||||
Implement it in your node to receive any of keyboard events
|
||||
|
@ -189,8 +187,7 @@
|
|||
@end
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark EventDispatcher
|
||||
#pragma mark - EventDispatcher
|
||||
|
||||
struct _listEntry;
|
||||
|
||||
|
|
|
@ -77,8 +77,7 @@ float const kCD_GainDefault = 1.0f;
|
|||
-(BOOL) _setUpSourceGroups:(int[]) definitions total:(NSUInteger) total;
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CDUtilities
|
||||
#pragma mark - CDUtilities
|
||||
|
||||
@implementation CDUtilities
|
||||
|
||||
|
@ -1262,8 +1261,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDAudioInterruptTargetGroup
|
||||
#pragma mark - CDAudioInterruptTargetGroup
|
||||
|
||||
@implementation CDAudioInterruptTargetGroup
|
||||
|
||||
|
@ -1326,8 +1324,7 @@ static BOOL _mixerRateSet = NO;
|
|||
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark CDAsynchBufferLoader
|
||||
#pragma mark - CDAsynchBufferLoader
|
||||
|
||||
@implementation CDAsynchBufferLoader
|
||||
|
||||
|
@ -1371,8 +1368,7 @@ static BOOL _mixerRateSet = NO;
|
|||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDBufferLoadRequest
|
||||
#pragma mark - CDBufferLoadRequest
|
||||
|
||||
@implementation CDBufferLoadRequest
|
||||
|
||||
|
@ -1394,8 +1390,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDFloatInterpolator
|
||||
#pragma mark - CDFloatInterpolator
|
||||
|
||||
@implementation CDFloatInterpolator
|
||||
@synthesize start,end,interpolationType;
|
||||
|
@ -1443,8 +1438,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDPropertyModifier
|
||||
#pragma mark - CDPropertyModifier
|
||||
|
||||
@implementation CDPropertyModifier
|
||||
|
||||
|
@ -1542,8 +1536,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDSoundSourceFader
|
||||
#pragma mark - CDSoundSourceFader
|
||||
|
||||
@implementation CDSoundSourceFader
|
||||
|
||||
|
@ -1566,8 +1559,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDSoundSourcePanner
|
||||
#pragma mark - CDSoundSourcePanner
|
||||
|
||||
@implementation CDSoundSourcePanner
|
||||
|
||||
|
@ -1590,8 +1582,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDSoundSourcePitchBender
|
||||
#pragma mark - CDSoundSourcePitchBender
|
||||
|
||||
@implementation CDSoundSourcePitchBender
|
||||
|
||||
|
@ -1614,8 +1605,7 @@ static BOOL _mixerRateSet = NO;
|
|||
@end
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////
|
||||
#pragma mark -
|
||||
#pragma mark CDSoundEngineFader
|
||||
#pragma mark - CDSoundEngineFader
|
||||
|
||||
@implementation CDSoundEngineFader
|
||||
|
||||
|
|
|
@ -234,19 +234,29 @@ public: virtual void set##funName(varType var) \
|
|||
#define LUALOG(format, ...) cocos2d::log(format, ##__VA_ARGS__)
|
||||
#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))) \
|
||||
|| (defined(__clang__) && (__clang_major__ >= 3))
|
||||
#define CC_DISABLE_COPY(Class) \
|
||||
private: \
|
||||
Class(const Class &) = delete; \
|
||||
Class &operator =(const Class &) = delete;
|
||||
|| (defined(__clang__) && (__clang_major__ >= 3))
|
||||
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
TypeName(const TypeName &) = delete; \
|
||||
TypeName &operator =(const TypeName &) = delete;
|
||||
#else
|
||||
#define CC_DISABLE_COPY(Class) \
|
||||
private: \
|
||||
Class(const Class &); \
|
||||
Class &operator =(const Class &);
|
||||
#define CC_DISALLOW_COPY_AND_ASSIGN(TypeName) \
|
||||
Class(const TypeName &); \
|
||||
Class &operator =(const TypeName &);
|
||||
#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))
|
||||
*/
|
||||
|
|
|
@ -13,6 +13,7 @@ namespace cocosbuilder {
|
|||
class CCBAnimationManagerDelegate
|
||||
{
|
||||
public:
|
||||
virtual ~CCBAnimationManagerDelegate() {}
|
||||
virtual void completedAnimationSequenceNamed(const char *name) = 0;
|
||||
};
|
||||
|
||||
|
|
|
@ -8,15 +8,22 @@ using namespace cocos2d;
|
|||
#define PROPERTY_MOUSE_ENABLED "isMouseEnabled"
|
||||
#define PROPERTY_KEYBOARD_ENABLED "isKeyboardEnabled"
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996)
|
||||
#endif
|
||||
|
||||
using namespace cocos2d;
|
||||
|
||||
namespace cocosbuilder {
|
||||
|
||||
|
||||
void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
|
||||
if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
|
||||
// FIXME: ((Layer *)pNode)->setTouchEnabled(pCheck);
|
||||
((Layer *)pNode)->setTouchEnabled(pCheck);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
|
||||
// FIXME: ((Layer *)pNode)->setAccelerometerEnabled(pCheck);
|
||||
((Layer *)pNode)->setAccelerometerEnabled(pCheck);
|
||||
} else if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
|
||||
// TODO XXX
|
||||
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);
|
||||
|
@ -30,3 +37,9 @@ void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char
|
|||
}
|
||||
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
#pragma warning (pop)
|
||||
#endif
|
|
@ -39,6 +39,10 @@ enum FrameType
|
|||
kKeyframeMax
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionFrame:public cocos2d::Object
|
||||
{
|
||||
|
||||
|
@ -125,6 +129,10 @@ protected:
|
|||
float _fTime;
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionMoveFrame:public ActionFrame
|
||||
{
|
||||
public:
|
||||
|
@ -165,6 +173,10 @@ protected:
|
|||
cocos2d::Point _position;
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionScaleFrame:public ActionFrame
|
||||
{
|
||||
public:
|
||||
|
@ -219,7 +231,10 @@ protected:
|
|||
float _scaleX;
|
||||
float _scaleY;
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionRotationFrame:public ActionFrame
|
||||
{
|
||||
public:
|
||||
|
@ -259,7 +274,10 @@ public:
|
|||
protected:
|
||||
float _rotation;
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionFadeFrame:public ActionFrame
|
||||
{
|
||||
public:
|
||||
|
@ -299,7 +317,10 @@ public:
|
|||
protected:
|
||||
float _opacity;
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionTintFrame:public ActionFrame
|
||||
{
|
||||
|
||||
|
|
|
@ -53,6 +53,10 @@ enum FrameEasingType
|
|||
kframeEasingBackInOut,
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionFrameEasing:public cocos2d::Object
|
||||
{
|
||||
protected:
|
||||
|
|
|
@ -37,21 +37,28 @@ public:
|
|||
|
||||
/**
|
||||
* Default constructor
|
||||
* @js ctor
|
||||
*/
|
||||
ActionManagerEx();
|
||||
|
||||
/**
|
||||
* Default destructor
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual ~ActionManagerEx();
|
||||
|
||||
/**
|
||||
* Gets the static instance of ActionManager.
|
||||
* @js getInstance
|
||||
* @lua getInstance
|
||||
*/
|
||||
static ActionManagerEx* shareManager();
|
||||
|
||||
/**
|
||||
* Purges ActionManager point.
|
||||
* @js purge
|
||||
* @lua destroyActionManager
|
||||
*/
|
||||
static void purgeActionManager();
|
||||
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
|
||||
namespace cocostudio {
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionNode:public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -193,7 +193,7 @@ void ActionObject::simulationActionUpdate(float dt)
|
|||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,10 @@
|
|||
|
||||
namespace cocostudio {
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ActionObject:public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -89,6 +89,9 @@ public:
|
|||
static Armature *create(const char *name, Bone *parentBone);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Armature();
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -159,8 +162,15 @@ public:
|
|||
virtual void draw() override;
|
||||
|
||||
virtual const cocos2d::AffineTransform& getNodeToParentTransform() const override;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
inline void setBlendFunc(const cocos2d::BlendFunc &blendFunc) override { _blendFunc = blendFunc; }
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
inline const cocos2d::BlendFunc &getBlendFunc(void) const override{ return _blendFunc; }
|
||||
|
||||
|
||||
|
@ -199,13 +209,31 @@ public:
|
|||
|
||||
#if ENABLE_PHYSICS_BOX2D_DETECT
|
||||
virtual b2Fixture *getShapeList();
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void setBody(b2Body *body);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual b2Body *getBody() const;
|
||||
#elif ENABLE_PHYSICS_CHIPMUNK_DETECT
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual cpShape *getShapeList();
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void setBody(cpBody *body);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual cpBody *getBody() const;
|
||||
#endif
|
||||
|
||||
|
@ -213,10 +241,15 @@ protected:
|
|||
|
||||
/*
|
||||
* Used to create Bone internal
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
Bone *createBone(const char *boneName );
|
||||
|
||||
//! Update blend function
|
||||
/**! Update blend function
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void updateBlendType(BlendType blendType);
|
||||
|
||||
protected:
|
||||
|
|
|
@ -236,16 +236,22 @@ protected:
|
|||
|
||||
/**
|
||||
* Update(float dt) will call this handler, you can handle your logic here
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void updateHandler();
|
||||
|
||||
/**
|
||||
* Update current key frame, and process auto stop, pause
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void updateFrameData(float currentPercent);
|
||||
|
||||
/**
|
||||
* Emit a frame event
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
void frameEvent(Bone *bone, const char *frameEventName, int originFrameIndex, int currentFrameIndex);
|
||||
|
||||
|
|
|
@ -38,14 +38,27 @@ public:
|
|||
* @js ctor
|
||||
*/
|
||||
BatchNode();
|
||||
/**
|
||||
* @ js NA
|
||||
* @ lua NA
|
||||
*/
|
||||
~BatchNode();
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
virtual bool init() override;
|
||||
virtual void addChild(cocos2d::Node *pChild) override;
|
||||
virtual void addChild(cocos2d::Node *pChild, int zOrder) override;
|
||||
virtual void addChild(cocos2d::Node *pChild, int zOrder, int tag) override;
|
||||
virtual void removeChild(cocos2d::Node* child, bool cleanup) override;
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void visit() override;
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
void draw() override;
|
||||
|
||||
virtual cocos2d::TextureAtlas *getTexureAtlasWithTexture(cocos2d::Texture2D *texture) const;
|
||||
|
|
|
@ -53,6 +53,9 @@ public:
|
|||
static Bone *create(const char *name);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
Bone();
|
||||
/**
|
||||
* @js NA
|
||||
|
@ -173,12 +176,15 @@ public:
|
|||
virtual Armature *getChildArmature() const;
|
||||
|
||||
virtual DisplayManager *getDisplayManager() const { return _displayManager; }
|
||||
|
||||
/**
|
||||
* @lua NA
|
||||
*/
|
||||
virtual void setIgnoreMovementBoneData(bool ignore) { _ignoreMovementBoneData = ignore; }
|
||||
virtual bool isIgnoreMovementBoneData() const { return _ignoreMovementBoneData; }
|
||||
|
||||
/*
|
||||
* This function is deprecated, please use isIgnoreMovementBoneData()
|
||||
* @lua NA
|
||||
*/
|
||||
CC_DEPRECATED_ATTRIBUTE virtual bool getIgnoreMovementBoneData() const { return isIgnoreMovementBoneData(); }
|
||||
|
||||
|
|
|
@ -46,7 +46,10 @@ namespace cocostudio {
|
|||
|
||||
class Bone;
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ColliderFilter
|
||||
{
|
||||
public:
|
||||
|
@ -124,6 +127,8 @@ private:
|
|||
|
||||
/*
|
||||
* @brief ContourSprite used to draw the contour of the display
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ColliderDetector : public cocos2d::Object
|
||||
{
|
||||
|
|
|
@ -57,7 +57,9 @@ public:
|
|||
float getFloat(const char *key) const;
|
||||
bool getBool(const char *key) const;
|
||||
const char* getCString(const char *key) const;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
*/
|
||||
JsonDictionary* getDict() const;
|
||||
|
||||
private:
|
||||
|
|
|
@ -33,6 +33,9 @@ namespace cocostudio {
|
|||
class ComController : public cocos2d::Component, public InputDelegate
|
||||
{
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ComController(void);
|
||||
|
||||
public:
|
||||
|
|
|
@ -32,6 +32,9 @@ namespace cocostudio {
|
|||
class ComRender : public cocos2d::Component
|
||||
{
|
||||
protected:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
ComRender(void);
|
||||
ComRender(cocos2d::Node *node, const char *comName);
|
||||
/**
|
||||
|
|
|
@ -43,7 +43,10 @@ namespace tinyxml2
|
|||
|
||||
namespace cocostudio {
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class DataReaderHelper : cocos2d::Object
|
||||
{
|
||||
protected:
|
||||
|
|
|
@ -58,8 +58,10 @@ public: \
|
|||
namespace cocostudio {
|
||||
|
||||
/**
|
||||
* The base node include a lot of attributes.
|
||||
*/
|
||||
* The base node include a lot of attributes.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class BaseData : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
@ -125,7 +127,10 @@ enum DisplayType
|
|||
|
||||
CS_DISPLAY_MAX
|
||||
};
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class DisplayData : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
@ -147,7 +152,10 @@ public:
|
|||
};
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class SpriteDisplayData : public DisplayData
|
||||
{
|
||||
public:
|
||||
|
@ -179,7 +187,10 @@ public:
|
|||
BaseData skinData;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ArmatureDisplayData : public DisplayData
|
||||
{
|
||||
public:
|
||||
|
@ -209,7 +220,10 @@ public:
|
|||
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ParticleDisplayData : public DisplayData
|
||||
{
|
||||
public:
|
||||
|
@ -238,6 +252,8 @@ public:
|
|||
* BoneData used to init a Bone.
|
||||
* BoneData keeps a DisplayData list, a Bone can have many display to change.
|
||||
* The display information saved in the DisplayData
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class BoneData : public BaseData
|
||||
{
|
||||
|
@ -270,6 +286,8 @@ public:
|
|||
* ArmatureData saved the Armature name and Bonedata needed for the CCBones in this Armature
|
||||
* When we create a Armature, we need to get each Bone's BoneData as it's init information.
|
||||
* So we can get a BoneData from the Dictionary saved in the ArmatureData.
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ArmatureData : public cocos2d::Object
|
||||
{
|
||||
|
@ -313,7 +331,10 @@ enum BlendType
|
|||
BLEND_ERASE
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class FrameData : public BaseData
|
||||
{
|
||||
public:
|
||||
|
@ -353,7 +374,10 @@ public:
|
|||
std::string strSoundEffect;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class MovementBoneData : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
@ -382,7 +406,10 @@ public:
|
|||
cocos2d::Array frameList;
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class MovementData : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
|
@ -442,6 +469,8 @@ public:
|
|||
* AnimationData include all movement infomation for the Armature
|
||||
* The struct is AnimationData -> MovementData -> MovementBoneData -> FrameData
|
||||
* -> MovementFrameData
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class AnimationData : public cocos2d::Object
|
||||
{
|
||||
|
@ -482,6 +511,8 @@ struct ContourVertex2 : public cocos2d::Object
|
|||
|
||||
/*
|
||||
* ContourData include a contour vertex information
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class ContourData : public cocos2d::Object
|
||||
{
|
||||
|
@ -509,6 +540,8 @@ public:
|
|||
|
||||
/*
|
||||
* TextureData include a texture's information
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class TextureData : public cocos2d::Object
|
||||
{
|
||||
|
|
|
@ -35,20 +35,16 @@ THE SOFTWARE.
|
|||
#endif
|
||||
|
||||
namespace cocostudio {
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class DecorativeDisplay: public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
static DecorativeDisplay *create();
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DecorativeDisplay(void);
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~DecorativeDisplay(void);
|
||||
|
||||
virtual bool init();
|
||||
|
|
|
@ -34,7 +34,10 @@ class Skin;
|
|||
class Bone;
|
||||
class DecorativeDisplay;
|
||||
class DisplayData;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class DisplayFactory
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -33,21 +33,17 @@ namespace cocostudio {
|
|||
|
||||
class Bone;
|
||||
|
||||
//! DisplayManager manages Bone's display
|
||||
/**! DisplayManager manages Bone's display
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
class DisplayManager : public cocos2d::Object
|
||||
{
|
||||
public:
|
||||
static DisplayManager *create(Bone *bone);
|
||||
|
||||
public:
|
||||
/**
|
||||
* @js ctor
|
||||
*/
|
||||
DisplayManager();
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
*/
|
||||
~DisplayManager();
|
||||
|
||||
bool init(Bone *bone);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue