mirror of https://github.com/axmolengine/axmol.git
Migrate more macors
This commit is contained in:
parent
ac1872494c
commit
c16a33e347
|
@ -16,7 +16,7 @@
|
||||||
|
|
||||||
- **Outdated/Abandom/Cocos2d-x**:
|
- **Outdated/Abandom/Cocos2d-x**:
|
||||||
- class PhysicsSprite: Be only part of the axis for backwards compatibility with Cocos2d-x.
|
- class PhysicsSprite: Be only part of the axis for backwards compatibility with Cocos2d-x.
|
||||||
Use CC_ENABLE_BOX2D_INTEGRATION 1 (using Box2D) or CC_ENABLE_CHIPMUNK_INTEGRATION 1 (using Chipmunk2D)
|
Use AX_ENABLE_BOX2D_INTEGRATION 1 (using Box2D) or AX_ENABLE_CHIPMUNK_INTEGRATION 1 (using Chipmunk2D)
|
||||||
|
|
||||||
## Chipmunk2D-/Box2D - Testbeds:
|
## Chipmunk2D-/Box2D - Testbeds:
|
||||||
The goals where:
|
The goals where:
|
||||||
|
|
|
@ -474,13 +474,13 @@ function(cocos_use_pkg target pkg)
|
||||||
# message(STATUS "${target} add dll: ${_dlls}")
|
# message(STATUS "${target} add dll: ${_dlls}")
|
||||||
get_property(pre_dlls
|
get_property(pre_dlls
|
||||||
TARGET ${target}
|
TARGET ${target}
|
||||||
PROPERTY CC_DEPEND_DLLS)
|
PROPERTY AX_DEPEND_DLLS)
|
||||||
if(pre_dlls)
|
if(pre_dlls)
|
||||||
set(_dlls ${pre_dlls} ${_dlls})
|
set(_dlls ${pre_dlls} ${_dlls})
|
||||||
endif()
|
endif()
|
||||||
set_property(TARGET ${target}
|
set_property(TARGET ${target}
|
||||||
PROPERTY
|
PROPERTY
|
||||||
CC_DEPEND_DLLS ${_dlls}
|
AX_DEPEND_DLLS ${_dlls}
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
|
@ -55,7 +55,7 @@ message(STATUS "CMAKE_GENERATOR: ${CMAKE_GENERATOR}")
|
||||||
|
|
||||||
# custom target property for lua/js link
|
# custom target property for lua/js link
|
||||||
define_property(TARGET
|
define_property(TARGET
|
||||||
PROPERTY CC_LUA_DEPEND
|
PROPERTY AX_LUA_DEPEND
|
||||||
BRIEF_DOCS "axis lua depend libs"
|
BRIEF_DOCS "axis lua depend libs"
|
||||||
FULL_DOCS "use to save depend libs of axis lua project"
|
FULL_DOCS "use to save depend libs of axis lua project"
|
||||||
)
|
)
|
||||||
|
@ -151,7 +151,7 @@ function(use_axis_compile_define target)
|
||||||
PRIVATE _USEGUIDLL # ui
|
PRIVATE _USEGUIDLL # ui
|
||||||
)
|
)
|
||||||
else()
|
else()
|
||||||
target_compile_definitions(${target} PUBLIC CC_STATIC)
|
target_compile_definitions(${target} PUBLIC AX_STATIC)
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endfunction()
|
endfunction()
|
||||||
|
|
|
@ -17,7 +17,7 @@ message(STATUS "AX_ENABLE_MSEDGE_WEBVIEW2=${AX_ENABLE_MSEDGE_WEBVIEW2}")
|
||||||
function(axis_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR)
|
function(axis_link_cxx_prebuilt APP_NAME AX_ROOT_DIR AX_PREBUILT_DIR)
|
||||||
if (NOT AX_USE_SHARED_PREBUILT)
|
if (NOT AX_USE_SHARED_PREBUILT)
|
||||||
target_compile_definitions(${APP_NAME}
|
target_compile_definitions(${APP_NAME}
|
||||||
PRIVATE CC_STATIC=1
|
PRIVATE AX_STATIC=1
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ Action::Action() : _originalTarget(nullptr), _target(nullptr), _tag(Action::INVA
|
||||||
|
|
||||||
Action::~Action()
|
Action::~Action()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
|
AXLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string Action::description() const
|
std::string Action::description() const
|
||||||
|
@ -66,12 +66,12 @@ bool Action::isDone() const
|
||||||
|
|
||||||
void Action::step(float /*dt*/)
|
void Action::step(float /*dt*/)
|
||||||
{
|
{
|
||||||
CCLOG("[Action step]. override me");
|
AXLOG("[Action step]. override me");
|
||||||
}
|
}
|
||||||
|
|
||||||
void Action::update(float /*time*/)
|
void Action::update(float /*time*/)
|
||||||
{
|
{
|
||||||
CCLOG("[Action update]. override me");
|
AXLOG("[Action update]. override me");
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -81,7 +81,7 @@ Speed::Speed() : _speed(0.0), _innerAction(nullptr) {}
|
||||||
|
|
||||||
Speed::~Speed()
|
Speed::~Speed()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Speed* Speed::create(ActionInterval* action, float speed)
|
Speed* Speed::create(ActionInterval* action, float speed)
|
||||||
|
@ -92,13 +92,13 @@ Speed* Speed::create(ActionInterval* action, float speed)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Speed::initWithAction(ActionInterval* action, float speed)
|
bool Speed::initWithAction(ActionInterval* action, float speed)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action must not be NULL");
|
AXASSERT(action != nullptr, "action must not be NULL");
|
||||||
if (action == nullptr)
|
if (action == nullptr)
|
||||||
{
|
{
|
||||||
log("Speed::initWithAction error: action is nullptr!");
|
log("Speed::initWithAction error: action is nullptr!");
|
||||||
|
@ -161,9 +161,9 @@ void Speed::setInnerAction(ActionInterval* action)
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
CC_SAFE_RETAIN(_innerAction);
|
AX_SAFE_RETAIN(_innerAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ void Speed::setInnerAction(ActionInterval* action)
|
||||||
//
|
//
|
||||||
Follow::~Follow()
|
Follow::~Follow()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_followedNode);
|
AX_SAFE_RELEASE(_followedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Follow* Follow::create(Node* followedNode, const Rect& rect /* = Rect::ZERO*/)
|
Follow* Follow::create(Node* followedNode, const Rect& rect /* = Rect::ZERO*/)
|
||||||
|
@ -209,7 +209,7 @@ Follow* Follow::reverse() const
|
||||||
|
|
||||||
bool Follow::initWithTargetAndOffset(Node* followedNode, float xOffset, float yOffset, const Rect& rect)
|
bool Follow::initWithTargetAndOffset(Node* followedNode, float xOffset, float yOffset, const Rect& rect)
|
||||||
{
|
{
|
||||||
CCASSERT(followedNode != nullptr, "FollowedNode can't be NULL");
|
AXASSERT(followedNode != nullptr, "FollowedNode can't be NULL");
|
||||||
if (followedNode == nullptr)
|
if (followedNode == nullptr)
|
||||||
{
|
{
|
||||||
log("Follow::initWithTarget error: followedNode is nullptr!");
|
log("Follow::initWithTarget error: followedNode is nullptr!");
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum
|
||||||
/**
|
/**
|
||||||
* @brief Base class for Action objects.
|
* @brief Base class for Action objects.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Action : public Ref, public Clonable
|
class AX_DLL Action : public Ref, public Clonable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Default tag used for all the actions. */
|
/** Default tag used for all the actions. */
|
||||||
|
@ -67,7 +67,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual Action* clone() const
|
virtual Action* clone() const
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual Action* reverse() const
|
virtual Action* reverse() const
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ protected:
|
||||||
unsigned int _flags;
|
unsigned int _flags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Action);
|
AX_DISALLOW_COPY_AND_ASSIGN(Action);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class FiniteTimeAction
|
/** @class FiniteTimeAction
|
||||||
|
@ -191,7 +191,7 @@ private:
|
||||||
* - An action with a duration of 35.5 seconds.
|
* - An action with a duration of 35.5 seconds.
|
||||||
* Infinite time actions are valid.
|
* Infinite time actions are valid.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FiniteTimeAction : public Action
|
class AX_DLL FiniteTimeAction : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Get duration in seconds of the action.
|
/** Get duration in seconds of the action.
|
||||||
|
@ -210,12 +210,12 @@ public:
|
||||||
//
|
//
|
||||||
virtual FiniteTimeAction* reverse() const override
|
virtual FiniteTimeAction* reverse() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
virtual FiniteTimeAction* clone() const override
|
virtual FiniteTimeAction* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ protected:
|
||||||
float _duration;
|
float _duration;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
AX_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
class ActionInterval;
|
class ActionInterval;
|
||||||
|
@ -239,7 +239,7 @@ class RepeatForever;
|
||||||
* Useful to simulate 'slow motion' or 'fast forward' effect.
|
* Useful to simulate 'slow motion' or 'fast forward' effect.
|
||||||
* @warning This action can't be Sequenceable because it is not an IntervalAction.
|
* @warning This action can't be Sequenceable because it is not an IntervalAction.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Speed : public Action
|
class AX_DLL Speed : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action and set the speed.
|
/** Create the action and set the speed.
|
||||||
|
@ -297,7 +297,7 @@ protected:
|
||||||
ActionInterval* _innerAction;
|
ActionInterval* _innerAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Speed);
|
AX_DISALLOW_COPY_AND_ASSIGN(Speed);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Follow
|
/** @class Follow
|
||||||
|
@ -309,7 +309,7 @@ private:
|
||||||
* Instead of using Camera as a "follower", use this action instead.
|
* Instead of using Camera as a "follower", use this action instead.
|
||||||
* @since v0.99.2
|
* @since v0.99.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL Follow : public Action
|
class AX_DLL Follow : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +439,7 @@ protected:
|
||||||
Rect _worldRect;
|
Rect _worldRect;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Follow);
|
AX_DISALLOW_COPY_AND_ASSIGN(Follow);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -180,8 +180,8 @@ bool OrbitCamera::initWithDuration(float t,
|
||||||
_angleX = angleX;
|
_angleX = angleX;
|
||||||
_deltaAngleX = deltaAngleX;
|
_deltaAngleX = deltaAngleX;
|
||||||
|
|
||||||
_radDeltaZ = (float)CC_DEGREES_TO_RADIANS(deltaAngleZ);
|
_radDeltaZ = (float)AX_DEGREES_TO_RADIANS(deltaAngleZ);
|
||||||
_radDeltaX = (float)CC_DEGREES_TO_RADIANS(deltaAngleX);
|
_radDeltaX = (float)AX_DEGREES_TO_RADIANS(deltaAngleX);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
@ -196,12 +196,12 @@ void OrbitCamera::startWithTarget(Node* target)
|
||||||
if (std::isnan(_radius))
|
if (std::isnan(_radius))
|
||||||
_radius = r;
|
_radius = r;
|
||||||
if (std::isnan(_angleZ))
|
if (std::isnan(_angleZ))
|
||||||
_angleZ = (float)CC_RADIANS_TO_DEGREES(zenith);
|
_angleZ = (float)AX_RADIANS_TO_DEGREES(zenith);
|
||||||
if (std::isnan(_angleX))
|
if (std::isnan(_angleX))
|
||||||
_angleX = (float)CC_RADIANS_TO_DEGREES(azimuth);
|
_angleX = (float)AX_RADIANS_TO_DEGREES(azimuth);
|
||||||
|
|
||||||
_radZ = (float)CC_DEGREES_TO_RADIANS(_angleZ);
|
_radZ = (float)AX_DEGREES_TO_RADIANS(_angleZ);
|
||||||
_radX = (float)CC_DEGREES_TO_RADIANS(_angleX);
|
_radX = (float)AX_DEGREES_TO_RADIANS(_angleX);
|
||||||
}
|
}
|
||||||
|
|
||||||
void OrbitCamera::update(float dt)
|
void OrbitCamera::update(float dt)
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Camera;
|
||||||
*@brief Base class for Camera actions.
|
*@brief Base class for Camera actions.
|
||||||
*@ingroup Actions
|
*@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionCamera : public ActionInterval
|
class AX_DLL ActionCamera : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -117,7 +117,7 @@ protected:
|
||||||
* Orbits the camera around the center of the screen using spherical coordinates.
|
* Orbits the camera around the center of the screen using spherical coordinates.
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL OrbitCamera : public ActionCamera
|
class AX_DLL OrbitCamera : public ActionCamera
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX.
|
/** Creates a OrbitCamera action with radius, delta-radius, z, deltaZ, x, deltaX.
|
||||||
|
|
|
@ -79,7 +79,7 @@ PointArray* PointArray::clone() const
|
||||||
|
|
||||||
PointArray::~PointArray()
|
PointArray::~PointArray()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing PointArray: %p", this);
|
AXLOGINFO("deallocing PointArray: %p", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
PointArray::PointArray() {}
|
PointArray::PointArray() {}
|
||||||
|
@ -197,7 +197,7 @@ CardinalSplineTo* CardinalSplineTo::create(float duration, PointArray* points, f
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -205,7 +205,7 @@ CardinalSplineTo* CardinalSplineTo::create(float duration, PointArray* points, f
|
||||||
|
|
||||||
bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, float tension)
|
bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, float tension)
|
||||||
{
|
{
|
||||||
CCASSERT(points->count() > 0, "Invalid configuration. It must at least have one control point");
|
AXASSERT(points->count() > 0, "Invalid configuration. It must at least have one control point");
|
||||||
|
|
||||||
if (ActionInterval::initWithDuration(duration))
|
if (ActionInterval::initWithDuration(duration))
|
||||||
{
|
{
|
||||||
|
@ -220,7 +220,7 @@ bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, floa
|
||||||
|
|
||||||
CardinalSplineTo::~CardinalSplineTo()
|
CardinalSplineTo::~CardinalSplineTo()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_points);
|
AX_SAFE_RELEASE_NULL(_points);
|
||||||
}
|
}
|
||||||
|
|
||||||
CardinalSplineTo::CardinalSplineTo() : _points(nullptr), _deltaT(0.f), _tension(0.f) {}
|
CardinalSplineTo::CardinalSplineTo() : _points(nullptr), _deltaT(0.f), _tension(0.f) {}
|
||||||
|
@ -275,7 +275,7 @@ void CardinalSplineTo::update(float time)
|
||||||
|
|
||||||
Vec2 newPos = ccCardinalSplineAt(pp0, pp1, pp2, pp3, _tension, lt);
|
Vec2 newPos = ccCardinalSplineAt(pp0, pp1, pp2, pp3, _tension, lt);
|
||||||
|
|
||||||
#if CC_ENABLE_STACKABLE_ACTIONS
|
#if AX_ENABLE_STACKABLE_ACTIONS
|
||||||
// Support for stacked actions
|
// Support for stacked actions
|
||||||
Node* node = _target;
|
Node* node = _target;
|
||||||
Vec2 diff = node->getPosition() - _previousPosition;
|
Vec2 diff = node->getPosition() - _previousPosition;
|
||||||
|
@ -314,7 +314,7 @@ CardinalSplineBy* CardinalSplineBy::create(float duration, PointArray* points, f
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -398,7 +398,7 @@ CatmullRomTo* CatmullRomTo::create(float dt, PointArray* points)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -441,7 +441,7 @@ CatmullRomBy* CatmullRomBy::create(float dt, PointArray* points)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Node;
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL PointArray : public Ref, public Clonable
|
class AX_DLL PointArray : public Ref, public Clonable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates and initializes a Points array with capacity.
|
/** Creates and initializes a Points array with capacity.
|
||||||
|
@ -163,7 +163,7 @@ private:
|
||||||
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
|
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL CardinalSplineTo : public ActionInterval
|
class AX_DLL CardinalSplineTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an action with a Cardinal Spline array of points and tension.
|
/** Creates an action with a Cardinal Spline array of points and tension.
|
||||||
|
@ -212,8 +212,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void setPoints(PointArray* points)
|
void setPoints(PointArray* points)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(points);
|
AX_SAFE_RETAIN(points);
|
||||||
CC_SAFE_RELEASE(_points);
|
AX_SAFE_RELEASE(_points);
|
||||||
_points = points;
|
_points = points;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ protected:
|
||||||
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
|
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Cardinal_spline
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL CardinalSplineBy : public CardinalSplineTo
|
class AX_DLL CardinalSplineBy : public CardinalSplineTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an action with a Cardinal Spline array of points and tension.
|
/** Creates an action with a Cardinal Spline array of points and tension.
|
||||||
|
@ -274,7 +274,7 @@ protected:
|
||||||
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
|
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL CatmullRomTo : public CardinalSplineTo
|
class AX_DLL CatmullRomTo : public CardinalSplineTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an action with a Cardinal Spline array of points and tension.
|
/** Creates an action with a Cardinal Spline array of points and tension.
|
||||||
|
@ -307,7 +307,7 @@ public:
|
||||||
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
|
* http://en.wikipedia.org/wiki/Cubic_Hermite_spline#Catmull.E2.80.93Rom_spline
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL CatmullRomBy : public CardinalSplineBy
|
class AX_DLL CatmullRomBy : public CardinalSplineBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an action with a Cardinal Spline array of points and tension.
|
/** Creates an action with a Cardinal Spline array of points and tension.
|
||||||
|
@ -334,7 +334,7 @@ public:
|
||||||
};
|
};
|
||||||
|
|
||||||
/** Returns the Cardinal Spline position for a given set of control points, tension and time */
|
/** Returns the Cardinal Spline position for a given set of control points, tension and time */
|
||||||
extern CC_DLL Vec2
|
extern AX_DLL Vec2
|
||||||
ccCardinalSplineAt(const Vec2& p0, const Vec2& p1, const Vec2& p2, const Vec2& p3, float tension, float t);
|
ccCardinalSplineAt(const Vec2& p0, const Vec2& p1, const Vec2& p2, const Vec2& p3, float tension, float t);
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -47,7 +47,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
bool ActionEase::initWithAction(ActionInterval* action)
|
bool ActionEase::initWithAction(ActionInterval* action)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action couldn't be nullptr!");
|
AXASSERT(action != nullptr, "action couldn't be nullptr!");
|
||||||
if (action == nullptr)
|
if (action == nullptr)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -66,7 +66,7 @@ bool ActionEase::initWithAction(ActionInterval* action)
|
||||||
|
|
||||||
ActionEase::~ActionEase()
|
ActionEase::~ActionEase()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_inner);
|
AX_SAFE_RELEASE(_inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionEase::startWithTarget(Node* target)
|
void ActionEase::startWithTarget(Node* target)
|
||||||
|
@ -106,7 +106,7 @@ ActionInterval* ActionEase::getInnerAction()
|
||||||
|
|
||||||
EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
|
EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action cannot be nullptr!");
|
AXASSERT(action != nullptr, "action cannot be nullptr!");
|
||||||
|
|
||||||
EaseRateAction* easeRateAction = new EaseRateAction();
|
EaseRateAction* easeRateAction = new EaseRateAction();
|
||||||
if (easeRateAction->initWithAction(action, rate))
|
if (easeRateAction->initWithAction(action, rate))
|
||||||
|
@ -115,7 +115,7 @@ EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
|
||||||
return easeRateAction;
|
return easeRateAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(easeRateAction);
|
AX_SAFE_DELETE(easeRateAction);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ bool EaseRateAction::initWithAction(ActionInterval* action, float rate)
|
||||||
if (ease->initWithAction(action)) \
|
if (ease->initWithAction(action)) \
|
||||||
ease->autorelease(); \
|
ease->autorelease(); \
|
||||||
else \
|
else \
|
||||||
CC_SAFE_DELETE(ease); \
|
AX_SAFE_DELETE(ease); \
|
||||||
return ease; \
|
return ease; \
|
||||||
} \
|
} \
|
||||||
CLASSNAME* CLASSNAME::clone() const \
|
CLASSNAME* CLASSNAME::clone() const \
|
||||||
|
@ -192,7 +192,7 @@ EASE_TEMPLATE_IMPL(EaseCubicActionInOut, tweenfunc::cubicEaseInOut, EaseCubicAct
|
||||||
if (ease->initWithAction(action, rate)) \
|
if (ease->initWithAction(action, rate)) \
|
||||||
ease->autorelease(); \
|
ease->autorelease(); \
|
||||||
else \
|
else \
|
||||||
CC_SAFE_DELETE(ease); \
|
AX_SAFE_DELETE(ease); \
|
||||||
return ease; \
|
return ease; \
|
||||||
} \
|
} \
|
||||||
CLASSNAME* CLASSNAME::clone() const \
|
CLASSNAME* CLASSNAME::clone() const \
|
||||||
|
@ -235,7 +235,7 @@ bool EaseElastic::initWithAction(ActionInterval* action, float period /* = 0.3f*
|
||||||
if (ease->initWithAction(action, period)) \
|
if (ease->initWithAction(action, period)) \
|
||||||
ease->autorelease(); \
|
ease->autorelease(); \
|
||||||
else \
|
else \
|
||||||
CC_SAFE_DELETE(ease); \
|
AX_SAFE_DELETE(ease); \
|
||||||
return ease; \
|
return ease; \
|
||||||
} \
|
} \
|
||||||
CLASSNAME* CLASSNAME::clone() const \
|
CLASSNAME* CLASSNAME::clone() const \
|
||||||
|
|
|
@ -45,7 +45,7 @@ NS_AX_BEGIN
|
||||||
The ease action will change the timeline of the inner action.
|
The ease action will change the timeline of the inner action.
|
||||||
@ingroup Actions
|
@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionEase : public ActionInterval
|
class AX_DLL ActionEase : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +75,7 @@ protected:
|
||||||
ActionInterval* _inner;
|
ActionInterval* _inner;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
AX_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -84,7 +84,7 @@ private:
|
||||||
@details Ease the inner action with specified rate.
|
@details Ease the inner action with specified rate.
|
||||||
@ingroup Actions
|
@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL EaseRateAction : public ActionEase
|
class AX_DLL EaseRateAction : public ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static EaseRateAction* create(ActionInterval* action, float rate);
|
static EaseRateAction* create(ActionInterval* action, float rate);
|
||||||
|
@ -113,7 +113,7 @@ protected:
|
||||||
float _rate;
|
float _rate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
AX_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -121,7 +121,7 @@ private:
|
||||||
// issue #16159 [https://github.com/cocos2d/cocos2d-x/pull/16159] for further info
|
// issue #16159 [https://github.com/cocos2d/cocos2d-x/pull/16159] for further info
|
||||||
//
|
//
|
||||||
#define EASE_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
#define EASE_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
||||||
class CC_DLL CLASSNAME : public ActionEase \
|
class AX_DLL CLASSNAME : public ActionEase \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
virtual ~CLASSNAME() {} \
|
virtual ~CLASSNAME() {} \
|
||||||
|
@ -134,7 +134,7 @@ private:
|
||||||
virtual ActionEase* reverse() const override; \
|
virtual ActionEase* reverse() const override; \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +199,7 @@ EASE_TEMPLATE_DECL_CLASS(EaseSineInOut);
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
@ingroup Actions
|
@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL EaseBounce : public ActionEase
|
class AX_DLL EaseBounce : public ActionEase
|
||||||
{};
|
{};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -373,7 +373,7 @@ EASE_TEMPLATE_DECL_CLASS(EaseCubicActionInOut);
|
||||||
//
|
//
|
||||||
|
|
||||||
#define EASERATE_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
#define EASERATE_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
||||||
class CC_DLL CLASSNAME : public EaseRateAction \
|
class AX_DLL CLASSNAME : public EaseRateAction \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
virtual ~CLASSNAME() {} \
|
virtual ~CLASSNAME() {} \
|
||||||
|
@ -385,7 +385,7 @@ EASE_TEMPLATE_DECL_CLASS(EaseCubicActionInOut);
|
||||||
virtual EaseRateAction* reverse() const override; \
|
virtual EaseRateAction* reverse() const override; \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -423,7 +423,7 @@ EASERATE_TEMPLATE_DECL_CLASS(EaseInOut);
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
@ingroup Actions
|
@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL EaseElastic : public ActionEase
|
class AX_DLL EaseElastic : public ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -451,7 +451,7 @@ protected:
|
||||||
float _period;
|
float _period;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
AX_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
||||||
};
|
};
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -459,7 +459,7 @@ private:
|
||||||
// issue #16159 [https://github.com/cocos2d/cocos2d-x/pull/16159] for further info
|
// issue #16159 [https://github.com/cocos2d/cocos2d-x/pull/16159] for further info
|
||||||
//
|
//
|
||||||
#define EASEELASTIC_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
#define EASEELASTIC_TEMPLATE_DECL_CLASS(CLASSNAME) \
|
||||||
class CC_DLL CLASSNAME : public EaseElastic \
|
class AX_DLL CLASSNAME : public EaseElastic \
|
||||||
{ \
|
{ \
|
||||||
public: \
|
public: \
|
||||||
virtual ~CLASSNAME() {} \
|
virtual ~CLASSNAME() {} \
|
||||||
|
@ -471,7 +471,7 @@ private:
|
||||||
virtual EaseElastic* reverse() const override; \
|
virtual EaseElastic* reverse() const override; \
|
||||||
\
|
\
|
||||||
private: \
|
private: \
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -516,7 +516,7 @@ EASEELASTIC_TEMPLATE_DECL_CLASS(EaseElasticInOut);
|
||||||
@brief Ease Bezier
|
@brief Ease Bezier
|
||||||
@ingroup Actions
|
@ingroup Actions
|
||||||
*/
|
*/
|
||||||
class CC_DLL EaseBezierAction : public axis::ActionEase
|
class AX_DLL EaseBezierAction : public axis::ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -545,7 +545,7 @@ protected:
|
||||||
float _p3;
|
float _p3;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction);
|
AX_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -62,7 +62,7 @@ void GridAction::startWithTarget(Node* target)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCASSERT(0, "Invalid grid parameters!");
|
AXASSERT(0, "Invalid grid parameters!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -81,7 +81,7 @@ void GridAction::startWithTarget(Node* target)
|
||||||
void GridAction::cacheTargetAsGridNode()
|
void GridAction::cacheTargetAsGridNode()
|
||||||
{
|
{
|
||||||
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
||||||
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
||||||
}
|
}
|
||||||
|
|
||||||
GridAction* GridAction::reverse() const
|
GridAction* GridAction::reverse() const
|
||||||
|
@ -93,7 +93,7 @@ GridAction* GridAction::reverse() const
|
||||||
GridBase* GridAction::getGrid()
|
GridBase* GridAction::getGrid()
|
||||||
{
|
{
|
||||||
// Abstract class needs implementation
|
// Abstract class needs implementation
|
||||||
CCASSERT(0, "Subclass should implement this method!");
|
AXASSERT(0, "Subclass should implement this method!");
|
||||||
|
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
@ -206,7 +206,7 @@ AccelDeccelAmplitude* AccelDeccelAmplitude::clone() const
|
||||||
|
|
||||||
AccelDeccelAmplitude::~AccelDeccelAmplitude()
|
AccelDeccelAmplitude::~AccelDeccelAmplitude()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_other);
|
AX_SAFE_RELEASE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccelDeccelAmplitude::startWithTarget(Node* target)
|
void AccelDeccelAmplitude::startWithTarget(Node* target)
|
||||||
|
@ -276,7 +276,7 @@ AccelAmplitude* AccelAmplitude::clone() const
|
||||||
|
|
||||||
AccelAmplitude::~AccelAmplitude()
|
AccelAmplitude::~AccelAmplitude()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(_other);
|
AX_SAFE_DELETE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AccelAmplitude::startWithTarget(Node* target)
|
void AccelAmplitude::startWithTarget(Node* target)
|
||||||
|
@ -330,7 +330,7 @@ bool DeccelAmplitude::initWithAction(Action* action, float duration)
|
||||||
|
|
||||||
DeccelAmplitude::~DeccelAmplitude()
|
DeccelAmplitude::~DeccelAmplitude()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_other);
|
AX_SAFE_RELEASE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeccelAmplitude::startWithTarget(Node* target)
|
void DeccelAmplitude::startWithTarget(Node* target)
|
||||||
|
@ -375,7 +375,7 @@ void StopGrid::startWithTarget(Node* target)
|
||||||
void StopGrid::cacheTargetAsGridNode()
|
void StopGrid::cacheTargetAsGridNode()
|
||||||
{
|
{
|
||||||
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
||||||
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
||||||
}
|
}
|
||||||
|
|
||||||
StopGrid* StopGrid::create()
|
StopGrid* StopGrid::create()
|
||||||
|
@ -432,7 +432,7 @@ void ReuseGrid::startWithTarget(Node* target)
|
||||||
void ReuseGrid::cacheTargetAsGridNode()
|
void ReuseGrid::cacheTargetAsGridNode()
|
||||||
{
|
{
|
||||||
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
|
||||||
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
|
||||||
}
|
}
|
||||||
|
|
||||||
ReuseGrid* ReuseGrid::clone() const
|
ReuseGrid* ReuseGrid::clone() const
|
||||||
|
|
|
@ -45,7 +45,7 @@ class NodeGrid;
|
||||||
@brief Base class for Grid actions.
|
@brief Base class for Grid actions.
|
||||||
@details Grid actions are the actions take effect on GridBase.
|
@details Grid actions are the actions take effect on GridBase.
|
||||||
*/
|
*/
|
||||||
class CC_DLL GridAction : public ActionInterval
|
class AX_DLL GridAction : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
// overrides
|
// overrides
|
||||||
virtual GridAction* clone() const override
|
virtual GridAction* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
virtual GridAction* reverse() const override;
|
virtual GridAction* reverse() const override;
|
||||||
|
@ -81,14 +81,14 @@ protected:
|
||||||
void cacheTargetAsGridNode();
|
void cacheTargetAsGridNode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
AX_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Base class for Grid3D actions.
|
@brief Base class for Grid3D actions.
|
||||||
@details Grid3D actions can modify a non-tiled grid.
|
@details Grid3D actions can modify a non-tiled grid.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Grid3DAction : public GridAction
|
class AX_DLL Grid3DAction : public GridAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual GridBase* getGrid() override;
|
virtual GridBase* getGrid() override;
|
||||||
|
@ -122,7 +122,7 @@ public:
|
||||||
// Overrides
|
// Overrides
|
||||||
virtual Grid3DAction* clone() const override
|
virtual Grid3DAction* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@brief Base class for TiledGrid3D actions.
|
@brief Base class for TiledGrid3D actions.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TiledGrid3DAction : public GridAction
|
class AX_DLL TiledGrid3DAction : public GridAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
// Override
|
// Override
|
||||||
virtual TiledGrid3DAction* clone() const override
|
virtual TiledGrid3DAction* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -189,7 +189,7 @@ public:
|
||||||
@brief AccelDeccelAmplitude action.
|
@brief AccelDeccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
class AX_DLL AccelDeccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -233,14 +233,14 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
AX_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief AccelAmplitude action.
|
@brief AccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL AccelAmplitude : public ActionInterval
|
class AX_DLL AccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -278,14 +278,14 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
AX_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief DeccelAmplitude action.
|
@brief DeccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL DeccelAmplitude : public ActionInterval
|
class AX_DLL DeccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -329,7 +329,7 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
AX_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -340,7 +340,7 @@ private:
|
||||||
Sequence::create(Lens3D::create(...), StopGrid::create(), nullptr);
|
Sequence::create(Lens3D::create(...), StopGrid::create(), nullptr);
|
||||||
@endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
class CC_DLL StopGrid : public ActionInstant
|
class AX_DLL StopGrid : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -363,13 +363,13 @@ protected:
|
||||||
void cacheTargetAsGridNode();
|
void cacheTargetAsGridNode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
AX_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ReuseGrid action.
|
@brief ReuseGrid action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ReuseGrid : public ActionInstant
|
class AX_DLL ReuseGrid : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -402,7 +402,7 @@ protected:
|
||||||
int _times;
|
int _times;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
AX_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -74,7 +74,7 @@ void Waves3D::update(float time)
|
||||||
Vec2 pos((float)i, (float)j);
|
Vec2 pos((float)i, (float)j);
|
||||||
Vec3 v = getOriginalVertex(pos);
|
Vec3 v = getOriginalVertex(pos);
|
||||||
v.z += (sinf((float)M_PI * time * _waves * 2 + (v.y + v.x) * 0.01f) * _amplitude * _amplitudeRate);
|
v.z += (sinf((float)M_PI * time * _waves * 2 + (v.y + v.x) * 0.01f) * _amplitude * _amplitudeRate);
|
||||||
// CCLOG("v.z offset is %f\n", (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * .01f) * _amplitude *
|
// AXLOG("v.z offset is %f\n", (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * .01f) * _amplitude *
|
||||||
// _amplitudeRate));
|
// _amplitudeRate));
|
||||||
setVertex(pos, v);
|
setVertex(pos, v);
|
||||||
}
|
}
|
||||||
|
@ -107,7 +107,7 @@ bool FlipX3D::initWithSize(const Vec2& gridSize, float duration)
|
||||||
if (gridSize.width != 1 || gridSize.height != 1)
|
if (gridSize.width != 1 || gridSize.height != 1)
|
||||||
{
|
{
|
||||||
// Grid size must be (1,1)
|
// Grid size must be (1,1)
|
||||||
CCASSERT(0, "Grid size must be (1,1)");
|
AXASSERT(0, "Grid size must be (1,1)");
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -209,7 +209,7 @@ FlipY3D* FlipY3D::create(float duration)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -291,7 +291,7 @@ Lens3D* Lens3D::create(float duration, const Vec2& gridSize, const Vec2& positio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -392,7 +392,7 @@ Ripple3D* Ripple3D::create(float duration,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -470,7 +470,7 @@ Shaky3D* Shaky3D::create(float duration, const Vec2& gridSize, int range, bool s
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ Liquid* Liquid::create(float duration, const Vec2& gridSize, unsigned int waves,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -594,7 +594,7 @@ Waves* Waves::create(float duration,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -668,7 +668,7 @@ Twirl* Twirl::create(float duration, const Vec2& gridSize, const Vec2& position,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(action);
|
AX_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
|
|
@ -42,7 +42,7 @@ NS_AX_BEGIN
|
||||||
You can control the effect by these parameters:
|
You can control the effect by these parameters:
|
||||||
duration, grid size, waves count, amplitude.
|
duration, grid size, waves count, amplitude.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Waves3D : public Grid3DAction
|
class AX_DLL Waves3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -100,14 +100,14 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FlipX3D action.
|
@brief FlipX3D action.
|
||||||
@details This action is used for flipping the target node on the x axis.
|
@details This action is used for flipping the target node on the x axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FlipX3D : public Grid3DAction
|
class AX_DLL FlipX3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -140,14 +140,14 @@ public:
|
||||||
virtual bool initWithSize(const Vec2& gridSize, float duration);
|
virtual bool initWithSize(const Vec2& gridSize, float duration);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FlipY3D action.
|
@brief FlipY3D action.
|
||||||
@details This action is used for flipping the target node on the y axis.
|
@details This action is used for flipping the target node on the y axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FlipY3D : public FlipX3D
|
class AX_DLL FlipY3D : public FlipX3D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
virtual ~FlipY3D() {}
|
virtual ~FlipY3D() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -175,7 +175,7 @@ private:
|
||||||
duration, grid size, center position of lens, radius of lens.
|
duration, grid size, center position of lens, radius of lens.
|
||||||
Also you can change the lens effect value & whether effect is concave by the setter methods.
|
Also you can change the lens effect value & whether effect is concave by the setter methods.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Lens3D : public Grid3DAction
|
class AX_DLL Lens3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +247,7 @@ protected:
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -257,7 +257,7 @@ private:
|
||||||
duration, grid size, center position of ripple,
|
duration, grid size, center position of ripple,
|
||||||
radius of ripple, waves count, amplitude.
|
radius of ripple, waves count, amplitude.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Ripple3D : public Grid3DAction
|
class AX_DLL Ripple3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -343,7 +343,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -352,7 +352,7 @@ private:
|
||||||
You can create the action by these parameters:
|
You can create the action by these parameters:
|
||||||
duration, grid size, range, whether shake on the z axis.
|
duration, grid size, range, whether shake on the z axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Shaky3D : public Grid3DAction
|
class AX_DLL Shaky3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -387,7 +387,7 @@ protected:
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -396,7 +396,7 @@ private:
|
||||||
You can create the action by these parameters:
|
You can create the action by these parameters:
|
||||||
duration, grid size, waves count, amplitude of the liquid effect.
|
duration, grid size, waves count, amplitude of the liquid effect.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Liquid : public Grid3DAction
|
class AX_DLL Liquid : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -454,7 +454,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
AX_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -464,7 +464,7 @@ private:
|
||||||
duration, grid size, waves count, amplitude,
|
duration, grid size, waves count, amplitude,
|
||||||
whether waves on horizontal and whether waves on vertical.
|
whether waves on horizontal and whether waves on vertical.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Waves : public Grid3DAction
|
class AX_DLL Waves : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -538,7 +538,7 @@ protected:
|
||||||
bool _horizontal;
|
bool _horizontal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Waves);
|
AX_DISALLOW_COPY_AND_ASSIGN(Waves);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -547,7 +547,7 @@ private:
|
||||||
You can control the effect by these parameters:
|
You can control the effect by these parameters:
|
||||||
duration, grid size, center position, twirls count, amplitude.
|
duration, grid size, center position, twirls count, amplitude.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Twirl : public Grid3DAction
|
class AX_DLL Twirl : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -628,7 +628,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
AX_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -150,7 +150,7 @@ RemoveSelf* RemoveSelf::create(bool isNeedCleanUp /*= true*/)
|
||||||
if (ret->init(isNeedCleanUp))
|
if (ret->init(isNeedCleanUp))
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
else
|
else
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ FlipX* FlipX::create(bool x)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ FlipY* FlipY::create(bool y)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ CallFunc* CallFunc::create(const std::function<void()>& func)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ CallFuncN* CallFuncN::create(const std::function<void(Node*)>& func)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ NS_AX_BEGIN
|
||||||
/** @class ActionInstant
|
/** @class ActionInstant
|
||||||
* @brief Instant actions are immediate actions. They don't have a duration like the IntervalAction actions.
|
* @brief Instant actions are immediate actions. They don't have a duration like the IntervalAction actions.
|
||||||
**/
|
**/
|
||||||
class CC_DLL ActionInstant : public FiniteTimeAction
|
class AX_DLL ActionInstant : public FiniteTimeAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
@ -50,13 +50,13 @@ public:
|
||||||
//
|
//
|
||||||
virtual ActionInstant* clone() const override
|
virtual ActionInstant* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ActionInstant* reverse() const override
|
virtual ActionInstant* reverse() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ private:
|
||||||
/** @class Show
|
/** @class Show
|
||||||
* @brief Show the node.
|
* @brief Show the node.
|
||||||
**/
|
**/
|
||||||
class CC_DLL Show : public ActionInstant
|
class AX_DLL Show : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Allocates and initializes the action.
|
/** Allocates and initializes the action.
|
||||||
|
@ -102,13 +102,13 @@ public:
|
||||||
virtual ~Show() {}
|
virtual ~Show() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Show);
|
AX_DISALLOW_COPY_AND_ASSIGN(Show);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Hide
|
/** @class Hide
|
||||||
* @brief Hide the node.
|
* @brief Hide the node.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Hide : public ActionInstant
|
class AX_DLL Hide : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Allocates and initializes the action.
|
/** Allocates and initializes the action.
|
||||||
|
@ -131,13 +131,13 @@ public:
|
||||||
virtual ~Hide() {}
|
virtual ~Hide() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Hide);
|
AX_DISALLOW_COPY_AND_ASSIGN(Hide);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ToggleVisibility
|
/** @class ToggleVisibility
|
||||||
* @brief Toggles the visibility of a node.
|
* @brief Toggles the visibility of a node.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ToggleVisibility : public ActionInstant
|
class AX_DLL ToggleVisibility : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Allocates and initializes the action.
|
/** Allocates and initializes the action.
|
||||||
|
@ -160,13 +160,13 @@ public:
|
||||||
virtual ~ToggleVisibility() {}
|
virtual ~ToggleVisibility() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
AX_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class RemoveSelf
|
/** @class RemoveSelf
|
||||||
* @brief Remove the node.
|
* @brief Remove the node.
|
||||||
*/
|
*/
|
||||||
class CC_DLL RemoveSelf : public ActionInstant
|
class AX_DLL RemoveSelf : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -196,14 +196,14 @@ protected:
|
||||||
bool _isNeedCleanUp;
|
bool _isNeedCleanUp;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
AX_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class FlipX
|
/** @class FlipX
|
||||||
* @brief Flips the sprite horizontally.
|
* @brief Flips the sprite horizontally.
|
||||||
* @since v0.99.0
|
* @since v0.99.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL FlipX : public ActionInstant
|
class AX_DLL FlipX : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -233,14 +233,14 @@ protected:
|
||||||
bool _flipX;
|
bool _flipX;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
AX_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class FlipY
|
/** @class FlipY
|
||||||
* @brief Flips the sprite vertically.
|
* @brief Flips the sprite vertically.
|
||||||
* @since v0.99.0
|
* @since v0.99.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL FlipY : public ActionInstant
|
class AX_DLL FlipY : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -270,13 +270,13 @@ protected:
|
||||||
bool _flipY;
|
bool _flipY;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
AX_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Place
|
/** @class Place
|
||||||
* @brief Places the node in a certain position.
|
* @brief Places the node in a certain position.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Place : public ActionInstant
|
class AX_DLL Place : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a Place action with a position.
|
/** Creates a Place action with a position.
|
||||||
|
@ -306,13 +306,13 @@ protected:
|
||||||
Vec2 _position;
|
Vec2 _position;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Place);
|
AX_DISALLOW_COPY_AND_ASSIGN(Place);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class CallFunc
|
/** @class CallFunc
|
||||||
* @brief Calls a 'callback'.
|
* @brief Calls a 'callback'.
|
||||||
*/
|
*/
|
||||||
class CC_DLL CallFunc : public ActionInstant
|
class AX_DLL CallFunc : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with the callback of type std::function<void()>.
|
/** Creates the action with the callback of type std::function<void()>.
|
||||||
|
@ -354,14 +354,14 @@ protected:
|
||||||
std::function<void()> _function;
|
std::function<void()> _function;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
AX_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class CallFuncN
|
/** @class CallFuncN
|
||||||
* @brief Calls a 'callback' with the node as the first argument. N means Node.
|
* @brief Calls a 'callback' with the node as the first argument. N means Node.
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL CallFuncN : public CallFunc
|
class AX_DLL CallFuncN : public CallFunc
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with the callback of type std::function<void()>.
|
/** Creates the action with the callback of type std::function<void()>.
|
||||||
|
@ -389,7 +389,7 @@ protected:
|
||||||
std::function<void(Node*)> _functionN;
|
std::function<void(Node*)> _functionN;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
AX_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -126,13 +126,13 @@ void ActionInterval::step(float dt)
|
||||||
void ActionInterval::setAmplitudeRate(float /*amp*/)
|
void ActionInterval::setAmplitudeRate(float /*amp*/)
|
||||||
{
|
{
|
||||||
// Abstract class needs implementation
|
// Abstract class needs implementation
|
||||||
CCASSERT(0, "Subclass should implement this method!");
|
AXASSERT(0, "Subclass should implement this method!");
|
||||||
}
|
}
|
||||||
|
|
||||||
float ActionInterval::getAmplitudeRate()
|
float ActionInterval::getAmplitudeRate()
|
||||||
{
|
{
|
||||||
// Abstract class needs implementation
|
// Abstract class needs implementation
|
||||||
CCASSERT(0, "Subclass should implement this method!");
|
AXASSERT(0, "Subclass should implement this method!");
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -237,8 +237,8 @@ bool Sequence::init(const Vector<FiniteTimeAction*>& arrayOfActions)
|
||||||
|
|
||||||
bool Sequence::initWithTwoActions(FiniteTimeAction* actionOne, FiniteTimeAction* actionTwo)
|
bool Sequence::initWithTwoActions(FiniteTimeAction* actionOne, FiniteTimeAction* actionTwo)
|
||||||
{
|
{
|
||||||
CCASSERT(actionOne != nullptr, "actionOne can't be nullptr!");
|
AXASSERT(actionOne != nullptr, "actionOne can't be nullptr!");
|
||||||
CCASSERT(actionTwo != nullptr, "actionTwo can't be nullptr!");
|
AXASSERT(actionTwo != nullptr, "actionTwo can't be nullptr!");
|
||||||
if (actionOne == nullptr || actionTwo == nullptr)
|
if (actionOne == nullptr || actionTwo == nullptr)
|
||||||
{
|
{
|
||||||
log("Sequence::initWithTwoActions error: action is nullptr!!");
|
log("Sequence::initWithTwoActions error: action is nullptr!!");
|
||||||
|
@ -287,8 +287,8 @@ Sequence::Sequence() : _split(0)
|
||||||
|
|
||||||
Sequence::~Sequence()
|
Sequence::~Sequence()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_actions[0]);
|
AX_SAFE_RELEASE(_actions[0]);
|
||||||
CC_SAFE_RELEASE(_actions[1]);
|
AX_SAFE_RELEASE(_actions[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Sequence::startWithTarget(Node* target)
|
void Sequence::startWithTarget(Node* target)
|
||||||
|
@ -448,7 +448,7 @@ Repeat* Repeat::clone() const
|
||||||
|
|
||||||
Repeat::~Repeat()
|
Repeat::~Repeat()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Repeat::startWithTarget(Node* target)
|
void Repeat::startWithTarget(Node* target)
|
||||||
|
@ -531,7 +531,7 @@ Repeat* Repeat::reverse() const
|
||||||
//
|
//
|
||||||
RepeatForever::~RepeatForever()
|
RepeatForever::~RepeatForever()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
RepeatForever* RepeatForever::create(ActionInterval* action)
|
RepeatForever* RepeatForever::create(ActionInterval* action)
|
||||||
|
@ -549,7 +549,7 @@ RepeatForever* RepeatForever::create(ActionInterval* action)
|
||||||
|
|
||||||
bool RepeatForever::initWithAction(ActionInterval* action)
|
bool RepeatForever::initWithAction(ActionInterval* action)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action can't be nullptr!");
|
AXASSERT(action != nullptr, "action can't be nullptr!");
|
||||||
if (action == nullptr)
|
if (action == nullptr)
|
||||||
{
|
{
|
||||||
log("RepeatForever::initWithAction error:action is nullptr!");
|
log("RepeatForever::initWithAction error:action is nullptr!");
|
||||||
|
@ -693,8 +693,8 @@ bool Spawn::init(const Vector<FiniteTimeAction*>& arrayOfActions)
|
||||||
|
|
||||||
bool Spawn::initWithTwoActions(FiniteTimeAction* action1, FiniteTimeAction* action2)
|
bool Spawn::initWithTwoActions(FiniteTimeAction* action1, FiniteTimeAction* action2)
|
||||||
{
|
{
|
||||||
CCASSERT(action1 != nullptr, "action1 can't be nullptr!");
|
AXASSERT(action1 != nullptr, "action1 can't be nullptr!");
|
||||||
CCASSERT(action2 != nullptr, "action2 can't be nullptr!");
|
AXASSERT(action2 != nullptr, "action2 can't be nullptr!");
|
||||||
if (action1 == nullptr || action2 == nullptr)
|
if (action1 == nullptr || action2 == nullptr)
|
||||||
{
|
{
|
||||||
log("Spawn::initWithTwoActions error: action is nullptr!");
|
log("Spawn::initWithTwoActions error: action is nullptr!");
|
||||||
|
@ -742,8 +742,8 @@ Spawn::Spawn() : _one(nullptr), _two(nullptr) {}
|
||||||
|
|
||||||
Spawn::~Spawn()
|
Spawn::~Spawn()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_one);
|
AX_SAFE_RELEASE(_one);
|
||||||
CC_SAFE_RELEASE(_two);
|
AX_SAFE_RELEASE(_two);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Spawn::startWithTarget(Node* target)
|
void Spawn::startWithTarget(Node* target)
|
||||||
|
@ -932,7 +932,7 @@ void RotateTo::update(float time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if CC_USE_PHYSICS
|
#if AX_USE_PHYSICS
|
||||||
if (_startAngle.x == _startAngle.y && _diffAngle.x == _diffAngle.y)
|
if (_startAngle.x == _startAngle.y && _diffAngle.x == _diffAngle.y)
|
||||||
{
|
{
|
||||||
_target->setRotation(_startAngle.x + _diffAngle.x * time);
|
_target->setRotation(_startAngle.x + _diffAngle.x * time);
|
||||||
|
@ -945,14 +945,14 @@ void RotateTo::update(float time)
|
||||||
#else
|
#else
|
||||||
_target->setRotationSkewX(_startAngle.x + _diffAngle.x * time);
|
_target->setRotationSkewX(_startAngle.x + _diffAngle.x * time);
|
||||||
_target->setRotationSkewY(_startAngle.y + _diffAngle.y * time);
|
_target->setRotationSkewY(_startAngle.y + _diffAngle.y * time);
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // AX_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
RotateTo* RotateTo::reverse() const
|
RotateTo* RotateTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "RotateTo doesn't support the 'reverse' method");
|
AXASSERT(false, "RotateTo doesn't support the 'reverse' method");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1077,7 +1077,7 @@ void RotateBy::update(float time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if CC_USE_PHYSICS
|
#if AX_USE_PHYSICS
|
||||||
if (_startAngle.x == _startAngle.y && _deltaAngle.x == _deltaAngle.y)
|
if (_startAngle.x == _startAngle.y && _deltaAngle.x == _deltaAngle.y)
|
||||||
{
|
{
|
||||||
_target->setRotation(_startAngle.x + _deltaAngle.x * time);
|
_target->setRotation(_startAngle.x + _deltaAngle.x * time);
|
||||||
|
@ -1090,7 +1090,7 @@ void RotateBy::update(float time)
|
||||||
#else
|
#else
|
||||||
_target->setRotationSkewX(_startAngle.x + _deltaAngle.x * time);
|
_target->setRotationSkewX(_startAngle.x + _deltaAngle.x * time);
|
||||||
_target->setRotationSkewY(_startAngle.y + _deltaAngle.y * time);
|
_target->setRotationSkewY(_startAngle.y + _deltaAngle.y * time);
|
||||||
#endif // CC_USE_PHYSICS
|
#endif // AX_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1174,7 @@ void MoveBy::update(float t)
|
||||||
{
|
{
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_STACKABLE_ACTIONS
|
#if AX_ENABLE_STACKABLE_ACTIONS
|
||||||
Vec3 currentPos = _target->getPosition3D();
|
Vec3 currentPos = _target->getPosition3D();
|
||||||
Vec3 diff = currentPos - _previousPosition;
|
Vec3 diff = currentPos - _previousPosition;
|
||||||
_startPosition = _startPosition + diff;
|
_startPosition = _startPosition + diff;
|
||||||
|
@ -1183,7 +1183,7 @@ void MoveBy::update(float t)
|
||||||
_previousPosition = newPos;
|
_previousPosition = newPos;
|
||||||
#else
|
#else
|
||||||
_target->setPosition3D(_startPosition + _positionDelta * t);
|
_target->setPosition3D(_startPosition + _positionDelta * t);
|
||||||
#endif // CC_ENABLE_STACKABLE_ACTIONS
|
#endif // AX_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1242,7 +1242,7 @@ void MoveTo::startWithTarget(Node* target)
|
||||||
|
|
||||||
MoveTo* MoveTo::reverse() const
|
MoveTo* MoveTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in MoveTo");
|
AXASSERT(false, "reverse() not supported in MoveTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1285,7 +1285,7 @@ SkewTo* SkewTo::clone() const
|
||||||
|
|
||||||
SkewTo* SkewTo::reverse() const
|
SkewTo* SkewTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in SkewTo");
|
AXASSERT(false, "reverse() not supported in SkewTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1542,7 +1542,7 @@ JumpBy* JumpBy::create(float duration, const Vec2& position, float height, int j
|
||||||
|
|
||||||
bool JumpBy::initWithDuration(float duration, const Vec2& position, float height, int jumps)
|
bool JumpBy::initWithDuration(float duration, const Vec2& position, float height, int jumps)
|
||||||
{
|
{
|
||||||
CCASSERT(jumps >= 0, "Number of jumps must be >= 0");
|
AXASSERT(jumps >= 0, "Number of jumps must be >= 0");
|
||||||
if (jumps < 0)
|
if (jumps < 0)
|
||||||
{
|
{
|
||||||
log("JumpBy::initWithDuration error: Number of jumps must be >= 0");
|
log("JumpBy::initWithDuration error: Number of jumps must be >= 0");
|
||||||
|
@ -1583,7 +1583,7 @@ void JumpBy::update(float t)
|
||||||
y += _delta.y * t;
|
y += _delta.y * t;
|
||||||
|
|
||||||
float x = _delta.x * t;
|
float x = _delta.x * t;
|
||||||
#if CC_ENABLE_STACKABLE_ACTIONS
|
#if AX_ENABLE_STACKABLE_ACTIONS
|
||||||
Vec2 currentPos = _target->getPosition();
|
Vec2 currentPos = _target->getPosition();
|
||||||
|
|
||||||
Vec2 diff = currentPos - _previousPos;
|
Vec2 diff = currentPos - _previousPos;
|
||||||
|
@ -1595,7 +1595,7 @@ void JumpBy::update(float t)
|
||||||
_previousPos = newPos;
|
_previousPos = newPos;
|
||||||
#else
|
#else
|
||||||
_target->setPosition(_startPosition + Vec2(x, y));
|
_target->setPosition(_startPosition + Vec2(x, y));
|
||||||
#endif // !CC_ENABLE_STACKABLE_ACTIONS
|
#endif // !AX_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1623,7 +1623,7 @@ JumpTo* JumpTo::create(float duration, const Vec2& position, float height, int j
|
||||||
|
|
||||||
bool JumpTo::initWithDuration(float duration, const Vec2& position, float height, int jumps)
|
bool JumpTo::initWithDuration(float duration, const Vec2& position, float height, int jumps)
|
||||||
{
|
{
|
||||||
CCASSERT(jumps >= 0, "Number of jumps must be >= 0");
|
AXASSERT(jumps >= 0, "Number of jumps must be >= 0");
|
||||||
if (jumps < 0)
|
if (jumps < 0)
|
||||||
{
|
{
|
||||||
log("JumpTo::initWithDuration error:Number of jumps must be >= 0");
|
log("JumpTo::initWithDuration error:Number of jumps must be >= 0");
|
||||||
|
@ -1650,7 +1650,7 @@ JumpTo* JumpTo::clone() const
|
||||||
|
|
||||||
JumpTo* JumpTo::reverse() const
|
JumpTo* JumpTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in JumpTo");
|
AXASSERT(false, "reverse() not supported in JumpTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1726,7 +1726,7 @@ void BezierBy::update(float time)
|
||||||
float x = bezierat(xa, xb, xc, xd, time);
|
float x = bezierat(xa, xb, xc, xd, time);
|
||||||
float y = bezierat(ya, yb, yc, yd, time);
|
float y = bezierat(ya, yb, yc, yd, time);
|
||||||
|
|
||||||
#if CC_ENABLE_STACKABLE_ACTIONS
|
#if AX_ENABLE_STACKABLE_ACTIONS
|
||||||
Vec2 currentPos = _target->getPosition();
|
Vec2 currentPos = _target->getPosition();
|
||||||
Vec2 diff = currentPos - _previousPosition;
|
Vec2 diff = currentPos - _previousPosition;
|
||||||
_startPosition = _startPosition + diff;
|
_startPosition = _startPosition + diff;
|
||||||
|
@ -1737,7 +1737,7 @@ void BezierBy::update(float time)
|
||||||
_previousPosition = newPos;
|
_previousPosition = newPos;
|
||||||
#else
|
#else
|
||||||
_target->setPosition(_startPosition + Vec2(x, y));
|
_target->setPosition(_startPosition + Vec2(x, y));
|
||||||
#endif // !CC_ENABLE_STACKABLE_ACTIONS
|
#endif // !AX_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1797,7 +1797,7 @@ void BezierTo::startWithTarget(Node* target)
|
||||||
|
|
||||||
BezierTo* BezierTo::reverse() const
|
BezierTo* BezierTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "CCBezierTo doesn't support the 'reverse' method");
|
AXASSERT(false, "CCBezierTo doesn't support the 'reverse' method");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1893,7 +1893,7 @@ ScaleTo* ScaleTo::clone() const
|
||||||
|
|
||||||
ScaleTo* ScaleTo::reverse() const
|
ScaleTo* ScaleTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in ScaleTo");
|
AXASSERT(false, "reverse() not supported in ScaleTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1999,7 +1999,7 @@ Blink* Blink::create(float duration, int blinks)
|
||||||
|
|
||||||
bool Blink::initWithDuration(float duration, int blinks)
|
bool Blink::initWithDuration(float duration, int blinks)
|
||||||
{
|
{
|
||||||
CCASSERT(blinks >= 0, "blinks should be >= 0");
|
AXASSERT(blinks >= 0, "blinks should be >= 0");
|
||||||
if (blinks < 0)
|
if (blinks < 0)
|
||||||
{
|
{
|
||||||
log("Blink::initWithDuration error:blinks should be >= 0");
|
log("Blink::initWithDuration error:blinks should be >= 0");
|
||||||
|
@ -2181,7 +2181,7 @@ FadeTo* FadeTo::clone() const
|
||||||
|
|
||||||
FadeTo* FadeTo::reverse() const
|
FadeTo* FadeTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in FadeTo");
|
AXASSERT(false, "reverse() not supported in FadeTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2243,7 +2243,7 @@ TintTo* TintTo::clone() const
|
||||||
|
|
||||||
TintTo* TintTo::reverse() const
|
TintTo* TintTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in TintTo");
|
AXASSERT(false, "reverse() not supported in TintTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2382,8 +2382,8 @@ ReverseTime* ReverseTime::create(FiniteTimeAction* action)
|
||||||
|
|
||||||
bool ReverseTime::initWithAction(FiniteTimeAction* action)
|
bool ReverseTime::initWithAction(FiniteTimeAction* action)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action can't be nullptr!");
|
AXASSERT(action != nullptr, "action can't be nullptr!");
|
||||||
CCASSERT(action != _other, "action doesn't equal to _other!");
|
AXASSERT(action != _other, "action doesn't equal to _other!");
|
||||||
if (action == nullptr || action == _other)
|
if (action == nullptr || action == _other)
|
||||||
{
|
{
|
||||||
log("ReverseTime::initWithAction error: action is null or action equal to _other");
|
log("ReverseTime::initWithAction error: action is null or action equal to _other");
|
||||||
|
@ -2393,7 +2393,7 @@ bool ReverseTime::initWithAction(FiniteTimeAction* action)
|
||||||
if (ActionInterval::initWithDuration(action->getDuration()))
|
if (ActionInterval::initWithDuration(action->getDuration()))
|
||||||
{
|
{
|
||||||
// Don't leak if action is reused
|
// Don't leak if action is reused
|
||||||
CC_SAFE_RELEASE(_other);
|
AX_SAFE_RELEASE(_other);
|
||||||
|
|
||||||
_other = action;
|
_other = action;
|
||||||
action->retain();
|
action->retain();
|
||||||
|
@ -2414,7 +2414,7 @@ ReverseTime::ReverseTime() : _other(nullptr) {}
|
||||||
|
|
||||||
ReverseTime::~ReverseTime()
|
ReverseTime::~ReverseTime()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_other);
|
AX_SAFE_RELEASE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReverseTime::startWithTarget(Node* target)
|
void ReverseTime::startWithTarget(Node* target)
|
||||||
|
@ -2464,15 +2464,15 @@ Animate::Animate() {}
|
||||||
|
|
||||||
Animate::~Animate()
|
Animate::~Animate()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_animation);
|
AX_SAFE_RELEASE(_animation);
|
||||||
CC_SAFE_RELEASE(_origFrame);
|
AX_SAFE_RELEASE(_origFrame);
|
||||||
CC_SAFE_DELETE(_splitTimes);
|
AX_SAFE_DELETE(_splitTimes);
|
||||||
CC_SAFE_RELEASE(_frameDisplayedEvent);
|
AX_SAFE_RELEASE(_frameDisplayedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animate::initWithAnimation(Animation* animation)
|
bool Animate::initWithAnimation(Animation* animation)
|
||||||
{
|
{
|
||||||
CCASSERT(animation != nullptr, "Animate: argument Animation must be non-nullptr");
|
AXASSERT(animation != nullptr, "Animate: argument Animation must be non-nullptr");
|
||||||
if (animation == nullptr)
|
if (animation == nullptr)
|
||||||
{
|
{
|
||||||
log("Animate::initWithAnimation: argument Animation must be non-nullptr");
|
log("Animate::initWithAnimation: argument Animation must be non-nullptr");
|
||||||
|
@ -2510,8 +2510,8 @@ void Animate::setAnimation(axis::Animation* animation)
|
||||||
{
|
{
|
||||||
if (_animation != animation)
|
if (_animation != animation)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(animation);
|
AX_SAFE_RETAIN(animation);
|
||||||
CC_SAFE_RELEASE(_animation);
|
AX_SAFE_RELEASE(_animation);
|
||||||
_animation = animation;
|
_animation = animation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -2527,7 +2527,7 @@ void Animate::startWithTarget(Node* target)
|
||||||
ActionInterval::startWithTarget(target);
|
ActionInterval::startWithTarget(target);
|
||||||
Sprite* sprite = static_cast<Sprite*>(target);
|
Sprite* sprite = static_cast<Sprite*>(target);
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_origFrame);
|
AX_SAFE_RELEASE(_origFrame);
|
||||||
|
|
||||||
if (_animation->getRestoreOriginalFrame())
|
if (_animation->getRestoreOriginalFrame())
|
||||||
{
|
{
|
||||||
|
@ -2637,8 +2637,8 @@ TargetedAction::TargetedAction() : _action(nullptr), _forcedTarget(nullptr) {}
|
||||||
|
|
||||||
TargetedAction::~TargetedAction()
|
TargetedAction::~TargetedAction()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_forcedTarget);
|
AX_SAFE_RELEASE(_forcedTarget);
|
||||||
CC_SAFE_RELEASE(_action);
|
AX_SAFE_RELEASE(_action);
|
||||||
}
|
}
|
||||||
|
|
||||||
TargetedAction* TargetedAction::create(Node* target, FiniteTimeAction* action)
|
TargetedAction* TargetedAction::create(Node* target, FiniteTimeAction* action)
|
||||||
|
@ -2658,9 +2658,9 @@ bool TargetedAction::initWithTarget(Node* target, FiniteTimeAction* action)
|
||||||
{
|
{
|
||||||
if (ActionInterval::initWithDuration(action->getDuration()))
|
if (ActionInterval::initWithDuration(action->getDuration()))
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(target);
|
AX_SAFE_RETAIN(target);
|
||||||
_forcedTarget = target;
|
_forcedTarget = target;
|
||||||
CC_SAFE_RETAIN(action);
|
AX_SAFE_RETAIN(action);
|
||||||
_action = action;
|
_action = action;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -2704,8 +2704,8 @@ void TargetedAction::setForcedTarget(Node* forcedTarget)
|
||||||
{
|
{
|
||||||
if (_forcedTarget != forcedTarget)
|
if (_forcedTarget != forcedTarget)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(forcedTarget);
|
AX_SAFE_RETAIN(forcedTarget);
|
||||||
CC_SAFE_RELEASE(_forcedTarget);
|
AX_SAFE_RELEASE(_forcedTarget);
|
||||||
_forcedTarget = forcedTarget;
|
_forcedTarget = forcedTarget;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,7 +68,7 @@ auto action = MoveBy::create(1.0f, Vec2::ONE);
|
||||||
auto pingPongAction = Sequence::create(action, action->reverse(), nullptr);
|
auto pingPongAction = Sequence::create(action, action->reverse(), nullptr);
|
||||||
@endcode
|
@endcode
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionInterval : public FiniteTimeAction
|
class AX_DLL ActionInterval : public FiniteTimeAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** How many seconds had elapsed since the actions started to run.
|
/** How many seconds had elapsed since the actions started to run.
|
||||||
|
@ -100,13 +100,13 @@ public:
|
||||||
virtual void startWithTarget(Node* target) override;
|
virtual void startWithTarget(Node* target) override;
|
||||||
virtual ActionInterval* reverse() const override
|
virtual ActionInterval* reverse() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ActionInterval* clone() const override
|
virtual ActionInterval* clone() const override
|
||||||
{
|
{
|
||||||
CC_ASSERT(0);
|
AX_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,14 +125,14 @@ protected:
|
||||||
/** @class Sequence
|
/** @class Sequence
|
||||||
* @brief Runs actions sequentially, one after another.
|
* @brief Runs actions sequentially, one after another.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Sequence : public ActionInterval
|
class AX_DLL Sequence : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Helper constructor to create an array of sequenceable actions.
|
/** Helper constructor to create an array of sequenceable actions.
|
||||||
*
|
*
|
||||||
* @return An autoreleased Sequence object.
|
* @return An autoreleased Sequence object.
|
||||||
*/
|
*/
|
||||||
static Sequence* create(FiniteTimeAction* action1, ...) CC_REQUIRES_NULL_TERMINATION;
|
static Sequence* create(FiniteTimeAction* action1, ...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
|
|
||||||
/** Helper constructor to create an array of sequenceable actions given an array.
|
/** Helper constructor to create an array of sequenceable actions given an array.
|
||||||
* @code
|
* @code
|
||||||
|
@ -187,14 +187,14 @@ protected:
|
||||||
int _last;
|
int _last;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
AX_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Repeat
|
/** @class Repeat
|
||||||
* @brief Repeats an action a number of times.
|
* @brief Repeats an action a number of times.
|
||||||
* To repeat an action forever use the RepeatForever action.
|
* To repeat an action forever use the RepeatForever action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Repeat : public ActionInterval
|
class AX_DLL Repeat : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
|
/** Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
|
||||||
|
@ -213,8 +213,8 @@ public:
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(action);
|
AX_SAFE_RETAIN(action);
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ protected:
|
||||||
FiniteTimeAction* _innerAction;
|
FiniteTimeAction* _innerAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
AX_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class RepeatForever
|
/** @class RepeatForever
|
||||||
|
@ -261,7 +261,7 @@ private:
|
||||||
To repeat the an action for a limited number of times use the Repeat action.
|
To repeat the an action for a limited number of times use the Repeat action.
|
||||||
* @warning This action can't be Sequenceable because it is not an IntervalAction.
|
* @warning This action can't be Sequenceable because it is not an IntervalAction.
|
||||||
*/
|
*/
|
||||||
class CC_DLL RepeatForever : public ActionInterval
|
class AX_DLL RepeatForever : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action.
|
/** Creates the action.
|
||||||
|
@ -279,9 +279,9 @@ public:
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_innerAction);
|
AX_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
CC_SAFE_RETAIN(_innerAction);
|
AX_SAFE_RETAIN(_innerAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,13 +314,13 @@ protected:
|
||||||
ActionInterval* _innerAction;
|
ActionInterval* _innerAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
AX_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Spawn
|
/** @class Spawn
|
||||||
* @brief Spawn a new action immediately
|
* @brief Spawn a new action immediately
|
||||||
*/
|
*/
|
||||||
class CC_DLL Spawn : public ActionInterval
|
class AX_DLL Spawn : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Helper constructor to create an array of spawned actions.
|
/** Helper constructor to create an array of spawned actions.
|
||||||
|
@ -332,7 +332,7 @@ public:
|
||||||
*
|
*
|
||||||
* @return An autoreleased Spawn object.
|
* @return An autoreleased Spawn object.
|
||||||
*/
|
*/
|
||||||
static Spawn* create(FiniteTimeAction* action1, ...) CC_REQUIRES_NULL_TERMINATION;
|
static Spawn* create(FiniteTimeAction* action1, ...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
|
|
||||||
/** Helper constructor to create an array of spawned actions.
|
/** Helper constructor to create an array of spawned actions.
|
||||||
*
|
*
|
||||||
|
@ -383,14 +383,14 @@ protected:
|
||||||
FiniteTimeAction* _two;
|
FiniteTimeAction* _two;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
AX_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class RotateTo
|
/** @class RotateTo
|
||||||
* @brief Rotates a Node object to a certain angle by modifying it's rotation attribute.
|
* @brief Rotates a Node object to a certain angle by modifying it's rotation attribute.
|
||||||
The direction will be decided by the shortest angle.
|
The direction will be decided by the shortest angle.
|
||||||
*/
|
*/
|
||||||
class CC_DLL RotateTo : public ActionInterval
|
class AX_DLL RotateTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -460,13 +460,13 @@ protected:
|
||||||
Vec3 _diffAngle;
|
Vec3 _diffAngle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class RotateBy
|
/** @class RotateBy
|
||||||
* @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
* @brief Rotates a Node object clockwise a number of degrees by modifying it's rotation attribute.
|
||||||
*/
|
*/
|
||||||
class CC_DLL RotateBy : public ActionInterval
|
class AX_DLL RotateBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -525,7 +525,7 @@ protected:
|
||||||
Vec3 _startAngle;
|
Vec3 _startAngle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class MoveBy
|
/** @class MoveBy
|
||||||
|
@ -535,7 +535,7 @@ private:
|
||||||
movement will be the sum of individual movements.
|
movement will be the sum of individual movements.
|
||||||
@since v2.1beta2-custom
|
@since v2.1beta2-custom
|
||||||
*/
|
*/
|
||||||
class CC_DLL MoveBy : public ActionInterval
|
class AX_DLL MoveBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -580,7 +580,7 @@ protected:
|
||||||
Vec3 _previousPosition;
|
Vec3 _previousPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class MoveTo
|
/** @class MoveTo
|
||||||
|
@ -589,7 +589,7 @@ private:
|
||||||
movements.
|
movements.
|
||||||
@since v2.1beta2-custom
|
@since v2.1beta2-custom
|
||||||
*/
|
*/
|
||||||
class CC_DLL MoveTo : public MoveBy
|
class AX_DLL MoveTo : public MoveBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -632,14 +632,14 @@ protected:
|
||||||
Vec3 _endPosition;
|
Vec3 _endPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class SkewTo
|
/** @class SkewTo
|
||||||
* @brief Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
* @brief Skews a Node object to given angles by modifying it's skewX and skewY attributes
|
||||||
@since v1.0
|
@since v1.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL SkewTo : public ActionInterval
|
class AX_DLL SkewTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -680,14 +680,14 @@ protected:
|
||||||
float _deltaY;
|
float _deltaY;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class SkewBy
|
/** @class SkewBy
|
||||||
* @brief Skews a Node object by skewX and skewY degrees.
|
* @brief Skews a Node object by skewX and skewY degrees.
|
||||||
@since v1.0
|
@since v1.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL SkewBy : public SkewTo
|
class AX_DLL SkewBy : public SkewTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -714,13 +714,13 @@ public:
|
||||||
bool initWithDuration(float t, float sx, float sy);
|
bool initWithDuration(float t, float sx, float sy);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ResizeTo
|
/** @class ResizeTo
|
||||||
* @brief Resize a Node object to the final size by modifying it's 'size' attribute.
|
* @brief Resize a Node object to the final size by modifying it's 'size' attribute.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ResizeTo : public ActionInterval
|
class AX_DLL ResizeTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -756,14 +756,14 @@ protected:
|
||||||
Vec2 _sizeDelta;
|
Vec2 _sizeDelta;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ResizeTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(ResizeTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ResizeBy
|
/** @class ResizeBy
|
||||||
* @brief Resize a Node object by a size. Works on all nodes where setContentSize is effective. But it's mostly useful
|
* @brief Resize a Node object by a size. Works on all nodes where setContentSize is effective. But it's mostly useful
|
||||||
* for nodes where 9-slice is enabled
|
* for nodes where 9-slice is enabled
|
||||||
*/
|
*/
|
||||||
class CC_DLL ResizeBy : public ActionInterval
|
class AX_DLL ResizeBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -798,13 +798,13 @@ protected:
|
||||||
Vec2 _previousSize;
|
Vec2 _previousSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ResizeBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(ResizeBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class JumpBy
|
/** @class JumpBy
|
||||||
* @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
* @brief Moves a Node object simulating a parabolic jump movement by modifying it's position attribute.
|
||||||
*/
|
*/
|
||||||
class CC_DLL JumpBy : public ActionInterval
|
class AX_DLL JumpBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -845,13 +845,13 @@ protected:
|
||||||
Vec2 _previousPos;
|
Vec2 _previousPos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class JumpTo
|
/** @class JumpTo
|
||||||
* @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
* @brief Moves a Node object to a parabolic position simulating a jump movement by modifying it's position attribute.
|
||||||
*/
|
*/
|
||||||
class CC_DLL JumpTo : public JumpBy
|
class AX_DLL JumpTo : public JumpBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -884,7 +884,7 @@ protected:
|
||||||
Vec2 _endPosition;
|
Vec2 _endPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @struct Bezier configuration structure
|
/** @struct Bezier configuration structure
|
||||||
|
@ -902,7 +902,7 @@ typedef struct _ccBezierConfig
|
||||||
/** @class BezierBy
|
/** @class BezierBy
|
||||||
* @brief An action that moves the target with a cubic Bezier curve by a certain distance.
|
* @brief An action that moves the target with a cubic Bezier curve by a certain distance.
|
||||||
*/
|
*/
|
||||||
class CC_DLL BezierBy : public ActionInterval
|
class AX_DLL BezierBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with a duration and a bezier configuration.
|
/** Creates the action with a duration and a bezier configuration.
|
||||||
|
@ -943,14 +943,14 @@ protected:
|
||||||
Vec2 _previousPosition;
|
Vec2 _previousPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class BezierTo
|
/** @class BezierTo
|
||||||
* @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
* @brief An action that moves the target with a cubic Bezier curve to a destination point.
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL BezierTo : public BezierBy
|
class AX_DLL BezierTo : public BezierBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with a duration and a bezier configuration.
|
/** Creates the action with a duration and a bezier configuration.
|
||||||
|
@ -983,7 +983,7 @@ protected:
|
||||||
ccBezierConfig _toConfig;
|
ccBezierConfig _toConfig;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ScaleTo
|
/** @class ScaleTo
|
||||||
|
@ -991,7 +991,7 @@ private:
|
||||||
@warning This action doesn't support "reverse".
|
@warning This action doesn't support "reverse".
|
||||||
@warning The physics body contained in Node doesn't support this action.
|
@warning The physics body contained in Node doesn't support this action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ScaleTo : public ActionInterval
|
class AX_DLL ScaleTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1066,14 +1066,14 @@ protected:
|
||||||
float _deltaZ;
|
float _deltaZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ScaleBy
|
/** @class ScaleBy
|
||||||
* @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
* @brief Scales a Node object a zoom factor by modifying it's scale attribute.
|
||||||
@warning The physics body contained in Node doesn't support this action.
|
@warning The physics body contained in Node doesn't support this action.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ScaleBy : public ScaleTo
|
class AX_DLL ScaleBy : public ScaleTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1114,13 +1114,13 @@ public:
|
||||||
virtual ~ScaleBy() {}
|
virtual ~ScaleBy() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Blink
|
/** @class Blink
|
||||||
* @brief Blinks a Node object by modifying it's visible attribute.
|
* @brief Blinks a Node object by modifying it's visible attribute.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Blink : public ActionInterval
|
class AX_DLL Blink : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1157,7 +1157,7 @@ protected:
|
||||||
bool _originalState;
|
bool _originalState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Blink);
|
AX_DISALLOW_COPY_AND_ASSIGN(Blink);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class FadeTo
|
/** @class FadeTo
|
||||||
|
@ -1165,7 +1165,7 @@ private:
|
||||||
custom one.
|
custom one.
|
||||||
@warning This action doesn't support "reverse"
|
@warning This action doesn't support "reverse"
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeTo : public ActionInterval
|
class AX_DLL FadeTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1203,14 +1203,14 @@ protected:
|
||||||
friend class FadeIn;
|
friend class FadeIn;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class FadeIn
|
/** @class FadeIn
|
||||||
* @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
* @brief Fades In an object that implements the RGBAProtocol protocol. It modifies the opacity from 0 to 255.
|
||||||
The "reverse" of this action is FadeOut
|
The "reverse" of this action is FadeOut
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeIn : public FadeTo
|
class AX_DLL FadeIn : public FadeTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1236,7 +1236,7 @@ public:
|
||||||
virtual ~FadeIn() {}
|
virtual ~FadeIn() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
||||||
FadeTo* _reverseAction;
|
FadeTo* _reverseAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1244,7 +1244,7 @@ private:
|
||||||
* @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
* @brief Fades Out an object that implements the RGBAProtocol protocol. It modifies the opacity from 255 to 0.
|
||||||
The "reverse" of this action is FadeIn
|
The "reverse" of this action is FadeIn
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeOut : public FadeTo
|
class AX_DLL FadeOut : public FadeTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1269,7 +1269,7 @@ public:
|
||||||
virtual ~FadeOut() {}
|
virtual ~FadeOut() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
||||||
FadeTo* _reverseAction;
|
FadeTo* _reverseAction;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -1278,7 +1278,7 @@ private:
|
||||||
@warning This action doesn't support "reverse"
|
@warning This action doesn't support "reverse"
|
||||||
@since v0.7.2
|
@since v0.7.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL TintTo : public ActionInterval
|
class AX_DLL TintTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1320,14 +1320,14 @@ protected:
|
||||||
Color3B _from;
|
Color3B _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class TintBy
|
/** @class TintBy
|
||||||
@brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
@brief Tints a Node that implements the NodeRGB protocol from current tint to a custom one.
|
||||||
@since v0.7.2
|
@since v0.7.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL TintBy : public ActionInterval
|
class AX_DLL TintBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1367,13 +1367,13 @@ protected:
|
||||||
int16_t _fromB;
|
int16_t _fromB;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
AX_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class DelayTime
|
/** @class DelayTime
|
||||||
* @brief Delays the action a certain amount of seconds.
|
* @brief Delays the action a certain amount of seconds.
|
||||||
*/
|
*/
|
||||||
class CC_DLL DelayTime : public ActionInterval
|
class AX_DLL DelayTime : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1397,7 +1397,7 @@ public:
|
||||||
virtual ~DelayTime() {}
|
virtual ~DelayTime() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
AX_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ReverseTime
|
/** @class ReverseTime
|
||||||
|
@ -1408,7 +1408,7 @@ private:
|
||||||
of your own actions, but using it outside the "reversed"
|
of your own actions, but using it outside the "reversed"
|
||||||
scope is not recommended.
|
scope is not recommended.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ReverseTime : public ActionInterval
|
class AX_DLL ReverseTime : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action.
|
/** Creates the action.
|
||||||
|
@ -1440,14 +1440,14 @@ protected:
|
||||||
FiniteTimeAction* _other;
|
FiniteTimeAction* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
AX_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
||||||
};
|
};
|
||||||
|
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
/** @class Animate
|
/** @class Animate
|
||||||
* @brief Animates a sprite given the name of an Animation.
|
* @brief Animates a sprite given the name of an Animation.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Animate : public ActionInterval
|
class AX_DLL Animate : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with an Animation and will restore the original frame when the animation is over.
|
/** Creates the action with an Animation and will restore the original frame when the animation is over.
|
||||||
|
@ -1504,14 +1504,14 @@ protected:
|
||||||
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
|
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Animate);
|
AX_DISALLOW_COPY_AND_ASSIGN(Animate);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class TargetedAction
|
/** @class TargetedAction
|
||||||
* @brief Overrides the target of an action so that it always runs on the target
|
* @brief Overrides the target of an action so that it always runs on the target
|
||||||
* specified at action creation rather than the one specified by runAction.
|
* specified at action creation rather than the one specified by runAction.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TargetedAction : public ActionInterval
|
class AX_DLL TargetedAction : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create an action with the specified action and forced target.
|
/** Create an action with the specified action and forced target.
|
||||||
|
@ -1557,14 +1557,14 @@ protected:
|
||||||
Node* _forcedTarget;
|
Node* _forcedTarget;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
AX_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @class ActionFloat
|
* @class ActionFloat
|
||||||
* @brief Action used to animate any value in range [from,to] over specified time interval
|
* @brief Action used to animate any value in range [from,to] over specified time interval
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionFloat : public ActionInterval
|
class AX_DLL ActionFloat : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1609,7 +1609,7 @@ protected:
|
||||||
ActionFloatCallback _callback;
|
ActionFloatCallback _callback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
|
AX_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -54,7 +54,7 @@ ActionManager::ActionManager() : _targets(nullptr), _currentTarget(nullptr), _cu
|
||||||
|
|
||||||
ActionManager::~ActionManager()
|
ActionManager::~ActionManager()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing ActionManager: %p", this);
|
AXLOGINFO("deallocing ActionManager: %p", this);
|
||||||
|
|
||||||
removeAllActions();
|
removeAllActions();
|
||||||
}
|
}
|
||||||
|
@ -163,8 +163,8 @@ void ActionManager::resumeTargets(const Vector<Node*>& targetsToResume)
|
||||||
|
|
||||||
void ActionManager::addAction(Action* action, Node* target, bool paused)
|
void ActionManager::addAction(Action* action, Node* target, bool paused)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "action can't be nullptr!");
|
AXASSERT(action != nullptr, "action can't be nullptr!");
|
||||||
CCASSERT(target != nullptr, "target can't be nullptr!");
|
AXASSERT(target != nullptr, "target can't be nullptr!");
|
||||||
if (action == nullptr || target == nullptr)
|
if (action == nullptr || target == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -183,7 +183,7 @@ void ActionManager::addAction(Action* action, Node* target, bool paused)
|
||||||
|
|
||||||
actionAllocWithHashElement(element);
|
actionAllocWithHashElement(element);
|
||||||
|
|
||||||
CCASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!");
|
AXASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!");
|
||||||
ccArrayAppendObject(element->actions, action);
|
ccArrayAppendObject(element->actions, action);
|
||||||
|
|
||||||
action->startWithTarget(target);
|
action->startWithTarget(target);
|
||||||
|
@ -245,7 +245,7 @@ void ActionManager::removeAction(Action* action)
|
||||||
if (element)
|
if (element)
|
||||||
{
|
{
|
||||||
auto i = ccArrayGetIndexOfObject(element->actions, action);
|
auto i = ccArrayGetIndexOfObject(element->actions, action);
|
||||||
if (i != CC_INVALID_INDEX)
|
if (i != AX_INVALID_INDEX)
|
||||||
{
|
{
|
||||||
removeActionAtIndex(i, element);
|
removeActionAtIndex(i, element);
|
||||||
}
|
}
|
||||||
|
@ -254,8 +254,8 @@ void ActionManager::removeAction(Action* action)
|
||||||
|
|
||||||
void ActionManager::removeActionByTag(int tag, Node* target)
|
void ActionManager::removeActionByTag(int tag, Node* target)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
||||||
CCASSERT(target != nullptr, "target can't be nullptr!");
|
AXASSERT(target != nullptr, "target can't be nullptr!");
|
||||||
if (target == nullptr)
|
if (target == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -282,8 +282,8 @@ void ActionManager::removeActionByTag(int tag, Node* target)
|
||||||
|
|
||||||
void ActionManager::removeAllActionsByTag(int tag, Node* target)
|
void ActionManager::removeAllActionsByTag(int tag, Node* target)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
||||||
CCASSERT(target != nullptr, "target can't be nullptr!");
|
AXASSERT(target != nullptr, "target can't be nullptr!");
|
||||||
if (target == nullptr)
|
if (target == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -318,7 +318,7 @@ void ActionManager::removeActionsByFlags(unsigned int flags, Node* target)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CCASSERT(target != nullptr, "target can't be nullptr!");
|
AXASSERT(target != nullptr, "target can't be nullptr!");
|
||||||
if (target == nullptr)
|
if (target == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -353,7 +353,7 @@ void ActionManager::removeActionsByFlags(unsigned int flags, Node* target)
|
||||||
// and, it is not possible to get the address of a reference
|
// and, it is not possible to get the address of a reference
|
||||||
Action* ActionManager::getActionByTag(int tag, const Node* target) const
|
Action* ActionManager::getActionByTag(int tag, const Node* target) const
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
||||||
|
|
||||||
tHashElement* element = nullptr;
|
tHashElement* element = nullptr;
|
||||||
HASH_FIND_PTR(_targets, &target, element);
|
HASH_FIND_PTR(_targets, &target, element);
|
||||||
|
@ -396,7 +396,7 @@ ssize_t ActionManager::getNumberOfRunningActionsInTarget(const Node* target) con
|
||||||
// and, it is not possible to get the address of a reference
|
// and, it is not possible to get the address of a reference
|
||||||
size_t ActionManager::getNumberOfRunningActionsInTargetByTag(const Node* target, int tag)
|
size_t ActionManager::getNumberOfRunningActionsInTargetByTag(const Node* target, int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
|
||||||
|
|
||||||
tHashElement* element = nullptr;
|
tHashElement* element = nullptr;
|
||||||
HASH_FIND_PTR(_targets, &target, element);
|
HASH_FIND_PTR(_targets, &target, element);
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct _hashElement;
|
||||||
|
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionManager : public Ref
|
class AX_DLL ActionManager : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL PageTurn3D : public Grid3DAction
|
class AX_DLL PageTurn3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -66,7 +66,7 @@ ProgressTo* ProgressTo::clone() const
|
||||||
|
|
||||||
ProgressTo* ProgressTo::reverse() const
|
ProgressTo* ProgressTo::reverse() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "reverse() not supported in ProgressTo");
|
AXASSERT(false, "reverse() not supported in ProgressTo");
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ NS_AX_BEGIN
|
||||||
You should specify the destination percentage when creating the action.
|
You should specify the destination percentage when creating the action.
|
||||||
@since v0.99.1
|
@since v0.99.1
|
||||||
*/
|
*/
|
||||||
class CC_DLL ProgressTo : public ActionInterval
|
class AX_DLL ProgressTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +77,14 @@ protected:
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(ProgressTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief Progress from a percentage to another percentage.
|
@brief Progress from a percentage to another percentage.
|
||||||
@since v0.99.1
|
@since v0.99.1
|
||||||
*/
|
*/
|
||||||
class CC_DLL ProgressFromTo : public ActionInterval
|
class AX_DLL ProgressFromTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +121,7 @@ protected:
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
AX_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -225,8 +225,8 @@ ShuffleTiles* ShuffleTiles::clone() const
|
||||||
|
|
||||||
ShuffleTiles::~ShuffleTiles()
|
ShuffleTiles::~ShuffleTiles()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE_ARRAY(_tilesOrder);
|
AX_SAFE_DELETE_ARRAY(_tilesOrder);
|
||||||
CC_SAFE_DELETE_ARRAY(_tiles);
|
AX_SAFE_DELETE_ARRAY(_tiles);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ShuffleTiles::shuffle(unsigned int* array, unsigned int len)
|
void ShuffleTiles::shuffle(unsigned int* array, unsigned int len)
|
||||||
|
@ -569,7 +569,7 @@ TurnOffTiles* TurnOffTiles::clone() const
|
||||||
|
|
||||||
TurnOffTiles::~TurnOffTiles()
|
TurnOffTiles::~TurnOffTiles()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE_ARRAY(_tilesOrder);
|
AX_SAFE_DELETE_ARRAY(_tilesOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TurnOffTiles::shuffle(unsigned int* array, unsigned int len)
|
void TurnOffTiles::shuffle(unsigned int* array, unsigned int len)
|
||||||
|
|
|
@ -42,7 +42,7 @@ NS_AX_BEGIN
|
||||||
You can create the action by these parameters:
|
You can create the action by these parameters:
|
||||||
duration, grid size, range, whether shake on the z axis.
|
duration, grid size, range, whether shake on the z axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ShakyTiles3D : public TiledGrid3DAction
|
class AX_DLL ShakyTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -86,7 +86,7 @@ private:
|
||||||
You can create the action by these parameters:
|
You can create the action by these parameters:
|
||||||
duration, grid size, range, whether shatter on the z axis.
|
duration, grid size, range, whether shatter on the z axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ShatteredTiles3D : public TiledGrid3DAction
|
class AX_DLL ShatteredTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -122,7 +122,7 @@ protected:
|
||||||
bool _shatterZ;
|
bool _shatterZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Tile;
|
struct Tile;
|
||||||
|
@ -132,7 +132,7 @@ struct Tile;
|
||||||
You can create the action by these parameters:
|
You can create the action by these parameters:
|
||||||
duration, grid size, the random seed.
|
duration, grid size, the random seed.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
class AX_DLL ShuffleTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -172,14 +172,14 @@ protected:
|
||||||
Tile* _tiles;
|
Tile* _tiles;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FadeOutTRTiles action.
|
@brief FadeOutTRTiles action.
|
||||||
@details Fades out the target node with many tiles from Bottom-Left to Top-Right.
|
@details Fades out the target node with many tiles from Bottom-Left to Top-Right.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeOutTRTiles : public TiledGrid3DAction
|
class AX_DLL FadeOutTRTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -225,14 +225,14 @@ public:
|
||||||
virtual ~FadeOutTRTiles() {}
|
virtual ~FadeOutTRTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FadeOutBLTiles action.
|
@brief FadeOutBLTiles action.
|
||||||
@details Fades out the target node with many tiles from Top-Right to Bottom-Left.
|
@details Fades out the target node with many tiles from Top-Right to Bottom-Left.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeOutBLTiles : public FadeOutTRTiles
|
class AX_DLL FadeOutBLTiles : public FadeOutTRTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -251,14 +251,14 @@ public:
|
||||||
virtual ~FadeOutBLTiles() {}
|
virtual ~FadeOutBLTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FadeOutUpTiles action.
|
@brief FadeOutUpTiles action.
|
||||||
@details Fades out the target node with many tiles from bottom to top.
|
@details Fades out the target node with many tiles from bottom to top.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeOutUpTiles : public FadeOutTRTiles
|
class AX_DLL FadeOutUpTiles : public FadeOutTRTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -279,14 +279,14 @@ public:
|
||||||
virtual ~FadeOutUpTiles() {}
|
virtual ~FadeOutUpTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief FadeOutDownTiles action.
|
@brief FadeOutDownTiles action.
|
||||||
@details Fades out the target node with many tiles from top to bottom.
|
@details Fades out the target node with many tiles from top to bottom.
|
||||||
*/
|
*/
|
||||||
class CC_DLL FadeOutDownTiles : public FadeOutUpTiles
|
class AX_DLL FadeOutDownTiles : public FadeOutUpTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -305,14 +305,14 @@ public:
|
||||||
virtual ~FadeOutDownTiles() {}
|
virtual ~FadeOutDownTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief TurnOffTiles action.
|
@brief TurnOffTiles action.
|
||||||
@details Turn off the target node with many tiles in random order.
|
@details Turn off the target node with many tiles in random order.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TurnOffTiles : public TiledGrid3DAction
|
class AX_DLL TurnOffTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -373,14 +373,14 @@ protected:
|
||||||
unsigned int* _tilesOrder;
|
unsigned int* _tilesOrder;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
AX_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief WavesTiles3D action.
|
@brief WavesTiles3D action.
|
||||||
@details This action wave the target node with many tiles.
|
@details This action wave the target node with many tiles.
|
||||||
*/
|
*/
|
||||||
class CC_DLL WavesTiles3D : public TiledGrid3DAction
|
class AX_DLL WavesTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -438,14 +438,14 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief JumpTiles3D action.
|
@brief JumpTiles3D action.
|
||||||
@details Move the tiles of a target node across the Z axis.
|
@details Move the tiles of a target node across the Z axis.
|
||||||
*/
|
*/
|
||||||
class CC_DLL JumpTiles3D : public TiledGrid3DAction
|
class AX_DLL JumpTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -503,7 +503,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
AX_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -511,7 +511,7 @@ private:
|
||||||
@details Split the target node in many rows.
|
@details Split the target node in many rows.
|
||||||
Then move out some rows from left, move out the other rows from right.
|
Then move out some rows from left, move out the other rows from right.
|
||||||
*/
|
*/
|
||||||
class CC_DLL SplitRows : public TiledGrid3DAction
|
class AX_DLL SplitRows : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -543,7 +543,7 @@ protected:
|
||||||
Vec2 _winSize;
|
Vec2 _winSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
AX_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -551,7 +551,7 @@ private:
|
||||||
@details Split the target node in many columns.
|
@details Split the target node in many columns.
|
||||||
Then move out some columns from top, move out the other columns from bottom.
|
Then move out some columns from top, move out the other columns from bottom.
|
||||||
*/
|
*/
|
||||||
class CC_DLL SplitCols : public TiledGrid3DAction
|
class AX_DLL SplitCols : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -586,7 +586,7 @@ protected:
|
||||||
Vec2 _winSize;
|
Vec2 _winSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
AX_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -62,7 +62,7 @@ ActionTween* ActionTween::clone() const
|
||||||
|
|
||||||
void ActionTween::startWithTarget(Node* target)
|
void ActionTween::startWithTarget(Node* target)
|
||||||
{
|
{
|
||||||
CCASSERT(dynamic_cast<ActionTweenDelegate*>(target), "target must implement ActionTweenDelegate");
|
AXASSERT(dynamic_cast<ActionTweenDelegate*>(target), "target must implement ActionTweenDelegate");
|
||||||
ActionInterval::startWithTarget(target);
|
ActionInterval::startWithTarget(target);
|
||||||
_delta = _to - _from;
|
_delta = _to - _from;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
Then once you running ActionTween on the node, the method updateTweenAction will be invoked.
|
Then once you running ActionTween on the node, the method updateTweenAction will be invoked.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionTweenDelegate
|
class AX_DLL ActionTweenDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
@since v0.99.2
|
@since v0.99.2
|
||||||
*/
|
*/
|
||||||
class CC_DLL ActionTween : public ActionInterval
|
class AX_DLL ActionTween : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ AnimationFrame* AnimationFrame::create(SpriteFrame* spriteFrame, float delayUnit
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -59,9 +59,9 @@ bool AnimationFrame::initWithSpriteFrame(SpriteFrame* spriteFrame, float delayUn
|
||||||
|
|
||||||
AnimationFrame::~AnimationFrame()
|
AnimationFrame::~AnimationFrame()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing AnimationFrame: %p", this);
|
AXLOGINFO("deallocing AnimationFrame: %p", this);
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_spriteFrame);
|
AX_SAFE_RELEASE(_spriteFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationFrame* AnimationFrame::clone() const
|
AnimationFrame* AnimationFrame::clone() const
|
||||||
|
@ -153,7 +153,7 @@ Animation::Animation()
|
||||||
|
|
||||||
Animation::~Animation()
|
Animation::~Animation()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing Animation: %p", this);
|
AXLOGINFO("deallocing Animation: %p", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Animation::addSpriteFrame(SpriteFrame* spriteFrame)
|
void Animation::addSpriteFrame(SpriteFrame* spriteFrame)
|
||||||
|
|
|
@ -25,8 +25,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef __CC_ANIMATION_H__
|
#ifndef __AX_ANIMATION_H__
|
||||||
#define __CC_ANIMATION_H__
|
#define __AX_ANIMATION_H__
|
||||||
|
|
||||||
#include "platform/CCPlatformConfig.h"
|
#include "platform/CCPlatformConfig.h"
|
||||||
#include "base/CCRef.h"
|
#include "base/CCRef.h"
|
||||||
|
@ -55,7 +55,7 @@ class SpriteFrame;
|
||||||
|
|
||||||
@since v2.0
|
@since v2.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL AnimationFrame : public Ref, public Clonable
|
class AX_DLL AnimationFrame : public Ref, public Clonable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** @struct DisplayedEventInfo
|
/** @struct DisplayedEventInfo
|
||||||
|
@ -87,8 +87,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void setSpriteFrame(SpriteFrame* frame)
|
void setSpriteFrame(SpriteFrame* frame)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(frame);
|
AX_SAFE_RETAIN(frame);
|
||||||
CC_SAFE_RELEASE(_spriteFrame);
|
AX_SAFE_RELEASE(_spriteFrame);
|
||||||
_spriteFrame = frame;
|
_spriteFrame = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ protected:
|
||||||
ValueMap _userInfo;
|
ValueMap _userInfo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(AnimationFrame);
|
AX_DISALLOW_COPY_AND_ASSIGN(AnimationFrame);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Animation
|
/** @class Animation
|
||||||
|
@ -157,7 +157,7 @@ private:
|
||||||
* sprite->runAction(Animate::create(animation));
|
* sprite->runAction(Animate::create(animation));
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
class CC_DLL Animation : public Ref, public Clonable
|
class AX_DLL Animation : public Ref, public Clonable
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an animation.
|
/** Creates an animation.
|
||||||
|
@ -314,7 +314,7 @@ protected:
|
||||||
unsigned int _loops;
|
unsigned int _loops;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Animation);
|
AX_DISALLOW_COPY_AND_ASSIGN(Animation);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of sprite_nodes group
|
// end of sprite_nodes group
|
||||||
|
@ -322,4 +322,4 @@ private:
|
||||||
|
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
#endif // __CC_ANIMATION_H__
|
#endif // __AX_ANIMATION_H__
|
||||||
|
|
|
@ -48,7 +48,7 @@ AnimationCache* AnimationCache::getInstance()
|
||||||
|
|
||||||
void AnimationCache::destroyInstance()
|
void AnimationCache::destroyInstance()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(s_sharedAnimationCache);
|
AX_SAFE_RELEASE_NULL(s_sharedAnimationCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnimationCache::init()
|
bool AnimationCache::init()
|
||||||
|
@ -60,7 +60,7 @@ AnimationCache::AnimationCache() {}
|
||||||
|
|
||||||
AnimationCache::~AnimationCache()
|
AnimationCache::~AnimationCache()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing AnimationCache: %p", this);
|
AXLOGINFO("deallocing AnimationCache: %p", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void AnimationCache::addAnimation(Animation* animation, std::string_view name)
|
void AnimationCache::addAnimation(Animation* animation, std::string_view name)
|
||||||
|
@ -94,7 +94,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
|
||||||
|
|
||||||
if (frameNames.empty())
|
if (frameNames.empty())
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
|
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
|
||||||
"animation cache.",
|
"animation cache.",
|
||||||
anim.first.c_str());
|
anim.first.c_str());
|
||||||
|
@ -110,7 +110,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
|
||||||
|
|
||||||
if (!spriteFrame)
|
if (!spriteFrame)
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
|
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
|
||||||
"SpriteFrameCache. This frame will not be added to the animation.",
|
"SpriteFrameCache. This frame will not be added to the animation.",
|
||||||
anim.first.c_str(), frameName.asString().c_str());
|
anim.first.c_str(), frameName.asString().c_str());
|
||||||
|
@ -124,7 +124,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
|
||||||
|
|
||||||
if (frames.empty())
|
if (frames.empty())
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: None of the frames for animation '%s' were found in the SpriteFrameCache. "
|
"cocos2d: AnimationCache: None of the frames for animation '%s' were found in the SpriteFrameCache. "
|
||||||
"Animation is not being added to the Animation Cache.",
|
"Animation is not being added to the Animation Cache.",
|
||||||
anim.first.c_str());
|
anim.first.c_str());
|
||||||
|
@ -132,7 +132,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
|
||||||
}
|
}
|
||||||
else if (frames.size() != frameNameSize)
|
else if (frames.size() != frameNameSize)
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: An animation in your dictionary refers to a frame which is not in the "
|
"cocos2d: AnimationCache: An animation in your dictionary refers to a frame which is not in the "
|
||||||
"SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
|
"SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
|
||||||
anim.first.c_str());
|
anim.first.c_str());
|
||||||
|
@ -160,7 +160,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
|
||||||
|
|
||||||
if (frameArray.empty())
|
if (frameArray.empty())
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
|
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
|
||||||
"animation cache.",
|
"animation cache.",
|
||||||
name.c_str());
|
name.c_str());
|
||||||
|
@ -178,7 +178,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
|
||||||
|
|
||||||
if (!spriteFrame)
|
if (!spriteFrame)
|
||||||
{
|
{
|
||||||
CCLOG(
|
AXLOG(
|
||||||
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
|
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
|
||||||
"SpriteFrameCache. This frame will not be added to the animation.",
|
"SpriteFrameCache. This frame will not be added to the animation.",
|
||||||
name.c_str(), spriteFrameName.c_str());
|
name.c_str(), spriteFrameName.c_str());
|
||||||
|
@ -210,7 +210,7 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
|
||||||
auto anisItr = dictionary.find("animations");
|
auto anisItr = dictionary.find("animations");
|
||||||
if (anisItr == dictionary.end())
|
if (anisItr == dictionary.end())
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: AnimationCache: No animations were found in provided dictionary.");
|
AXLOG("cocos2d: AnimationCache: No animations were found in provided dictionary.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -240,14 +240,14 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
|
||||||
parseVersion2(animations.asValueMap());
|
parseVersion2(animations.asValueMap());
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CCASSERT(false, "Invalid animation format");
|
AXASSERT(false, "Invalid animation format");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Read an NSDictionary from a plist file and parse it automatically for animations */
|
/** Read an NSDictionary from a plist file and parse it automatically for animations */
|
||||||
void AnimationCache::addAnimationsWithFile(std::string_view plist)
|
void AnimationCache::addAnimationsWithFile(std::string_view plist)
|
||||||
{
|
{
|
||||||
CCASSERT(!plist.empty(), "Invalid texture file name");
|
AXASSERT(!plist.empty(), "Invalid texture file name");
|
||||||
if (plist.empty())
|
if (plist.empty())
|
||||||
{
|
{
|
||||||
log("%s error:file name is empty!", __FUNCTION__);
|
log("%s error:file name is empty!", __FUNCTION__);
|
||||||
|
@ -256,7 +256,7 @@ void AnimationCache::addAnimationsWithFile(std::string_view plist)
|
||||||
|
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(plist);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(plist);
|
||||||
|
|
||||||
CCASSERT(!dict.empty(), "CCAnimationCache: File could not be found");
|
AXASSERT(!dict.empty(), "CCAnimationCache: File could not be found");
|
||||||
if (dict.empty())
|
if (dict.empty())
|
||||||
{
|
{
|
||||||
log("AnimationCache::addAnimationsWithFile error:%s not exist!", plist.data());
|
log("AnimationCache::addAnimationsWithFile error:%s not exist!", plist.data());
|
||||||
|
|
|
@ -25,8 +25,8 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
#ifndef __CC_ANIMATION_CACHE_H__
|
#ifndef __AX_ANIMATION_CACHE_H__
|
||||||
#define __CC_ANIMATION_CACHE_H__
|
#define __AX_ANIMATION_CACHE_H__
|
||||||
|
|
||||||
#include "base/CCRef.h"
|
#include "base/CCRef.h"
|
||||||
#include "base/CCMap.h"
|
#include "base/CCMap.h"
|
||||||
|
@ -52,7 +52,7 @@ Before v0.99.5, the recommend way was to save them on the Sprite. Since v0.99.5,
|
||||||
@since v0.99.5
|
@since v0.99.5
|
||||||
@js cc.animationCache
|
@js cc.animationCache
|
||||||
*/
|
*/
|
||||||
class CC_DLL AnimationCache : public Ref
|
class AX_DLL AnimationCache : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -129,4 +129,4 @@ private:
|
||||||
|
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
#endif // __CC_ANIMATION_CACHE_H__
|
#endif // __AX_ANIMATION_CACHE_H__
|
||||||
|
|
|
@ -44,7 +44,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
AtlasNode::~AtlasNode()
|
AtlasNode::~AtlasNode()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_textureAtlas);
|
AX_SAFE_RELEASE(_textureAtlas);
|
||||||
}
|
}
|
||||||
|
|
||||||
AtlasNode* AtlasNode::create(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender)
|
AtlasNode* AtlasNode::create(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender)
|
||||||
|
@ -55,13 +55,13 @@ AtlasNode* AtlasNode::create(std::string_view tile, int tileWidth, int tileHeigh
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AtlasNode::initWithTileFile(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender)
|
bool AtlasNode::initWithTileFile(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender)
|
||||||
{
|
{
|
||||||
CCASSERT(!tile.empty(), "file size should not be empty");
|
AXASSERT(!tile.empty(), "file size should not be empty");
|
||||||
Texture2D* texture = _director->getTextureCache()->addImage(tile);
|
Texture2D* texture = _director->getTextureCache()->addImage(tile);
|
||||||
return initWithTexture(texture, tileWidth, tileHeight, itemsToRender);
|
return initWithTexture(texture, tileWidth, tileHeight, itemsToRender);
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ void AtlasNode::calculateMaxItems()
|
||||||
|
|
||||||
void AtlasNode::updateAtlasValues()
|
void AtlasNode::updateAtlasValues()
|
||||||
{
|
{
|
||||||
CCASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
|
AXASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
|
||||||
}
|
}
|
||||||
|
|
||||||
// AtlasNode - draw
|
// AtlasNode - draw
|
||||||
|
@ -270,8 +270,8 @@ Texture2D* AtlasNode::getTexture() const
|
||||||
|
|
||||||
void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
|
void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(textureAtlas);
|
AX_SAFE_RETAIN(textureAtlas);
|
||||||
CC_SAFE_RELEASE(_textureAtlas);
|
AX_SAFE_RELEASE(_textureAtlas);
|
||||||
_textureAtlas = textureAtlas;
|
_textureAtlas = textureAtlas;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -47,7 +47,7 @@ class TextureAtlas;
|
||||||
* All features from Node are valid, plus the following features:
|
* All features from Node are valid, plus the following features:
|
||||||
* - opacity and RGB colors.
|
* - opacity and RGB colors.
|
||||||
*/
|
*/
|
||||||
class CC_DLL AtlasNode : public Node, public TextureProtocol
|
class AX_DLL AtlasNode : public Node, public TextureProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render.
|
/** creates a AtlasNode with an Atlas file the width and height of each item and the quantity of items to render.
|
||||||
|
@ -147,7 +147,7 @@ protected:
|
||||||
backend::UniformLocation _mvpMatrixLocation;
|
backend::UniformLocation _mvpMatrixLocation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
AX_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of base_node group
|
// end of base_node group
|
||||||
|
|
|
@ -62,7 +62,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles(), _isVertsOwner(
|
||||||
_rect = other._rect;
|
_rect = other._rect;
|
||||||
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
|
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
|
||||||
triangles.indices = new unsigned short[other.triangles.indexCount];
|
triangles.indices = new unsigned short[other.triangles.indexCount];
|
||||||
CCASSERT(triangles.verts && triangles.indices, "not enough memory");
|
AXASSERT(triangles.verts && triangles.indices, "not enough memory");
|
||||||
triangles.vertCount = other.triangles.vertCount;
|
triangles.vertCount = other.triangles.vertCount;
|
||||||
triangles.indexCount = other.triangles.indexCount;
|
triangles.indexCount = other.triangles.indexCount;
|
||||||
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
|
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
|
||||||
|
@ -79,7 +79,7 @@ PolygonInfo& PolygonInfo::operator=(const PolygonInfo& other)
|
||||||
_rect = other._rect;
|
_rect = other._rect;
|
||||||
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
|
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
|
||||||
triangles.indices = new unsigned short[other.triangles.indexCount];
|
triangles.indices = new unsigned short[other.triangles.indexCount];
|
||||||
CCASSERT(triangles.verts && triangles.indices, "not enough memory");
|
AXASSERT(triangles.verts && triangles.indices, "not enough memory");
|
||||||
triangles.vertCount = other.triangles.vertCount;
|
triangles.vertCount = other.triangles.vertCount;
|
||||||
triangles.indexCount = other.triangles.indexCount;
|
triangles.indexCount = other.triangles.indexCount;
|
||||||
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
|
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
|
||||||
|
@ -106,7 +106,7 @@ void PolygonInfo::setQuad(V3F_C4B_T2F_Quad* quad)
|
||||||
|
|
||||||
void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads)
|
void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads)
|
||||||
{
|
{
|
||||||
CCASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
|
AXASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
|
||||||
|
|
||||||
releaseVertsAndIndices();
|
releaseVertsAndIndices();
|
||||||
_isVertsOwner = false;
|
_isVertsOwner = false;
|
||||||
|
@ -133,12 +133,12 @@ void PolygonInfo::releaseVertsAndIndices()
|
||||||
{
|
{
|
||||||
if (nullptr != triangles.verts)
|
if (nullptr != triangles.verts)
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE_ARRAY(triangles.verts);
|
AX_SAFE_DELETE_ARRAY(triangles.verts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != triangles.indices)
|
if (nullptr != triangles.indices)
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE_ARRAY(triangles.indices);
|
AX_SAFE_DELETE_ARRAY(triangles.indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -174,7 +174,7 @@ AutoPolygon::AutoPolygon(std::string_view filename)
|
||||||
_filename = filename;
|
_filename = filename;
|
||||||
_image = new Image();
|
_image = new Image();
|
||||||
_image->initWithImageFile(filename);
|
_image->initWithImageFile(filename);
|
||||||
CCASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8,
|
AXASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8,
|
||||||
"unsupported format, currently only supports rgba8888");
|
"unsupported format, currently only supports rgba8888");
|
||||||
_data = _image->getData();
|
_data = _image->getData();
|
||||||
_width = _image->getWidth();
|
_width = _image->getWidth();
|
||||||
|
@ -184,7 +184,7 @@ AutoPolygon::AutoPolygon(std::string_view filename)
|
||||||
|
|
||||||
AutoPolygon::~AutoPolygon()
|
AutoPolygon::~AutoPolygon()
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(_image);
|
AX_SAFE_DELETE(_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Vec2> AutoPolygon::trace(const Rect& rect, float threshold)
|
std::vector<Vec2> AutoPolygon::trace(const Rect& rect, float threshold)
|
||||||
|
@ -211,7 +211,7 @@ Vec2 AutoPolygon::findFirstNoneTransparentPixel(const Rect& rect, float threshol
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
CCASSERT(found, "image is all transparent!");
|
AXASSERT(found, "image is all transparent!");
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +246,7 @@ unsigned int AutoPolygon::getSquareValue(unsigned int x, unsigned int y, const R
|
||||||
sv += (fixedRect.containsPoint(bl) && getAlphaByPos(bl) > threshold) ? 4 : 0;
|
sv += (fixedRect.containsPoint(bl) && getAlphaByPos(bl) > threshold) ? 4 : 0;
|
||||||
Vec2 br = Vec2(x - 0.0f, y - 0.0f);
|
Vec2 br = Vec2(x - 0.0f, y - 0.0f);
|
||||||
sv += (fixedRect.containsPoint(br) && getAlphaByPos(br) > threshold) ? 8 : 0;
|
sv += (fixedRect.containsPoint(br) && getAlphaByPos(br) > threshold) ? 8 : 0;
|
||||||
CCASSERT(sv != 0 && sv != 15, "square value should not be 0, or 15");
|
AXASSERT(sv != 0 && sv != 15, "square value should not be 0, or 15");
|
||||||
return sv;
|
return sv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -386,7 +386,7 @@ std::vector<axis::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2& s
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CCLOG("this shouldn't happen.");
|
AXLOG("this shouldn't happen.");
|
||||||
}
|
}
|
||||||
// little optimization
|
// little optimization
|
||||||
// if previous direction is same as current direction,
|
// if previous direction is same as current direction,
|
||||||
|
@ -408,9 +408,9 @@ std::vector<axis::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2& s
|
||||||
prevx = stepx;
|
prevx = stepx;
|
||||||
prevy = stepy;
|
prevy = stepy;
|
||||||
|
|
||||||
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
|
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
|
||||||
const auto totalPixel = _width * _height;
|
const auto totalPixel = _width * _height;
|
||||||
CCASSERT(count <= totalPixel, "oh no, marching square cannot find starting position");
|
AXASSERT(count <= totalPixel, "oh no, marching square cannot find starting position");
|
||||||
#endif
|
#endif
|
||||||
} while (curx != startx || cury != starty);
|
} while (curx != startx || cury != starty);
|
||||||
return _points;
|
return _points;
|
||||||
|
@ -666,7 +666,7 @@ void AutoPolygon::calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t coun
|
||||||
0,1 1,1
|
0,1 1,1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
CCASSERT(_width && _height, "please specify width and height for this AutoPolygon instance");
|
AXASSERT(_width && _height, "please specify width and height for this AutoPolygon instance");
|
||||||
auto texWidth = _width;
|
auto texWidth = _width;
|
||||||
auto texHeight = _height;
|
auto texHeight = _height;
|
||||||
|
|
||||||
|
@ -688,13 +688,13 @@ Rect AutoPolygon::getRealRect(const Rect& rect)
|
||||||
if (realRect.equals(Rect::ZERO))
|
if (realRect.equals(Rect::ZERO))
|
||||||
{
|
{
|
||||||
// if the instance doesn't have width and height, then the whole operation is kaput
|
// if the instance doesn't have width and height, then the whole operation is kaput
|
||||||
CCASSERT(_height && _width, "Please specify a width and height for this instance before using its functions");
|
AXASSERT(_height && _width, "Please specify a width and height for this instance before using its functions");
|
||||||
realRect = Rect(0, 0, (float)_width, (float)_height);
|
realRect = Rect(0, 0, (float)_width, (float)_height);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rect is specified, so convert to real rect
|
// rect is specified, so convert to real rect
|
||||||
realRect = CC_RECT_POINTS_TO_PIXELS(rect);
|
realRect = AX_RECT_POINTS_TO_PIXELS(rect);
|
||||||
}
|
}
|
||||||
return realRect;
|
return realRect;
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,7 +45,7 @@ NS_AX_BEGIN
|
||||||
* PolygonInfo is an object holding the required data to display Sprites.
|
* PolygonInfo is an object holding the required data to display Sprites.
|
||||||
* It can be a simple as a triangle, or as complex as a whole 3D mesh
|
* It can be a simple as a triangle, or as complex as a whole 3D mesh
|
||||||
*/
|
*/
|
||||||
class CC_DLL PolygonInfo
|
class AX_DLL PolygonInfo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/// @name Creators
|
/// @name Creators
|
||||||
|
@ -138,7 +138,7 @@ private:
|
||||||
* It has functions for each step in the process, from tracing all the points, to triangulation
|
* It has functions for each step in the process, from tracing all the points, to triangulation
|
||||||
* the result can be then passed to Sprite::create() to create a Polygon Sprite
|
* the result can be then passed to Sprite::create() to create a Polygon Sprite
|
||||||
*/
|
*/
|
||||||
class CC_DLL AutoPolygon
|
class AX_DLL AutoPolygon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -81,7 +81,7 @@ Camera* Camera::getDefaultCamera()
|
||||||
|
|
||||||
auto scene = Director::getInstance()->getRunningScene();
|
auto scene = Director::getInstance()->getRunningScene();
|
||||||
|
|
||||||
CCASSERT(scene, "Scene is not done initializing, please use this->_defaultCamera instead.");
|
AXASSERT(scene, "Scene is not done initializing, please use this->_defaultCamera instead.");
|
||||||
|
|
||||||
return scene->getDefaultCamera();
|
return scene->getDefaultCamera();
|
||||||
|
|
||||||
|
@ -119,7 +119,7 @@ Camera::Camera()
|
||||||
|
|
||||||
Camera::~Camera()
|
Camera::~Camera()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_clearBrush);
|
AX_SAFE_RELEASE(_clearBrush);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Mat4& Camera::getProjectionMatrix() const
|
const Mat4& Camera::getProjectionMatrix() const
|
||||||
|
@ -233,7 +233,7 @@ bool Camera::initDefault()
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
CCLOG("unrecognized projection");
|
AXLOG("unrecognized projection");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (_zoomFactor != 1.0F)
|
if (_zoomFactor != 1.0F)
|
||||||
|
@ -283,7 +283,7 @@ Vec2 Camera::project(const Vec3& src) const
|
||||||
Vec4 clipPos;
|
Vec4 clipPos;
|
||||||
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
|
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
|
||||||
|
|
||||||
CCASSERT(clipPos.w != 0.0f, "clipPos.w can't be 0.0f!");
|
AXASSERT(clipPos.w != 0.0f, "clipPos.w can't be 0.0f!");
|
||||||
float ndcX = clipPos.x / clipPos.w;
|
float ndcX = clipPos.x / clipPos.w;
|
||||||
float ndcY = clipPos.y / clipPos.w;
|
float ndcY = clipPos.y / clipPos.w;
|
||||||
|
|
||||||
|
@ -301,7 +301,7 @@ Vec2 Camera::projectGL(const Vec3& src) const
|
||||||
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
|
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
|
||||||
|
|
||||||
if (clipPos.w == 0.0f)
|
if (clipPos.w == 0.0f)
|
||||||
CCLOG("WARNING: Camera's clip position w is 0.0! a black screen should be expected.");
|
AXLOG("WARNING: Camera's clip position w is 0.0! a black screen should be expected.");
|
||||||
|
|
||||||
float ndcX = clipPos.x / clipPos.w;
|
float ndcX = clipPos.x / clipPos.w;
|
||||||
float ndcY = clipPos.y / clipPos.w;
|
float ndcY = clipPos.y / clipPos.w;
|
||||||
|
@ -327,7 +327,7 @@ Vec3 Camera::unprojectGL(const Vec3& src) const
|
||||||
|
|
||||||
void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const
|
void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const
|
||||||
{
|
{
|
||||||
CCASSERT(src && dst, "vec3 can not be null");
|
AXASSERT(src && dst, "vec3 can not be null");
|
||||||
|
|
||||||
Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
|
Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
|
||||||
screen.x = screen.x * 2.0f - 1.0f;
|
screen.x = screen.x * 2.0f - 1.0f;
|
||||||
|
@ -347,7 +347,7 @@ void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const
|
||||||
|
|
||||||
void Camera::unprojectGL(const Vec2& viewport, const Vec3* src, Vec3* dst) const
|
void Camera::unprojectGL(const Vec2& viewport, const Vec3* src, Vec3* dst) const
|
||||||
{
|
{
|
||||||
CCASSERT(src && dst, "vec3 can not be null");
|
AXASSERT(src && dst, "vec3 can not be null");
|
||||||
|
|
||||||
Vec4 screen(src->x / viewport.width, src->y / viewport.height, src->z, 1.0f);
|
Vec4 screen(src->x / viewport.width, src->y / viewport.height, src->z, 1.0f);
|
||||||
screen.x = screen.x * 2.0f - 1.0f;
|
screen.x = screen.x * 2.0f - 1.0f;
|
||||||
|
@ -572,8 +572,8 @@ void Camera::visit(Renderer* renderer, const Mat4& parentTransform, uint32_t par
|
||||||
|
|
||||||
void Camera::setBackgroundBrush(CameraBackgroundBrush* clearBrush)
|
void Camera::setBackgroundBrush(CameraBackgroundBrush* clearBrush)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(clearBrush);
|
AX_SAFE_RETAIN(clearBrush);
|
||||||
CC_SAFE_RELEASE(_clearBrush);
|
AX_SAFE_RELEASE(_clearBrush);
|
||||||
_clearBrush = clearBrush;
|
_clearBrush = clearBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ enum class CameraFlag
|
||||||
/**
|
/**
|
||||||
* Defines a camera .
|
* Defines a camera .
|
||||||
*/
|
*/
|
||||||
class CC_DLL Camera : public Node
|
class AX_DLL Camera : public Node
|
||||||
{
|
{
|
||||||
friend class Scene;
|
friend class Scene;
|
||||||
friend class Director;
|
friend class Director;
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
#include "renderer/CCTextureCube.h"
|
#include "renderer/CCTextureCube.h"
|
||||||
#include "renderer/ccShaders.h"
|
#include "renderer/ccShaders.h"
|
||||||
|
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
# include "base/CCEventCustom.h"
|
# include "base/CCEventCustom.h"
|
||||||
# include "base/CCEventListenerCustom.h"
|
# include "base/CCEventListenerCustom.h"
|
||||||
# include "base/CCEventType.h"
|
# include "base/CCEventType.h"
|
||||||
|
@ -49,7 +49,7 @@ CameraBackgroundBrush::CameraBackgroundBrush() {}
|
||||||
|
|
||||||
CameraBackgroundBrush::~CameraBackgroundBrush()
|
CameraBackgroundBrush::~CameraBackgroundBrush()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_programState);
|
AX_SAFE_RELEASE_NULL(_programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush()
|
CameraBackgroundBrush* CameraBackgroundBrush::createNoneBrush()
|
||||||
|
@ -86,11 +86,11 @@ CameraBackgroundSkyBoxBrush* CameraBackgroundBrush::createSkyboxBrush(std::strin
|
||||||
CameraBackgroundDepthBrush::CameraBackgroundDepthBrush()
|
CameraBackgroundDepthBrush::CameraBackgroundDepthBrush()
|
||||||
: _depth(0.f)
|
: _depth(0.f)
|
||||||
, _clearColor(false)
|
, _clearColor(false)
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
, _backToForegroundListener(nullptr)
|
, _backToForegroundListener(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
_backToForegroundListener =
|
_backToForegroundListener =
|
||||||
EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { initBuffer(); });
|
EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { initBuffer(); });
|
||||||
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
||||||
|
@ -98,7 +98,7 @@ CameraBackgroundDepthBrush::CameraBackgroundDepthBrush()
|
||||||
}
|
}
|
||||||
CameraBackgroundDepthBrush::~CameraBackgroundDepthBrush()
|
CameraBackgroundDepthBrush::~CameraBackgroundDepthBrush()
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
|
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -114,7 +114,7 @@ CameraBackgroundDepthBrush* CameraBackgroundDepthBrush::create(float depth)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -122,7 +122,7 @@ CameraBackgroundDepthBrush* CameraBackgroundDepthBrush::create(float depth)
|
||||||
|
|
||||||
bool CameraBackgroundDepthBrush::init()
|
bool CameraBackgroundDepthBrush::init()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_programState);
|
AX_SAFE_RELEASE_NULL(_programState);
|
||||||
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::CAMERA_CLEAR);
|
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::CAMERA_CLEAR);
|
||||||
_programState = new backend::ProgramState(program);
|
_programState = new backend::ProgramState(program);
|
||||||
|
|
||||||
|
@ -166,8 +166,8 @@ bool CameraBackgroundDepthBrush::init()
|
||||||
_vertices[2].texCoords = Tex2F(1, 1);
|
_vertices[2].texCoords = Tex2F(1, 1);
|
||||||
_vertices[3].texCoords = Tex2F(0, 1);
|
_vertices[3].texCoords = Tex2F(0, 1);
|
||||||
|
|
||||||
_customCommand.setBeforeCallback(CC_CALLBACK_0(CameraBackgroundDepthBrush::onBeforeDraw, this));
|
_customCommand.setBeforeCallback(AX_CALLBACK_0(CameraBackgroundDepthBrush::onBeforeDraw, this));
|
||||||
_customCommand.setAfterCallback(CC_CALLBACK_0(CameraBackgroundDepthBrush::onAfterDraw, this));
|
_customCommand.setAfterCallback(AX_CALLBACK_0(CameraBackgroundDepthBrush::onAfterDraw, this));
|
||||||
|
|
||||||
initBuffer();
|
initBuffer();
|
||||||
return true;
|
return true;
|
||||||
|
@ -273,7 +273,7 @@ CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& co
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -284,11 +284,11 @@ CameraBackgroundSkyBoxBrush::CameraBackgroundSkyBoxBrush()
|
||||||
: _texture(nullptr)
|
: _texture(nullptr)
|
||||||
, _actived(true)
|
, _actived(true)
|
||||||
, _textureValid(true)
|
, _textureValid(true)
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
, _backToForegroundListener(nullptr)
|
, _backToForegroundListener(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
_backToForegroundListener =
|
_backToForegroundListener =
|
||||||
EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { initBuffer(); });
|
EventListenerCustom::create(EVENT_RENDERER_RECREATED, [this](EventCustom*) { initBuffer(); });
|
||||||
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
Director::getInstance()->getEventDispatcher()->addEventListenerWithFixedPriority(_backToForegroundListener, -1);
|
||||||
|
@ -297,8 +297,8 @@ CameraBackgroundSkyBoxBrush::CameraBackgroundSkyBoxBrush()
|
||||||
|
|
||||||
CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush()
|
CameraBackgroundSkyBoxBrush::~CameraBackgroundSkyBoxBrush()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
|
Director::getInstance()->getEventDispatcher()->removeEventListener(_backToForegroundListener);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -333,8 +333,8 @@ CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create(std::string_vie
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(texture);
|
AX_SAFE_DELETE(texture);
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -386,16 +386,16 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
|
||||||
|
|
||||||
renderer->popGroup();
|
renderer->popGroup();
|
||||||
|
|
||||||
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
|
AX_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CameraBackgroundSkyBoxBrush::init()
|
bool CameraBackgroundSkyBoxBrush::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
_customCommand.setBeforeCallback(CC_CALLBACK_0(CameraBackgroundSkyBoxBrush::onBeforeDraw, this));
|
_customCommand.setBeforeCallback(AX_CALLBACK_0(CameraBackgroundSkyBoxBrush::onBeforeDraw, this));
|
||||||
_customCommand.setAfterCallback(CC_CALLBACK_0(CameraBackgroundSkyBoxBrush::onAfterDraw, this));
|
_customCommand.setAfterCallback(AX_CALLBACK_0(CameraBackgroundSkyBoxBrush::onAfterDraw, this));
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(_programState);
|
AX_SAFE_RELEASE_NULL(_programState);
|
||||||
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::SKYBOX_3D);
|
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::SKYBOX_3D);
|
||||||
_programState = new backend::ProgramState(program);
|
_programState = new backend::ProgramState(program);
|
||||||
_uniformColorLoc = _programState->getUniformLocation("u_color");
|
_uniformColorLoc = _programState->getUniformLocation("u_color");
|
||||||
|
@ -444,8 +444,8 @@ void CameraBackgroundSkyBoxBrush::initBuffer()
|
||||||
|
|
||||||
void CameraBackgroundSkyBoxBrush::setTexture(TextureCube* texture)
|
void CameraBackgroundSkyBoxBrush::setTexture(TextureCube* texture)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(texture);
|
AX_SAFE_RETAIN(texture);
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
_texture = texture;
|
_texture = texture;
|
||||||
_programState->setTexture(_uniformEnvLoc, 0, _texture->getBackendTexture());
|
_programState->setTexture(_uniformEnvLoc, 0, _texture->getBackendTexture());
|
||||||
}
|
}
|
||||||
|
|
|
@ -54,7 +54,7 @@ class Buffer;
|
||||||
* background with given color and depth, Skybox brush clear the background with a skybox. Camera uses depth brush by
|
* background with given color and depth, Skybox brush clear the background with a skybox. Camera uses depth brush by
|
||||||
* default.
|
* default.
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackgroundBrush : public Ref
|
class AX_DLL CameraBackgroundBrush : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -130,7 +130,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Depth brush clear depth buffer with given depth
|
* Depth brush clear depth buffer with given depth
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
|
class AX_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +167,7 @@ private:
|
||||||
void onAfterDraw();
|
void onAfterDraw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
EventListenerCustom* _backToForegroundListener;
|
EventListenerCustom* _backToForegroundListener;
|
||||||
#endif
|
#endif
|
||||||
void initBuffer();
|
void initBuffer();
|
||||||
|
@ -191,7 +191,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
* Color brush clear buffer with given depth and color
|
* Color brush clear buffer with given depth and color
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
|
class AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -235,7 +235,7 @@ class EventListenerCustom;
|
||||||
/**
|
/**
|
||||||
* Skybox brush clear buffer with a skybox
|
* Skybox brush clear buffer with a skybox
|
||||||
*/
|
*/
|
||||||
class CC_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
|
class AX_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -298,7 +298,7 @@ protected:
|
||||||
|
|
||||||
TextureCube* _texture;
|
TextureCube* _texture;
|
||||||
|
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
EventListenerCustom* _backToForegroundListener;
|
EventListenerCustom* _backToForegroundListener;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ ClippingNode::~ClippingNode()
|
||||||
_stencil->stopAllActions();
|
_stencil->stopAllActions();
|
||||||
_stencil->release();
|
_stencil->release();
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(_stencilStateManager);
|
AX_SAFE_DELETE(_stencilStateManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingNode* ClippingNode::create()
|
ClippingNode* ClippingNode::create()
|
||||||
|
@ -55,7 +55,7 @@ ClippingNode* ClippingNode::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -70,7 +70,7 @@ ClippingNode* ClippingNode::create(Node* pStencil)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -97,7 +97,7 @@ void ClippingNode::onEnter()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOG("ClippingNode warning: _stencil is nil.");
|
AXLOG("ClippingNode warning: _stencil is nil.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -141,7 +141,7 @@ void ClippingNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
// To ease the migration to v3.0, we still support the Mat4 stack,
|
// To ease the migration to v3.0, we still support the Mat4 stack,
|
||||||
// but it is deprecated and your code should not rely on it
|
// but it is deprecated and your code should not rely on it
|
||||||
CCASSERT(nullptr != _director, "Director is null when setting matrix stack");
|
AXASSERT(nullptr != _director, "Director is null when setting matrix stack");
|
||||||
_director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
_director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
|
||||||
_director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
_director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);
|
||||||
|
|
||||||
|
@ -153,7 +153,7 @@ void ClippingNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32
|
||||||
renderer->pushGroup(_groupCommandStencil.getRenderQueueID());
|
renderer->pushGroup(_groupCommandStencil.getRenderQueueID());
|
||||||
|
|
||||||
// _beforeVisitCmd.init(_globalZOrder);
|
// _beforeVisitCmd.init(_globalZOrder);
|
||||||
// _beforeVisitCmd.func = CC_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencilStateManager);
|
// _beforeVisitCmd.func = AX_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencilStateManager);
|
||||||
// renderer->addCommand(&_beforeVisitCmd);
|
// renderer->addCommand(&_beforeVisitCmd);
|
||||||
_stencilStateManager->onBeforeVisit(_globalZOrder);
|
_stencilStateManager->onBeforeVisit(_globalZOrder);
|
||||||
|
|
||||||
|
@ -166,14 +166,14 @@ void ClippingNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32
|
||||||
programState->setUniform(alphaLocation, &alphaThreshold, sizeof(alphaThreshold));
|
programState->setUniform(alphaLocation, &alphaThreshold, sizeof(alphaThreshold));
|
||||||
setProgramStateRecursively(_stencil, programState);
|
setProgramStateRecursively(_stencil, programState);
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(programState);
|
AX_SAFE_RELEASE_NULL(programState);
|
||||||
}
|
}
|
||||||
_stencil->visit(renderer, _modelViewTransform, flags);
|
_stencil->visit(renderer, _modelViewTransform, flags);
|
||||||
|
|
||||||
|
|
||||||
auto afterDrawStencilCmd = renderer->nextCallbackCommand();
|
auto afterDrawStencilCmd = renderer->nextCallbackCommand();
|
||||||
afterDrawStencilCmd->init(_globalZOrder);
|
afterDrawStencilCmd->init(_globalZOrder);
|
||||||
afterDrawStencilCmd->func = CC_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencilStateManager);
|
afterDrawStencilCmd->func = AX_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencilStateManager);
|
||||||
renderer->addCommand(afterDrawStencilCmd);
|
renderer->addCommand(afterDrawStencilCmd);
|
||||||
|
|
||||||
bool visibleByCamera = isVisitableByVisitingCamera();
|
bool visibleByCamera = isVisitableByVisitingCamera();
|
||||||
|
@ -215,7 +215,7 @@ void ClippingNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32
|
||||||
|
|
||||||
auto _afterVisitCmd = renderer->nextCallbackCommand();
|
auto _afterVisitCmd = renderer->nextCallbackCommand();
|
||||||
_afterVisitCmd->init(_globalZOrder);
|
_afterVisitCmd->init(_globalZOrder);
|
||||||
_afterVisitCmd->func = CC_CALLBACK_0(StencilStateManager::onAfterVisit, _stencilStateManager);
|
_afterVisitCmd->func = AX_CALLBACK_0(StencilStateManager::onAfterVisit, _stencilStateManager);
|
||||||
renderer->addCommand(_afterVisitCmd);
|
renderer->addCommand(_afterVisitCmd);
|
||||||
|
|
||||||
renderer->popGroup();
|
renderer->popGroup();
|
||||||
|
@ -242,7 +242,7 @@ void ClippingNode::setStencil(Node* stencil)
|
||||||
if (_stencil == stencil)
|
if (_stencil == stencil)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -251,7 +251,7 @@ void ClippingNode::setStencil(Node* stencil)
|
||||||
if (stencil)
|
if (stencil)
|
||||||
sEngine->retainScriptObject(this, stencil);
|
sEngine->retainScriptObject(this, stencil);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
|
|
||||||
// cleanup current stencil
|
// cleanup current stencil
|
||||||
if (_stencil != nullptr && _stencil->isRunning())
|
if (_stencil != nullptr && _stencil->isRunning())
|
||||||
|
@ -259,11 +259,11 @@ void ClippingNode::setStencil(Node* stencil)
|
||||||
_stencil->onExitTransitionDidStart();
|
_stencil->onExitTransitionDidStart();
|
||||||
_stencil->onExit();
|
_stencil->onExit();
|
||||||
}
|
}
|
||||||
CC_SAFE_RELEASE_NULL(_stencil);
|
AX_SAFE_RELEASE_NULL(_stencil);
|
||||||
|
|
||||||
// initialise new stencil
|
// initialise new stencil
|
||||||
_stencil = stencil;
|
_stencil = stencil;
|
||||||
CC_SAFE_RETAIN(_stencil);
|
AX_SAFE_RETAIN(_stencil);
|
||||||
if (_stencil != nullptr && this->isRunning())
|
if (_stencil != nullptr && this->isRunning())
|
||||||
{
|
{
|
||||||
_stencil->onEnter();
|
_stencil->onEnter();
|
||||||
|
|
|
@ -44,7 +44,7 @@ class StencilStateManager;
|
||||||
* The stencil is an other Node that will not be drawn.
|
* The stencil is an other Node that will not be drawn.
|
||||||
* The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).
|
* The clipping is done using the alpha part of the stencil (adjusted with an alphaThreshold).
|
||||||
*/
|
*/
|
||||||
class CC_DLL ClippingNode : public Node
|
class AX_DLL ClippingNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates and initializes a clipping node without a stencil.
|
/** Creates and initializes a clipping node without a stencil.
|
||||||
|
@ -166,7 +166,7 @@ protected:
|
||||||
std::unordered_map<Node*, backend::ProgramState*> _originalStencilProgramState;
|
std::unordered_map<Node*, backend::ProgramState*> _originalStencilProgramState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
AX_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
||||||
};
|
};
|
||||||
/** @} */
|
/** @} */
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
|
@ -38,7 +38,7 @@ ClippingRectangleNode* ClippingRectangleNode::create(const Rect& clippingRegion)
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CC_SAFE_DELETE(node);
|
AX_SAFE_DELETE(node);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -49,7 +49,7 @@ ClippingRectangleNode* ClippingRectangleNode::create()
|
||||||
if (node->init())
|
if (node->init())
|
||||||
node->autorelease();
|
node->autorelease();
|
||||||
else
|
else
|
||||||
CC_SAFE_DELETE(node);
|
AX_SAFE_DELETE(node);
|
||||||
|
|
||||||
return node;
|
return node;
|
||||||
}
|
}
|
||||||
|
@ -94,14 +94,14 @@ void ClippingRectangleNode::visit(Renderer* renderer, const Mat4& parentTransfor
|
||||||
{
|
{
|
||||||
auto beforeVisitCmdScissor = renderer->nextCallbackCommand();
|
auto beforeVisitCmdScissor = renderer->nextCallbackCommand();
|
||||||
beforeVisitCmdScissor->init(_globalZOrder);
|
beforeVisitCmdScissor->init(_globalZOrder);
|
||||||
beforeVisitCmdScissor->func = CC_CALLBACK_0(ClippingRectangleNode::onBeforeVisitScissor, this);
|
beforeVisitCmdScissor->func = AX_CALLBACK_0(ClippingRectangleNode::onBeforeVisitScissor, this);
|
||||||
renderer->addCommand(beforeVisitCmdScissor);
|
renderer->addCommand(beforeVisitCmdScissor);
|
||||||
|
|
||||||
Node::visit(renderer, parentTransform, parentFlags);
|
Node::visit(renderer, parentTransform, parentFlags);
|
||||||
|
|
||||||
auto afterVisitCmdScissor = renderer->nextCallbackCommand();
|
auto afterVisitCmdScissor = renderer->nextCallbackCommand();
|
||||||
afterVisitCmdScissor->init(_globalZOrder);
|
afterVisitCmdScissor->init(_globalZOrder);
|
||||||
afterVisitCmdScissor->func = CC_CALLBACK_0(ClippingRectangleNode::onAfterVisitScissor, this);
|
afterVisitCmdScissor->func = AX_CALLBACK_0(ClippingRectangleNode::onAfterVisitScissor, this);
|
||||||
renderer->addCommand(afterVisitCmdScissor);
|
renderer->addCommand(afterVisitCmdScissor);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ NS_AX_BEGIN
|
||||||
The region of ClippingRectangleNode doesn't support any transform except scale.
|
The region of ClippingRectangleNode doesn't support any transform except scale.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL ClippingRectangleNode : public Node
|
class AX_DLL ClippingRectangleNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ Component* Component::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
|
|
@ -23,8 +23,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __CC_FRAMEWORK_COMPONENT_H__
|
#ifndef __AX_FRAMEWORK_COMPONENT_H__
|
||||||
#define __CC_FRAMEWORK_COMPONENT_H__
|
#define __AX_FRAMEWORK_COMPONENT_H__
|
||||||
|
|
||||||
/// @cond DO_NOT_SHOW
|
/// @cond DO_NOT_SHOW
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -44,7 +44,7 @@ enum
|
||||||
kComponentOnUpdate
|
kComponentOnUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL Component : public Ref
|
class AX_DLL Component : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Component* create();
|
static Component* create();
|
||||||
|
@ -88,4 +88,4 @@ protected:
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
#endif // __CC_FRAMEWORK_COMPONENT_H__
|
#endif // __AX_FRAMEWORK_COMPONENT_H__
|
||||||
|
|
|
@ -49,15 +49,15 @@ Component* ComponentContainer::get(std::string_view name) const
|
||||||
bool ComponentContainer::add(Component* com)
|
bool ComponentContainer::add(Component* com)
|
||||||
{
|
{
|
||||||
bool ret = false;
|
bool ret = false;
|
||||||
CCASSERT(com != nullptr, "Component must be non-nil");
|
AXASSERT(com != nullptr, "Component must be non-nil");
|
||||||
CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
|
AXASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
auto componentName = com->getName();
|
auto componentName = com->getName();
|
||||||
|
|
||||||
if (_componentMap.find(componentName) != _componentMap.end())
|
if (_componentMap.find(componentName) != _componentMap.end())
|
||||||
{
|
{
|
||||||
CCASSERT(false, "ComponentContainer already have this kind of component");
|
AXASSERT(false, "ComponentContainer already have this kind of component");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
hlookup::set_item(_componentMap, componentName, com); //_componentMap[componentName] = com;
|
hlookup::set_item(_componentMap, componentName, com); //_componentMap[componentName] = com;
|
||||||
|
@ -76,7 +76,7 @@ bool ComponentContainer::remove(std::string_view componentName)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
auto iter = _componentMap.find(componentName);
|
auto iter = _componentMap.find(componentName);
|
||||||
CC_BREAK_IF(iter == _componentMap.end());
|
AX_BREAK_IF(iter == _componentMap.end());
|
||||||
|
|
||||||
auto component = iter->second;
|
auto component = iter->second;
|
||||||
_componentMap.erase(componentName);
|
_componentMap.erase(componentName);
|
||||||
|
@ -116,12 +116,12 @@ void ComponentContainer::visit(float delta)
|
||||||
{
|
{
|
||||||
if (!_componentMap.empty())
|
if (!_componentMap.empty())
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(_owner);
|
AX_SAFE_RETAIN(_owner);
|
||||||
for (auto& iter : _componentMap)
|
for (auto& iter : _componentMap)
|
||||||
{
|
{
|
||||||
iter.second->update(delta);
|
iter.second->update(delta);
|
||||||
}
|
}
|
||||||
CC_SAFE_RELEASE(_owner);
|
AX_SAFE_RELEASE(_owner);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,8 +23,8 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
THE SOFTWARE.
|
THE SOFTWARE.
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#ifndef __CC_FRAMEWORK_COMCONTAINER_H__
|
#ifndef __AX_FRAMEWORK_COMCONTAINER_H__
|
||||||
#define __CC_FRAMEWORK_COMCONTAINER_H__
|
#define __AX_FRAMEWORK_COMCONTAINER_H__
|
||||||
|
|
||||||
/// @cond DO_NOT_SHOW
|
/// @cond DO_NOT_SHOW
|
||||||
|
|
||||||
|
@ -36,7 +36,7 @@ NS_AX_BEGIN
|
||||||
class Component;
|
class Component;
|
||||||
class Node;
|
class Node;
|
||||||
|
|
||||||
class CC_DLL ComponentContainer
|
class AX_DLL ComponentContainer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -77,4 +77,4 @@ private:
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
#endif // __CC_FRAMEWORK_COMCONTAINER_H__
|
#endif // __AX_FRAMEWORK_COMCONTAINER_H__
|
||||||
|
|
|
@ -49,7 +49,7 @@ static inline Tex2F v2ToTex2F(const Vec2& v)
|
||||||
DrawNode::DrawNode(float lineWidth) : _lineWidth(lineWidth), _defaultLineWidth(lineWidth)
|
DrawNode::DrawNode(float lineWidth) : _lineWidth(lineWidth), _defaultLineWidth(lineWidth)
|
||||||
{
|
{
|
||||||
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
// TODO new-renderer: interface setupBuffer removal
|
// TODO new-renderer: interface setupBuffer removal
|
||||||
|
|
||||||
// Need to listen the event only when not use batchnode, because it will use VBO
|
// Need to listen the event only when not use batchnode, because it will use VBO
|
||||||
|
@ -64,9 +64,9 @@ DrawNode::DrawNode(float lineWidth) : _lineWidth(lineWidth), _defaultLineWidth(l
|
||||||
|
|
||||||
DrawNode::~DrawNode()
|
DrawNode::~DrawNode()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_bufferTriangle);
|
AX_SAFE_FREE(_bufferTriangle);
|
||||||
CC_SAFE_FREE(_bufferPoint);
|
AX_SAFE_FREE(_bufferPoint);
|
||||||
CC_SAFE_FREE(_bufferLine);
|
AX_SAFE_FREE(_bufferLine);
|
||||||
|
|
||||||
freeShaderInternal(_customCommandTriangle);
|
freeShaderInternal(_customCommandTriangle);
|
||||||
freeShaderInternal(_customCommandPoint);
|
freeShaderInternal(_customCommandPoint);
|
||||||
|
@ -82,7 +82,7 @@ DrawNode* DrawNode::create(float defaultLineWidth)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -90,7 +90,7 @@ DrawNode* DrawNode::create(float defaultLineWidth)
|
||||||
|
|
||||||
void DrawNode::ensureCapacity(int count)
|
void DrawNode::ensureCapacity(int count)
|
||||||
{
|
{
|
||||||
CCASSERT(count >= 0, "capacity must be >= 0");
|
AXASSERT(count >= 0, "capacity must be >= 0");
|
||||||
|
|
||||||
if (_bufferCountTriangle + count > _bufferCapacityTriangle)
|
if (_bufferCountTriangle + count > _bufferCapacityTriangle)
|
||||||
{
|
{
|
||||||
|
@ -105,7 +105,7 @@ void DrawNode::ensureCapacity(int count)
|
||||||
|
|
||||||
void DrawNode::ensureCapacityGLPoint(int count)
|
void DrawNode::ensureCapacityGLPoint(int count)
|
||||||
{
|
{
|
||||||
CCASSERT(count >= 0, "capacity must be >= 0");
|
AXASSERT(count >= 0, "capacity must be >= 0");
|
||||||
|
|
||||||
if (_bufferCountPoint + count > _bufferCapacityPoint)
|
if (_bufferCountPoint + count > _bufferCapacityPoint)
|
||||||
{
|
{
|
||||||
|
@ -120,7 +120,7 @@ void DrawNode::ensureCapacityGLPoint(int count)
|
||||||
|
|
||||||
void DrawNode::ensureCapacityGLLine(int count)
|
void DrawNode::ensureCapacityGLLine(int count)
|
||||||
{
|
{
|
||||||
CCASSERT(count >= 0, "capacity must be >= 0");
|
AXASSERT(count >= 0, "capacity must be >= 0");
|
||||||
|
|
||||||
if (_bufferCountLine + count > _bufferCapacityLine)
|
if (_bufferCountLine + count > _bufferCapacityLine)
|
||||||
{
|
{
|
||||||
|
@ -166,7 +166,7 @@ void DrawNode::updateShaderInternal(CustomCommand& cmd,
|
||||||
CustomCommand::PrimitiveType primitiveType)
|
CustomCommand::PrimitiveType primitiveType)
|
||||||
{
|
{
|
||||||
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
|
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
|
||||||
CC_SAFE_RELEASE(pipelinePS);
|
AX_SAFE_RELEASE(pipelinePS);
|
||||||
|
|
||||||
auto program = backend::Program::getBuiltinProgram(programType);
|
auto program = backend::Program::getBuiltinProgram(programType);
|
||||||
pipelinePS = new backend::ProgramState(program);
|
pipelinePS = new backend::ProgramState(program);
|
||||||
|
@ -178,7 +178,7 @@ void DrawNode::updateShaderInternal(CustomCommand& cmd,
|
||||||
void DrawNode::freeShaderInternal(CustomCommand& cmd)
|
void DrawNode::freeShaderInternal(CustomCommand& cmd)
|
||||||
{
|
{
|
||||||
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
|
auto& pipelinePS = cmd.getPipelineDescriptor().programState;
|
||||||
CC_SAFE_RELEASE_NULL(pipelinePS);
|
AX_SAFE_RELEASE_NULL(pipelinePS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::setVertexLayout(CustomCommand& cmd)
|
void DrawNode::setVertexLayout(CustomCommand& cmd)
|
||||||
|
@ -605,7 +605,7 @@ void DrawNode::drawPolygon(const Vec2* verts,
|
||||||
float borderWidth,
|
float borderWidth,
|
||||||
const Color4B& borderColor)
|
const Color4B& borderColor)
|
||||||
{
|
{
|
||||||
CCASSERT(count >= 0, "invalid count value");
|
AXASSERT(count >= 0, "invalid count value");
|
||||||
|
|
||||||
bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f);
|
bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f);
|
||||||
|
|
||||||
|
|
|
@ -54,7 +54,7 @@ class PointArray;
|
||||||
* Faster than the "drawing primitives" since they draws everything in one single batch.
|
* Faster than the "drawing primitives" since they draws everything in one single batch.
|
||||||
* @since v2.1
|
* @since v2.1
|
||||||
*/
|
*/
|
||||||
class CC_DLL DrawNode : public Node
|
class AX_DLL DrawNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** creates and initialize a DrawNode node.
|
/** creates and initialize a DrawNode node.
|
||||||
|
@ -412,7 +412,7 @@ protected:
|
||||||
axis::any_buffer _abuf;
|
axis::any_buffer _abuf;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
AX_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
||||||
};
|
};
|
||||||
/** @} */
|
/** @} */
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
|
@ -65,7 +65,7 @@ FastTMXLayer* FastTMXLayer::create(TMXTilesetInfo* tilesetInfo, TMXLayerInfo* la
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo* tilesetInfo, TMXLayerInfo
|
||||||
|
|
||||||
// tilesetInfo
|
// tilesetInfo
|
||||||
_tileSet = tilesetInfo;
|
_tileSet = tilesetInfo;
|
||||||
CC_SAFE_RETAIN(_tileSet);
|
AX_SAFE_RETAIN(_tileSet);
|
||||||
|
|
||||||
// mapInfo
|
// mapInfo
|
||||||
_mapTileSize = mapInfo->getTileSize();
|
_mapTileSize = mapInfo->getTileSize();
|
||||||
|
@ -98,10 +98,10 @@ bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo* tilesetInfo, TMXLayerInfo
|
||||||
|
|
||||||
// offset (after layer orientation is set);
|
// offset (after layer orientation is set);
|
||||||
Vec2 offset = this->calculateLayerOffset(layerInfo->_offset);
|
Vec2 offset = this->calculateLayerOffset(layerInfo->_offset);
|
||||||
this->setPosition(CC_POINT_PIXELS_TO_POINTS(offset));
|
this->setPosition(AX_POINT_PIXELS_TO_POINTS(offset));
|
||||||
|
|
||||||
this->setContentSize(
|
this->setContentSize(
|
||||||
CC_SIZE_PIXELS_TO_POINTS(Vec2(_layerSize.width * _mapTileSize.width, _layerSize.height * _mapTileSize.height)));
|
AX_SIZE_PIXELS_TO_POINTS(Vec2(_layerSize.width * _mapTileSize.width, _layerSize.height * _mapTileSize.height)));
|
||||||
|
|
||||||
this->tileToNodeTransform();
|
this->tileToNodeTransform();
|
||||||
|
|
||||||
|
@ -115,15 +115,15 @@ FastTMXLayer::FastTMXLayer() {}
|
||||||
|
|
||||||
FastTMXLayer::~FastTMXLayer()
|
FastTMXLayer::~FastTMXLayer()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_tileSet);
|
AX_SAFE_RELEASE(_tileSet);
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
CC_SAFE_FREE(_tiles);
|
AX_SAFE_FREE(_tiles);
|
||||||
CC_SAFE_RELEASE(_vertexBuffer);
|
AX_SAFE_RELEASE(_vertexBuffer);
|
||||||
CC_SAFE_RELEASE(_indexBuffer);
|
AX_SAFE_RELEASE(_indexBuffer);
|
||||||
|
|
||||||
for (auto& e : _customCommands)
|
for (auto& e : _customCommands)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(e.second->getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE(e.second->getPipelineDescriptor().programState);
|
||||||
delete e.second;
|
delete e.second;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,8 +167,8 @@ void FastTMXLayer::draw(Renderer* renderer, const Mat4& transform, uint32_t flag
|
||||||
void FastTMXLayer::updateTiles(const Rect& culledRect)
|
void FastTMXLayer::updateTiles(const Rect& culledRect)
|
||||||
{
|
{
|
||||||
Rect visibleTiles = Rect(culledRect.origin, culledRect.size * _director->getContentScaleFactor());
|
Rect visibleTiles = Rect(culledRect.origin, culledRect.size * _director->getContentScaleFactor());
|
||||||
Vec2 mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize);
|
Vec2 mapTileSize = AX_SIZE_PIXELS_TO_POINTS(_mapTileSize);
|
||||||
Vec2 tileSize = CC_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
Vec2 tileSize = AX_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
||||||
Mat4 nodeToTileTransform = _tileToNodeTransform.getInversed();
|
Mat4 nodeToTileTransform = _tileToNodeTransform.getInversed();
|
||||||
// transform to tile
|
// transform to tile
|
||||||
visibleTiles = RectApplyTransform(visibleTiles, nodeToTileTransform);
|
visibleTiles = RectApplyTransform(visibleTiles, nodeToTileTransform);
|
||||||
|
@ -211,7 +211,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// do nothing, do not support
|
// do nothing, do not support
|
||||||
// CCASSERT(0, "TMX invalid value");
|
// AXASSERT(0, "TMX invalid value");
|
||||||
}
|
}
|
||||||
|
|
||||||
_indicesVertexZNumber.clear();
|
_indicesVertexZNumber.clear();
|
||||||
|
@ -275,7 +275,7 @@ void FastTMXLayer::updateVertexBuffer()
|
||||||
|
|
||||||
void FastTMXLayer::updateIndexBuffer()
|
void FastTMXLayer::updateIndexBuffer()
|
||||||
{
|
{
|
||||||
#ifdef CC_FAST_TILEMAP_32_BIT_INDICES
|
#ifdef AX_FAST_TILEMAP_32_BIT_INDICES
|
||||||
unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned int) * _indices.size());
|
unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned int) * _indices.size());
|
||||||
#else
|
#else
|
||||||
unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned short) * _indices.size());
|
unsigned int indexBufferSize = (unsigned int)(sizeof(unsigned short) * _indices.size());
|
||||||
|
@ -321,7 +321,7 @@ void FastTMXLayer::setupTiles()
|
||||||
break;
|
break;
|
||||||
case FAST_TMX_ORIENTATION_HEX:
|
case FAST_TMX_ORIENTATION_HEX:
|
||||||
default:
|
default:
|
||||||
CCLOGERROR("FastTMX does not support type %d", _layerOrientation);
|
AXLOGERROR("FastTMX does not support type %d", _layerOrientation);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -384,8 +384,8 @@ void FastTMXLayer::setupTiles()
|
||||||
|
|
||||||
Mat4 FastTMXLayer::tileToNodeTransform()
|
Mat4 FastTMXLayer::tileToNodeTransform()
|
||||||
{
|
{
|
||||||
float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR();
|
float w = _mapTileSize.width / AX_CONTENT_SCALE_FACTOR();
|
||||||
float h = _mapTileSize.height / CC_CONTENT_SCALE_FACTOR();
|
float h = _mapTileSize.height / AX_CONTENT_SCALE_FACTOR();
|
||||||
float offY = (_layerSize.height - 1) * h;
|
float offY = (_layerSize.height - 1) * h;
|
||||||
|
|
||||||
switch (_layerOrientation)
|
switch (_layerOrientation)
|
||||||
|
@ -432,7 +432,7 @@ void FastTMXLayer::updatePrimitives()
|
||||||
command->setVertexBuffer(_vertexBuffer);
|
command->setVertexBuffer(_vertexBuffer);
|
||||||
|
|
||||||
CustomCommand::IndexFormat indexFormat = CustomCommand::IndexFormat::U_SHORT;
|
CustomCommand::IndexFormat indexFormat = CustomCommand::IndexFormat::U_SHORT;
|
||||||
#if CC_FAST_TILEMAP_32_BIT_INDICES
|
#if AX_FAST_TILEMAP_32_BIT_INDICES
|
||||||
indexFormat = CustomCommand::IndexFormat::U_INT;
|
indexFormat = CustomCommand::IndexFormat::U_INT;
|
||||||
#endif
|
#endif
|
||||||
command->setIndexBuffer(_indexBuffer, indexFormat);
|
command->setIndexBuffer(_indexBuffer, indexFormat);
|
||||||
|
@ -443,7 +443,7 @@ void FastTMXLayer::updatePrimitives()
|
||||||
|
|
||||||
if (_useAutomaticVertexZ)
|
if (_useAutomaticVertexZ)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(pipelineDescriptor.programState);
|
AX_SAFE_RELEASE(pipelineDescriptor.programState);
|
||||||
auto* program =
|
auto* program =
|
||||||
backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR_ALPHA_TEST);
|
backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR_ALPHA_TEST);
|
||||||
auto programState = new backend::ProgramState(program);
|
auto programState = new backend::ProgramState(program);
|
||||||
|
@ -454,7 +454,7 @@ void FastTMXLayer::updatePrimitives()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(pipelineDescriptor.programState);
|
AX_SAFE_RELEASE(pipelineDescriptor.programState);
|
||||||
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR);
|
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR);
|
||||||
auto programState = new backend::ProgramState(program);
|
auto programState = new backend::ProgramState(program);
|
||||||
pipelineDescriptor.programState = programState;
|
pipelineDescriptor.programState = programState;
|
||||||
|
@ -504,7 +504,7 @@ void FastTMXLayer::updateTotalQuads()
|
||||||
{
|
{
|
||||||
if (_quadsDirty)
|
if (_quadsDirty)
|
||||||
{
|
{
|
||||||
Vec2 tileSize = CC_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
Vec2 tileSize = AX_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
||||||
Vec2 texSize = _tileSet->_imageSize;
|
Vec2 texSize = _tileSet->_imageSize;
|
||||||
_tileToQuadIndex.clear();
|
_tileToQuadIndex.clear();
|
||||||
_totalQuads.resize(int(_layerSize.width * _layerSize.height));
|
_totalQuads.resize(int(_layerSize.width * _layerSize.height));
|
||||||
|
@ -647,10 +647,10 @@ void FastTMXLayer::updateTotalQuads()
|
||||||
// removing / getting tiles
|
// removing / getting tiles
|
||||||
Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
||||||
{
|
{
|
||||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
||||||
tileCoordinate.y >= 0,
|
tileCoordinate.y >= 0,
|
||||||
"TMXLayer: invalid position");
|
"TMXLayer: invalid position");
|
||||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||||
|
|
||||||
Sprite* tile = nullptr;
|
Sprite* tile = nullptr;
|
||||||
int gid = this->getTileGIDAt(tileCoordinate);
|
int gid = this->getTileGIDAt(tileCoordinate);
|
||||||
|
@ -669,7 +669,7 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
||||||
{
|
{
|
||||||
// tile not created yet. create it
|
// tile not created yet. create it
|
||||||
Rect rect = _tileSet->getRectForGID(gid);
|
Rect rect = _tileSet->getRectForGID(gid);
|
||||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
rect = AX_RECT_PIXELS_TO_POINTS(rect);
|
||||||
tile = Sprite::createWithTexture(_texture, rect);
|
tile = Sprite::createWithTexture(_texture, rect);
|
||||||
|
|
||||||
Vec2 p = this->getPositionAt(tileCoordinate);
|
Vec2 p = this->getPositionAt(tileCoordinate);
|
||||||
|
@ -690,10 +690,10 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
|
||||||
|
|
||||||
int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags /* = nullptr*/)
|
int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags /* = nullptr*/)
|
||||||
{
|
{
|
||||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
||||||
tileCoordinate.y >= 0,
|
tileCoordinate.y >= 0,
|
||||||
"TMXLayer: invalid position");
|
"TMXLayer: invalid position");
|
||||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||||
|
|
||||||
int idx = static_cast<int>(((int)tileCoordinate.x + (int)tileCoordinate.y * _layerSize.width));
|
int idx = static_cast<int>(((int)tileCoordinate.x + (int)tileCoordinate.y * _layerSize.width));
|
||||||
|
|
||||||
|
@ -737,10 +737,10 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
|
||||||
ret = static_cast<int>(-(_layerSize.height - pos.y));
|
ret = static_cast<int>(-(_layerSize.height - pos.y));
|
||||||
break;
|
break;
|
||||||
case FAST_TMX_ORIENTATION_HEX:
|
case FAST_TMX_ORIENTATION_HEX:
|
||||||
CCASSERT(0, "TMX Hexa vertexZ not supported");
|
AXASSERT(0, "TMX Hexa vertexZ not supported");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
CCASSERT(0, "TMX invalid value");
|
AXASSERT(0, "TMX invalid value");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -755,7 +755,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
|
||||||
void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
|
||||||
{
|
{
|
||||||
|
|
||||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
||||||
tileCoordinate.y >= 0,
|
tileCoordinate.y >= 0,
|
||||||
"TMXLayer: invalid position");
|
"TMXLayer: invalid position");
|
||||||
|
|
||||||
|
@ -842,7 +842,7 @@ Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
|
||||||
break;
|
break;
|
||||||
case FAST_TMX_ORIENTATION_HEX:
|
case FAST_TMX_ORIENTATION_HEX:
|
||||||
default:
|
default:
|
||||||
CCASSERT(pos.isZero(), "offset for this map not implemented yet");
|
AXASSERT(pos.isZero(), "offset for this map not implemented yet");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -856,11 +856,11 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
|
||||||
|
|
||||||
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
|
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
|
||||||
{
|
{
|
||||||
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
|
||||||
tileCoordinate.y >= 0,
|
tileCoordinate.y >= 0,
|
||||||
"TMXLayer: invalid position");
|
"TMXLayer: invalid position");
|
||||||
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
|
||||||
CCASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid");
|
AXASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid");
|
||||||
|
|
||||||
TMXTileFlags currentFlags;
|
TMXTileFlags currentFlags;
|
||||||
int currentGID = getTileGIDAt(tileCoordinate, ¤tFlags);
|
int currentGID = getTileGIDAt(tileCoordinate, ¤tFlags);
|
||||||
|
@ -890,7 +890,7 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags
|
||||||
{
|
{
|
||||||
Sprite* sprite = it->second.first;
|
Sprite* sprite = it->second.first;
|
||||||
Rect rect = _tileSet->getRectForGID(gid);
|
Rect rect = _tileSet->getRectForGID(gid);
|
||||||
rect = CC_RECT_PIXELS_TO_POINTS(rect);
|
rect = AX_RECT_PIXELS_TO_POINTS(rect);
|
||||||
|
|
||||||
sprite->setTextureRect(rect, false, rect.size);
|
sprite->setTextureRect(rect, false, rect.size);
|
||||||
this->reorderChild(sprite, z);
|
this->reorderChild(sprite, z);
|
||||||
|
@ -1026,7 +1026,7 @@ TMXTileAnimTask::TMXTileAnimTask(FastTMXLayer* layer, TMXTileAnimInfo* animation
|
||||||
void TMXTileAnimTask::tickAndScheduleNext(float dt)
|
void TMXTileAnimTask::tickAndScheduleNext(float dt)
|
||||||
{
|
{
|
||||||
setCurrFrame();
|
setCurrFrame();
|
||||||
_layer->getParent()->scheduleOnce(CC_CALLBACK_1(TMXTileAnimTask::tickAndScheduleNext, this),
|
_layer->getParent()->scheduleOnce(AX_CALLBACK_1(TMXTileAnimTask::tickAndScheduleNext, this),
|
||||||
_animation->_frames[_currentFrame]._duration / 1000.0f, _key);
|
_animation->_frames[_currentFrame]._duration / 1000.0f, _key);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ class Buffer;
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CC_DLL FastTMXLayer : public Node
|
class AX_DLL FastTMXLayer : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Possible orientations of the TMX map */
|
/** Possible orientations of the TMX map */
|
||||||
|
@ -222,8 +222,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void setTileSet(TMXTilesetInfo* info)
|
void setTileSet(TMXTilesetInfo* info)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(info);
|
AX_SAFE_RETAIN(info);
|
||||||
CC_SAFE_RELEASE(_tileSet);
|
AX_SAFE_RELEASE(_tileSet);
|
||||||
_tileSet = info;
|
_tileSet = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -363,7 +363,7 @@ protected:
|
||||||
bool _quadsDirty = true;
|
bool _quadsDirty = true;
|
||||||
std::vector<int> _tileToQuadIndex;
|
std::vector<int> _tileToQuadIndex;
|
||||||
std::vector<V3F_C4B_T2F_Quad> _totalQuads;
|
std::vector<V3F_C4B_T2F_Quad> _totalQuads;
|
||||||
#ifdef CC_FAST_TILEMAP_32_BIT_INDICES
|
#ifdef AX_FAST_TILEMAP_32_BIT_INDICES
|
||||||
std::vector<unsigned int> _indices;
|
std::vector<unsigned int> _indices;
|
||||||
#else
|
#else
|
||||||
std::vector<unsigned short> _indices;
|
std::vector<unsigned short> _indices;
|
||||||
|
@ -386,7 +386,7 @@ protected:
|
||||||
/** @brief TMXTileAnimTask represents the frame-tick task of an animated tile.
|
/** @brief TMXTileAnimTask represents the frame-tick task of an animated tile.
|
||||||
* It is a assistant class for TMXTileAnimTicker.
|
* It is a assistant class for TMXTileAnimTicker.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TMXTileAnimTask : public Ref
|
class AX_DLL TMXTileAnimTask : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
TMXTileAnimTask(FastTMXLayer* layer, TMXTileAnimInfo* animation, const Vec2& tilePos);
|
TMXTileAnimTask(FastTMXLayer* layer, TMXTileAnimInfo* animation, const Vec2& tilePos);
|
||||||
|
@ -418,7 +418,7 @@ protected:
|
||||||
|
|
||||||
/** @brief TMXTileAnimManager controls all tile animation of a layer.
|
/** @brief TMXTileAnimManager controls all tile animation of a layer.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TMXTileAnimManager : public Ref
|
class AX_DLL TMXTileAnimManager : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static TMXTileAnimManager* create(FastTMXLayer* layer);
|
static TMXTileAnimManager* create(FastTMXLayer* layer);
|
||||||
|
|
|
@ -41,7 +41,7 @@ FastTMXTiledMap* FastTMXTiledMap::create(std::string_view tmxFile)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,13 +53,13 @@ FastTMXTiledMap* FastTMXTiledMap::createWithXML(std::string_view tmxString, std:
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
|
bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
|
||||||
{
|
{
|
||||||
CCASSERT(tmxFile.size() > 0, "FastTMXTiledMap: tmx file should not be empty");
|
AXASSERT(tmxFile.size() > 0, "FastTMXTiledMap: tmx file should not be empty");
|
||||||
|
|
||||||
setContentSize(Vec2::ZERO);
|
setContentSize(Vec2::ZERO);
|
||||||
|
|
||||||
|
@ -69,7 +69,7 @@ bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
CCASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
|
AXASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
|
||||||
buildWithMapInfo(mapInfo);
|
buildWithMapInfo(mapInfo);
|
||||||
|
|
||||||
_tmxFile = tmxFile;
|
_tmxFile = tmxFile;
|
||||||
|
@ -83,7 +83,7 @@ bool FastTMXTiledMap::initWithXML(std::string_view tmxString, std::string_view r
|
||||||
|
|
||||||
TMXMapInfo* mapInfo = TMXMapInfo::createWithXML(tmxString, resourcePath);
|
TMXMapInfo* mapInfo = TMXMapInfo::createWithXML(tmxString, resourcePath);
|
||||||
|
|
||||||
CCASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
|
AXASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
|
||||||
buildWithMapInfo(mapInfo);
|
buildWithMapInfo(mapInfo);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -148,7 +148,7 @@ TMXTilesetInfo* FastTMXTiledMap::tilesetForLayer(TMXLayerInfo* layerInfo, TMXMap
|
||||||
}
|
}
|
||||||
|
|
||||||
// If all the tiles are 0, return empty tileset
|
// If all the tiles are 0, return empty tileset
|
||||||
CCLOG("cocos2d: Warning: TMX Layer '%s' has no tiles", layerInfo->_name.c_str());
|
AXLOG("cocos2d: Warning: TMX Layer '%s' has no tiles", layerInfo->_name.c_str());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,7 +196,7 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
|
||||||
// public
|
// public
|
||||||
FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
|
FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
|
||||||
{
|
{
|
||||||
CCASSERT(!layerName.empty(), "Invalid layer name!");
|
AXASSERT(!layerName.empty(), "Invalid layer name!");
|
||||||
|
|
||||||
for (auto& child : _children)
|
for (auto& child : _children)
|
||||||
{
|
{
|
||||||
|
@ -216,7 +216,7 @@ FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
|
||||||
|
|
||||||
TMXObjectGroup* FastTMXTiledMap::getObjectGroup(std::string_view groupName) const
|
TMXObjectGroup* FastTMXTiledMap::getObjectGroup(std::string_view groupName) const
|
||||||
{
|
{
|
||||||
CCASSERT(!groupName.empty(), "Invalid group name!");
|
AXASSERT(!groupName.empty(), "Invalid group name!");
|
||||||
|
|
||||||
if (_objectGroups.size() > 0)
|
if (_objectGroups.size() > 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -94,7 +94,7 @@ class FastTMXLayer;
|
||||||
* @since v3.2
|
* @since v3.2
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL FastTMXTiledMap : public Node
|
class AX_DLL FastTMXTiledMap : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a TMX Tiled Map with a TMX file.
|
/** Creates a TMX Tiled Map with a TMX file.
|
||||||
|
@ -203,7 +203,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void setTileAnimEnabled(bool enabled);
|
void setTileAnimEnabled(bool enabled);
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE int getLayerNum() const { return getLayerCount(); }
|
AX_DEPRECATED_ATTRIBUTE int getLayerNum() const { return getLayerCount(); }
|
||||||
|
|
||||||
int getLayerCount() const { return _layerCount; }
|
int getLayerCount() const { return _layerCount; }
|
||||||
|
|
||||||
|
@ -249,7 +249,7 @@ protected:
|
||||||
std::string _tmxFile;
|
std::string _tmxFile;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(FastTMXTiledMap);
|
AX_DISALLOW_COPY_AND_ASSIGN(FastTMXTiledMap);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of tilemap_parallax_nodes group
|
// end of tilemap_parallax_nodes group
|
||||||
|
|
|
@ -38,7 +38,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
class FontAtlas;
|
class FontAtlas;
|
||||||
|
|
||||||
class CC_DLL Font : public Ref
|
class AX_DLL Font : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual FontAtlas* newFontAtlas() = 0;
|
virtual FontAtlas* newFontAtlas() = 0;
|
||||||
|
|
|
@ -26,8 +26,8 @@
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
#include "2d/CCFontAtlas.h"
|
#include "2d/CCFontAtlas.h"
|
||||||
#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
#if AX_TARGET_PLATFORM != AX_PLATFORM_WIN32 && AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID
|
||||||
#elif CC_TARGET_PLATFORM == CC_PLATFORM_ANDROID
|
#elif AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID
|
||||||
# include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
# include "platform/android/jni/Java_org_cocos2dx_lib_Cocos2dxHelper.h"
|
||||||
#endif
|
#endif
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -63,7 +63,7 @@ FontAtlas::FontAtlas(Font* theFont) : _font(theFont)
|
||||||
_pixelFormat = backend::PixelFormat::LA8;
|
_pixelFormat = backend::PixelFormat::LA8;
|
||||||
_currentPageDataSize = CacheTextureWidth * CacheTextureHeight << _strideShift;
|
_currentPageDataSize = CacheTextureWidth * CacheTextureHeight << _strideShift;
|
||||||
|
|
||||||
#if defined(CC_USE_METAL)
|
#if defined(AX_USE_METAL)
|
||||||
_currentPageDataSizeRGBA = CacheTextureWidth * CacheTextureHeight * 4;
|
_currentPageDataSizeRGBA = CacheTextureWidth * CacheTextureHeight * 4;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -81,11 +81,11 @@ FontAtlas::FontAtlas(Font* theFont) : _font(theFont)
|
||||||
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
|
_letterPadding += 2 * FontFreeType::DistanceMapSpread;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||||
|
|
||||||
_rendererRecreatedListener = EventListenerCustom::create(
|
_rendererRecreatedListener = EventListenerCustom::create(
|
||||||
EVENT_RENDERER_RECREATED, CC_CALLBACK_1(FontAtlas::listenRendererRecreated, this));
|
EVENT_RENDERER_RECREATED, AX_CALLBACK_1(FontAtlas::listenRendererRecreated, this));
|
||||||
eventDispatcher->addEventListenerWithFixedPriority(_rendererRecreatedListener, 1);
|
eventDispatcher->addEventListenerWithFixedPriority(_rendererRecreatedListener, 1);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ void FontAtlas::reinit()
|
||||||
_currentPageData = new uint8_t[_currentPageDataSize];
|
_currentPageData = new uint8_t[_currentPageDataSize];
|
||||||
_currentPage = -1;
|
_currentPage = -1;
|
||||||
|
|
||||||
#if defined(CC_USE_METAL)
|
#if defined(AX_USE_METAL)
|
||||||
if (_strideShift && !_currentPageDataRGBA)
|
if (_strideShift && !_currentPageDataRGBA)
|
||||||
_currentPageDataRGBA = new uint8_t[_currentPageDataSizeRGBA];
|
_currentPageDataRGBA = new uint8_t[_currentPageDataSizeRGBA];
|
||||||
#endif
|
#endif
|
||||||
|
@ -107,7 +107,7 @@ void FontAtlas::reinit()
|
||||||
|
|
||||||
FontAtlas::~FontAtlas()
|
FontAtlas::~FontAtlas()
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
if (_fontFreeType && _rendererRecreatedListener)
|
if (_fontFreeType && _rendererRecreatedListener)
|
||||||
{
|
{
|
||||||
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||||
|
@ -119,9 +119,9 @@ FontAtlas::~FontAtlas()
|
||||||
_font->release();
|
_font->release();
|
||||||
releaseTextures();
|
releaseTextures();
|
||||||
|
|
||||||
CC_SAFE_DELETE_ARRAY(_currentPageData);
|
AX_SAFE_DELETE_ARRAY(_currentPageData);
|
||||||
#if defined(CC_USE_METAL)
|
#if defined(AX_USE_METAL)
|
||||||
CC_SAFE_DELETE_ARRAY(_currentPageDataRGBA);
|
AX_SAFE_DELETE_ARRAY(_currentPageDataRGBA);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -234,7 +234,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
|
||||||
Rect tempRect;
|
Rect tempRect;
|
||||||
FontLetterDefinition tempDef;
|
FontLetterDefinition tempDef;
|
||||||
|
|
||||||
auto scaleFactor = CC_CONTENT_SCALE_FACTOR();
|
auto scaleFactor = AX_CONTENT_SCALE_FACTOR();
|
||||||
auto pixelFormat = _pixelFormat;
|
auto pixelFormat = _pixelFormat;
|
||||||
|
|
||||||
int startY = (int)_currentPageOrigY;
|
int startY = (int)_currentPageOrigY;
|
||||||
|
@ -309,7 +309,7 @@ bool FontAtlas::prepareLetterDefinitions(const std::u32string& utf32Text)
|
||||||
|
|
||||||
void FontAtlas::updateTextureContent(backend::PixelFormat format, int startY)
|
void FontAtlas::updateTextureContent(backend::PixelFormat format, int startY)
|
||||||
{
|
{
|
||||||
#if !defined(CC_USE_METAL)
|
#if !defined(AX_USE_METAL)
|
||||||
auto data = _currentPageData + (CacheTextureWidth * (int)startY << _strideShift);
|
auto data = _currentPageData + (CacheTextureWidth * (int)startY << _strideShift);
|
||||||
_atlasTextures[_currentPage]->updateWithSubData(data, 0, startY, CacheTextureWidth,
|
_atlasTextures[_currentPage]->updateWithSubData(data, 0, startY, CacheTextureWidth,
|
||||||
(int)_currentPageOrigY - startY + _currLineHeight);
|
(int)_currentPageOrigY - startY + _currLineHeight);
|
||||||
|
@ -343,7 +343,7 @@ void FontAtlas::addNewPage()
|
||||||
|
|
||||||
memset(_currentPageData, 0, _currentPageDataSize);
|
memset(_currentPageData, 0, _currentPageDataSize);
|
||||||
|
|
||||||
#if !defined(CC_USE_METAL)
|
#if !defined(AX_USE_METAL)
|
||||||
texture->initWithData(_currentPageData, _currentPageDataSize, _pixelFormat, CacheTextureWidth, CacheTextureHeight);
|
texture->initWithData(_currentPageData, _currentPageDataSize, _pixelFormat, CacheTextureWidth, CacheTextureHeight);
|
||||||
#else
|
#else
|
||||||
if (_strideShift)
|
if (_strideShift)
|
||||||
|
|
|
@ -59,7 +59,7 @@ struct FontLetterDefinition
|
||||||
bool rotated;
|
bool rotated;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL FontAtlas : public Ref
|
class AX_DLL FontAtlas : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const int CacheTextureWidth;
|
static const int CacheTextureWidth;
|
||||||
|
@ -147,7 +147,7 @@ protected:
|
||||||
int _strideShift = 0;
|
int _strideShift = 0;
|
||||||
uint8_t* _currentPageData = nullptr;
|
uint8_t* _currentPageData = nullptr;
|
||||||
int _currentPageDataSize = 0;
|
int _currentPageDataSize = 0;
|
||||||
#if defined(CC_USE_METAL)
|
#if defined(AX_USE_METAL)
|
||||||
// Notes:
|
// Notes:
|
||||||
// Metal backend doesn't support PixelFormat::LA8
|
// Metal backend doesn't support PixelFormat::LA8
|
||||||
// Currently we use RGBA for texture data upload
|
// Currently we use RGBA for texture data upload
|
||||||
|
|
|
@ -270,7 +270,7 @@ void FontAtlasCache::reloadFontAtlasFNT(std::string_view fontFileName, const Rec
|
||||||
auto it = _atlasMap.find(atlasName);
|
auto it = _atlasMap.find(atlasName);
|
||||||
if (it != _atlasMap.end())
|
if (it != _atlasMap.end())
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(it->second);
|
AX_SAFE_RELEASE_NULL(it->second);
|
||||||
_atlasMap.erase(it);
|
_atlasMap.erase(it);
|
||||||
}
|
}
|
||||||
FontFNT::reloadBMFontResource(fontFileName);
|
FontFNT::reloadBMFontResource(fontFileName);
|
||||||
|
@ -297,7 +297,7 @@ void FontAtlasCache::unloadFontAtlasTTF(std::string_view fontFileName)
|
||||||
{
|
{
|
||||||
if (item->first.find(fontFileName) != std::string::npos)
|
if (item->first.find(fontFileName) != std::string::npos)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(item->second);
|
AX_SAFE_RELEASE_NULL(item->second);
|
||||||
item = _atlasMap.erase(item);
|
item = _atlasMap.erase(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|
|
@ -38,7 +38,7 @@ class FontAtlas;
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
struct _ttfConfig;
|
struct _ttfConfig;
|
||||||
|
|
||||||
class CC_DLL FontAtlasCache
|
class AX_DLL FontAtlasCache
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static FontAtlas* getFontAtlasTTF(const _ttfConfig* config);
|
static FontAtlas* getFontAtlasTTF(const _ttfConfig* config);
|
||||||
|
@ -46,7 +46,7 @@ public:
|
||||||
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName);
|
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName);
|
||||||
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, std::string_view subTextureKey);
|
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, std::string_view subTextureKey);
|
||||||
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, const Rect& imageRect, bool imageRotated);
|
static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, const Rect& imageRect, bool imageRotated);
|
||||||
CC_DEPRECATED_ATTRIBUTE static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, const Vec2& imageOffset);
|
AX_DEPRECATED_ATTRIBUTE static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, const Vec2& imageOffset);
|
||||||
|
|
||||||
static FontAtlas* getFontAtlasCharMap(std::string_view charMapFile,
|
static FontAtlas* getFontAtlasCharMap(std::string_view charMapFile,
|
||||||
int itemWidth,
|
int itemWidth,
|
||||||
|
@ -68,7 +68,7 @@ public:
|
||||||
*/
|
*/
|
||||||
static void reloadFontAtlasFNT(std::string_view fontFileName, const Rect& imageRect, bool imageRotated);
|
static void reloadFontAtlasFNT(std::string_view fontFileName, const Rect& imageRect, bool imageRotated);
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE static void reloadFontAtlasFNT(std::string_view fontFileName,
|
AX_DEPRECATED_ATTRIBUTE static void reloadFontAtlasFNT(std::string_view fontFileName,
|
||||||
const Vec2& imageOffset = Vec2::ZERO);
|
const Vec2& imageOffset = Vec2::ZERO);
|
||||||
|
|
||||||
/** Unload all texture atlas texture create by special file name.
|
/** Unload all texture atlas texture create by special file name.
|
||||||
|
|
|
@ -40,7 +40,7 @@ FontCharMap* FontCharMap::create(std::string_view plistFile)
|
||||||
|
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
|
||||||
|
|
||||||
CCASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
|
AXASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
|
||||||
|
|
||||||
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ FontAtlas* FontCharMap::newFontAtlas()
|
||||||
|
|
||||||
tempAtlas->setLineHeight((float)_itemHeight);
|
tempAtlas->setLineHeight((float)_itemHeight);
|
||||||
|
|
||||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = AX_CONTENT_SCALE_FACTOR();
|
||||||
|
|
||||||
FontLetterDefinition tempDefinition;
|
FontLetterDefinition tempDefinition;
|
||||||
tempDefinition.textureID = 0;
|
tempDefinition.textureID = 0;
|
||||||
|
|
|
@ -92,7 +92,7 @@ BMFontConfiguration* BMFontConfiguration::create(std::string_view FNTfile)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,17 +117,17 @@ BMFontConfiguration::BMFontConfiguration() : _commonHeight(0), _characterSet(nul
|
||||||
|
|
||||||
BMFontConfiguration::~BMFontConfiguration()
|
BMFontConfiguration::~BMFontConfiguration()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing BMFontConfiguration: %p", this);
|
AXLOGINFO("deallocing BMFontConfiguration: %p", this);
|
||||||
this->purgeFontDefDictionary();
|
this->purgeFontDefDictionary();
|
||||||
this->purgeKerningDictionary();
|
this->purgeKerningDictionary();
|
||||||
_atlasName.clear();
|
_atlasName.clear();
|
||||||
CC_SAFE_DELETE(_characterSet);
|
AX_SAFE_DELETE(_characterSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BMFontConfiguration::description() const
|
std::string BMFontConfiguration::description() const
|
||||||
{
|
{
|
||||||
return StringUtils::format(
|
return StringUtils::format(
|
||||||
"<BMFontConfiguration = " CC_FORMAT_PRINTF_SIZE_T " | Glphys:%d Kernings:%d | Image = %s>", (size_t)this,
|
"<BMFontConfiguration = " AX_FORMAT_PRINTF_SIZE_T " | Glphys:%d Kernings:%d | Image = %s>", (size_t)this,
|
||||||
static_cast<int>(_fontDefDictionary.size()), static_cast<int>(_kerningDictionary.size()), _atlasName.c_str());
|
static_cast<int>(_fontDefDictionary.size()), static_cast<int>(_kerningDictionary.size()), _atlasName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +156,7 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(std::string_view co
|
||||||
}
|
}
|
||||||
if (data[0] == 0)
|
if (data[0] == 0)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: Error parsing FNTfile %s", controlFile.data());
|
AXLOG("cocos2d: Error parsing FNTfile %s", controlFile.data());
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
auto contents = data.c_str();
|
auto contents = data.c_str();
|
||||||
|
@ -231,7 +231,7 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
|
||||||
|
|
||||||
uint32_t remains = size;
|
uint32_t remains = size;
|
||||||
|
|
||||||
CCASSERT(pData[3] == 3, "Only version 3 is supported");
|
AXASSERT(pData[3] == 3, "Only version 3 is supported");
|
||||||
|
|
||||||
pData += 4;
|
pData += 4;
|
||||||
remains -= 4;
|
remains -= 4;
|
||||||
|
@ -293,13 +293,13 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
|
||||||
uint16_t scaleH = 0;
|
uint16_t scaleH = 0;
|
||||||
memcpy(&scaleH, pData + 6, 2);
|
memcpy(&scaleH, pData + 6, 2);
|
||||||
|
|
||||||
CCASSERT(scaleW <= Configuration::getInstance()->getMaxTextureSize() &&
|
AXASSERT(scaleW <= Configuration::getInstance()->getMaxTextureSize() &&
|
||||||
scaleH <= Configuration::getInstance()->getMaxTextureSize(),
|
scaleH <= Configuration::getInstance()->getMaxTextureSize(),
|
||||||
"CCLabelBMFont: page can't be larger than supported");
|
"CCLabelBMFont: page can't be larger than supported");
|
||||||
|
|
||||||
uint16_t pages = 0;
|
uint16_t pages = 0;
|
||||||
memcpy(&pages, pData + 8, 2);
|
memcpy(&pages, pData + 8, 2);
|
||||||
CCASSERT(pages == 1, "CCBitfontAtlas: only supports 1 page");
|
AXASSERT(pages == 1, "CCBitfontAtlas: only supports 1 page");
|
||||||
}
|
}
|
||||||
else if (blockId == 3)
|
else if (blockId == 3)
|
||||||
{
|
{
|
||||||
|
@ -308,7 +308,7 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const char* value = (const char*)pData;
|
const char* value = (const char*)pData;
|
||||||
CCASSERT(strlen(value) < blockSize, "Block size should be less then string");
|
AXASSERT(strlen(value) < blockSize, "Block size should be less then string");
|
||||||
|
|
||||||
_atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile);
|
_atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile);
|
||||||
}
|
}
|
||||||
|
@ -409,7 +409,7 @@ void BMFontConfiguration::parseImageFileName(const char* line, std::string_view
|
||||||
// page ID. Sanity check
|
// page ID. Sanity check
|
||||||
int pageId;
|
int pageId;
|
||||||
sscanf(line, "page id=%d", &pageId);
|
sscanf(line, "page id=%d", &pageId);
|
||||||
CCASSERT(pageId == 0, "LabelBMFont file could not be found");
|
AXASSERT(pageId == 0, "LabelBMFont file could not be found");
|
||||||
|
|
||||||
// file
|
// file
|
||||||
char fileName[255];
|
char fileName[255];
|
||||||
|
@ -429,7 +429,7 @@ void BMFontConfiguration::parseInfoArguments(const char* line)
|
||||||
// padding
|
// padding
|
||||||
sscanf(strstr(line, "padding=") + 8, "%d,%d,%d,%d", &_padding.top, &_padding.right, &_padding.bottom,
|
sscanf(strstr(line, "padding=") + 8, "%d,%d,%d,%d", &_padding.top, &_padding.right, &_padding.bottom,
|
||||||
&_padding.left);
|
&_padding.left);
|
||||||
// CCLOG("cocos2d: padding: %d,%d,%d,%d", _padding.left, _padding.top, _padding.right, _padding.bottom);
|
// AXLOG("cocos2d: padding: %d,%d,%d,%d", _padding.left, _padding.top, _padding.right, _padding.bottom);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BMFontConfiguration::parseCommonArguments(const char* line)
|
void BMFontConfiguration::parseCommonArguments(const char* line)
|
||||||
|
@ -443,24 +443,24 @@ void BMFontConfiguration::parseCommonArguments(const char* line)
|
||||||
auto tmp = strstr(line, "lineHeight=") + 11;
|
auto tmp = strstr(line, "lineHeight=") + 11;
|
||||||
sscanf(tmp, "%d", &_commonHeight);
|
sscanf(tmp, "%d", &_commonHeight);
|
||||||
|
|
||||||
#if COCOS2D_DEBUG > 0
|
#if AXIS_DEBUG > 0
|
||||||
// scaleW. sanity check
|
// scaleW. sanity check
|
||||||
int value;
|
int value;
|
||||||
tmp = strstr(tmp, "scaleW=") + 7;
|
tmp = strstr(tmp, "scaleW=") + 7;
|
||||||
sscanf(tmp, "%d", &value);
|
sscanf(tmp, "%d", &value);
|
||||||
|
|
||||||
int maxTextureSize = Configuration::getInstance()->getMaxTextureSize();
|
int maxTextureSize = Configuration::getInstance()->getMaxTextureSize();
|
||||||
CCASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
|
AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
|
||||||
|
|
||||||
// scaleH. sanity check
|
// scaleH. sanity check
|
||||||
tmp = strstr(tmp, "scaleH=") + 7;
|
tmp = strstr(tmp, "scaleH=") + 7;
|
||||||
sscanf(tmp, "%d", &value);
|
sscanf(tmp, "%d", &value);
|
||||||
CCASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
|
AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
|
||||||
|
|
||||||
// pages. sanity check
|
// pages. sanity check
|
||||||
tmp = strstr(tmp, "pages=") + 6;
|
tmp = strstr(tmp, "pages=") + 6;
|
||||||
sscanf(tmp, "%d", &value);
|
sscanf(tmp, "%d", &value);
|
||||||
CCASSERT(value == 1, "CCBitfontAtlas: only supports 1 page");
|
AXASSERT(value == 1, "CCBitfontAtlas: only supports 1 page");
|
||||||
#endif
|
#endif
|
||||||
// packed (ignore) What does this mean ??
|
// packed (ignore) What does this mean ??
|
||||||
}
|
}
|
||||||
|
@ -596,7 +596,7 @@ FontFNT* FontFNT::create(std::string_view fntFilePath, const Vec2& imageOffset)
|
||||||
}
|
}
|
||||||
|
|
||||||
FontFNT::FontFNT(BMFontConfiguration* theContfig, const Rect& imageRect, bool imageRotated)
|
FontFNT::FontFNT(BMFontConfiguration* theContfig, const Rect& imageRect, bool imageRotated)
|
||||||
: _configuration(theContfig), _imageRectInPoints(CC_RECT_PIXELS_TO_POINTS(imageRect)), _imageRotated(imageRotated)
|
: _configuration(theContfig), _imageRectInPoints(AX_RECT_PIXELS_TO_POINTS(imageRect)), _imageRotated(imageRotated)
|
||||||
{
|
{
|
||||||
_configuration->retain();
|
_configuration->retain();
|
||||||
}
|
}
|
||||||
|
@ -615,7 +615,7 @@ void FontFNT::purgeCachedData()
|
||||||
if (s_configurations)
|
if (s_configurations)
|
||||||
{
|
{
|
||||||
s_configurations->clear();
|
s_configurations->clear();
|
||||||
CC_SAFE_DELETE(s_configurations);
|
AX_SAFE_DELETE(s_configurations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ FontAtlas* FontFNT::newFontAtlas()
|
||||||
|
|
||||||
FontLetterDefinition tempDefinition;
|
FontLetterDefinition tempDefinition;
|
||||||
|
|
||||||
const auto tempRect = CC_RECT_PIXELS_TO_POINTS(fontDef.rect);
|
const auto tempRect = AX_RECT_PIXELS_TO_POINTS(fontDef.rect);
|
||||||
|
|
||||||
tempDefinition.offsetX = fontDef.xOffset;
|
tempDefinition.offsetX = fontDef.xOffset;
|
||||||
tempDefinition.offsetY = fontDef.yOffset;
|
tempDefinition.offsetY = fontDef.yOffset;
|
||||||
|
@ -738,7 +738,7 @@ FontAtlas* FontFNT::newFontAtlas()
|
||||||
// add the new definition
|
// add the new definition
|
||||||
if (65535 < fontDef.charID)
|
if (65535 < fontDef.charID)
|
||||||
{
|
{
|
||||||
CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID);
|
AXLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -751,7 +751,7 @@ FontAtlas* FontFNT::newFontAtlas()
|
||||||
Texture2D* tempTexture = Director::getInstance()->getTextureCache()->addImage(_configuration->getAtlasName());
|
Texture2D* tempTexture = Director::getInstance()->getTextureCache()->addImage(_configuration->getAtlasName());
|
||||||
if (!tempTexture)
|
if (!tempTexture)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(tempAtlas);
|
AX_SAFE_RELEASE(tempAtlas);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,7 +73,7 @@ typedef struct _BMFontPadding
|
||||||
/** @brief BMFontConfiguration has parsed configuration of the .fnt file
|
/** @brief BMFontConfiguration has parsed configuration of the .fnt file
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
class CC_DLL BMFontConfiguration : public Ref
|
class AX_DLL BMFontConfiguration : public Ref
|
||||||
{
|
{
|
||||||
// FIXME: Creating a public interface so that the bitmapFontArray[] is accessible
|
// FIXME: Creating a public interface so that the bitmapFontArray[] is accessible
|
||||||
public: //@public
|
public: //@public
|
||||||
|
@ -141,7 +141,7 @@ private:
|
||||||
void purgeFontDefDictionary();
|
void purgeFontDefDictionary();
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL FontFNT : public Font
|
class AX_DLL FontFNT : public Font
|
||||||
{
|
{
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -149,7 +149,7 @@ public:
|
||||||
static FontFNT* create(std::string_view fntFilePath, std::string_view subTextureKey);
|
static FontFNT* create(std::string_view fntFilePath, std::string_view subTextureKey);
|
||||||
static FontFNT* create(std::string_view fntFilePath);
|
static FontFNT* create(std::string_view fntFilePath);
|
||||||
|
|
||||||
CC_DEPRECATED_ATTRIBUTE static FontFNT* create(std::string_view fntFilePath, const Vec2& imageOffset = Vec2::ZERO);
|
AX_DEPRECATED_ATTRIBUTE static FontFNT* create(std::string_view fntFilePath, const Vec2& imageOffset = Vec2::ZERO);
|
||||||
|
|
||||||
/** Purges the cached data.
|
/** Purges the cached data.
|
||||||
Removes from memory the cached configurations and the atlas name dictionary.
|
Removes from memory the cached configurations and the atlas name dictionary.
|
||||||
|
|
|
@ -164,7 +164,7 @@ FontFreeType::FontFreeType(bool distanceFieldEnabled /* = false */, float outlin
|
||||||
{
|
{
|
||||||
if (outline > 0.0f)
|
if (outline > 0.0f)
|
||||||
{
|
{
|
||||||
_outlineSize = outline * CC_CONTENT_SCALE_FACTOR();
|
_outlineSize = outline * AX_CONTENT_SCALE_FACTOR();
|
||||||
FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker);
|
FT_Stroker_New(FontFreeType::getFTLibrary(), &_stroker);
|
||||||
FT_Stroker_Set(_stroker,
|
FT_Stroker_Set(_stroker,
|
||||||
(int)(_outlineSize * 64),
|
(int)(_outlineSize * 64),
|
||||||
|
@ -255,7 +255,7 @@ bool FontFreeType::loadFontFace(std::string_view fontPath, float fontSize)
|
||||||
|
|
||||||
// set the requested font size
|
// set the requested font size
|
||||||
int dpi = 72;
|
int dpi = 72;
|
||||||
int fontSizePoints = (int)(64.f * fontSize * CC_CONTENT_SCALE_FACTOR());
|
int fontSizePoints = (int)(64.f * fontSize * AX_CONTENT_SCALE_FACTOR());
|
||||||
if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi))
|
if (FT_Set_Char_Size(face, fontSizePoints, fontSizePoints, dpi, dpi))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -388,7 +388,7 @@ unsigned char* FontFreeType::getGlyphBitmap(char32_t charCode,
|
||||||
|
|
||||||
// @remark: glyphIndex=0 means character is missing on current font face
|
// @remark: glyphIndex=0 means character is missing on current font face
|
||||||
auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast<FT_ULong>(charCode));
|
auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast<FT_ULong>(charCode));
|
||||||
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
|
#if defined(AXIS_DEBUG) && AXIS_DEBUG > 0
|
||||||
if (glyphIndex == 0)
|
if (glyphIndex == 0)
|
||||||
{
|
{
|
||||||
char32_t ntcs[2] = {charCode, (char32_t)0};
|
char32_t ntcs[2] = {charCode, (char32_t)0};
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct FT_BBox_ FT_BBox;
|
||||||
|
|
||||||
NS_AX_BEGIN
|
NS_AX_BEGIN
|
||||||
|
|
||||||
class CC_DLL FontFreeType : public Font
|
class AX_DLL FontFreeType : public Font
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static const int DistanceMapSpread;
|
static const int DistanceMapSpread;
|
||||||
|
|
|
@ -84,10 +84,10 @@ bool GridBase::initWithSize(const Vec2& gridSize, Texture2D* texture, bool flipp
|
||||||
_gridSize = gridSize;
|
_gridSize = gridSize;
|
||||||
|
|
||||||
_texture = texture;
|
_texture = texture;
|
||||||
CC_SAFE_RETAIN(_texture);
|
AX_SAFE_RETAIN(_texture);
|
||||||
_isTextureFlipped = flipped;
|
_isTextureFlipped = flipped;
|
||||||
|
|
||||||
#ifdef CC_USE_METAL
|
#ifdef AX_USE_METAL
|
||||||
_isTextureFlipped = !flipped;
|
_isTextureFlipped = !flipped;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -104,7 +104,7 @@ bool GridBase::initWithSize(const Vec2& gridSize, Texture2D* texture, bool flipp
|
||||||
_step.y = _gridRect.size.height / _gridSize.height;
|
_step.y = _gridRect.size.height / _gridSize.height;
|
||||||
|
|
||||||
auto& pipelineDescriptor = _drawCommand.getPipelineDescriptor();
|
auto& pipelineDescriptor = _drawCommand.getPipelineDescriptor();
|
||||||
CC_SAFE_RELEASE(_programState);
|
AX_SAFE_RELEASE(_programState);
|
||||||
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE);
|
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE);
|
||||||
_programState = new backend::ProgramState(program);
|
_programState = new backend::ProgramState(program);
|
||||||
pipelineDescriptor.programState = _programState;
|
pipelineDescriptor.programState = _programState;
|
||||||
|
@ -149,14 +149,14 @@ void GridBase::updateBlendState()
|
||||||
|
|
||||||
GridBase::~GridBase()
|
GridBase::~GridBase()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing GridBase: %p", this);
|
AXLOGINFO("deallocing GridBase: %p", this);
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_renderTarget);
|
AX_SAFE_RELEASE(_renderTarget);
|
||||||
|
|
||||||
// TODO: ? why 2.0 comments this line: setActive(false);
|
// TODO: ? why 2.0 comments this line: setActive(false);
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
|
|
||||||
CC_SAFE_RELEASE(_programState);
|
AX_SAFE_RELEASE(_programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// properties
|
// properties
|
||||||
|
@ -216,7 +216,7 @@ void GridBase::beforeDraw()
|
||||||
renderer->setViewPort(0, 0, (unsigned int)size.width, (unsigned int)size.height);
|
renderer->setViewPort(0, 0, (unsigned int)size.width, (unsigned int)size.height);
|
||||||
|
|
||||||
_oldRenderTarget = renderer->getRenderTarget();
|
_oldRenderTarget = renderer->getRenderTarget();
|
||||||
CC_SAFE_RELEASE(_renderTarget);
|
AX_SAFE_RELEASE(_renderTarget);
|
||||||
_renderTarget =
|
_renderTarget =
|
||||||
backend::Device::getInstance()->newRenderTarget(TargetBufferFlags::COLOR, _texture->getBackendTexture());
|
backend::Device::getInstance()->newRenderTarget(TargetBufferFlags::COLOR, _texture->getBackendTexture());
|
||||||
renderer->setRenderTarget(_renderTarget);
|
renderer->setRenderTarget(_renderTarget);
|
||||||
|
@ -344,11 +344,11 @@ Grid3D::Grid3D() {}
|
||||||
|
|
||||||
Grid3D::~Grid3D()
|
Grid3D::~Grid3D()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_texCoordinates);
|
AX_SAFE_FREE(_texCoordinates);
|
||||||
CC_SAFE_FREE(_vertices);
|
AX_SAFE_FREE(_vertices);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
CC_SAFE_FREE(_originalVertices);
|
AX_SAFE_FREE(_originalVertices);
|
||||||
CC_SAFE_FREE(_vertexBuffer);
|
AX_SAFE_FREE(_vertexBuffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Grid3D::beforeBlit()
|
void Grid3D::beforeBlit()
|
||||||
|
@ -392,11 +392,11 @@ void Grid3D::calculateVertexPoints()
|
||||||
float height = (float)_texture->getPixelsHigh();
|
float height = (float)_texture->getPixelsHigh();
|
||||||
float imageH = _texture->getContentSizeInPixels().height;
|
float imageH = _texture->getContentSizeInPixels().height;
|
||||||
|
|
||||||
CC_SAFE_FREE(_vertices);
|
AX_SAFE_FREE(_vertices);
|
||||||
CC_SAFE_FREE(_originalVertices);
|
AX_SAFE_FREE(_originalVertices);
|
||||||
CC_SAFE_FREE(_texCoordinates);
|
AX_SAFE_FREE(_texCoordinates);
|
||||||
CC_SAFE_FREE(_vertexBuffer);
|
AX_SAFE_FREE(_vertexBuffer);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
|
|
||||||
size_t numOfPoints = static_cast<size_t>((_gridSize.width + 1) * (_gridSize.height + 1));
|
size_t numOfPoints = static_cast<size_t>((_gridSize.width + 1) * (_gridSize.height + 1));
|
||||||
|
|
||||||
|
@ -470,7 +470,7 @@ void Grid3D::calculateVertexPoints()
|
||||||
|
|
||||||
Vec3 Grid3D::getVertex(const Vec2& pos) const
|
Vec3 Grid3D::getVertex(const Vec2& pos) const
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
|
|
||||||
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
||||||
float* vertArray = (float*)_vertices;
|
float* vertArray = (float*)_vertices;
|
||||||
|
@ -482,7 +482,7 @@ Vec3 Grid3D::getVertex(const Vec2& pos) const
|
||||||
|
|
||||||
Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
|
Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
|
|
||||||
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
||||||
float* vertArray = (float*)_originalVertices;
|
float* vertArray = (float*)_originalVertices;
|
||||||
|
@ -494,7 +494,7 @@ Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
|
||||||
|
|
||||||
void Grid3D::setVertex(const Vec2& pos, const Vec3& vertex)
|
void Grid3D::setVertex(const Vec2& pos, const Vec3& vertex)
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
|
||||||
float* vertArray = (float*)_vertices;
|
float* vertArray = (float*)_vertices;
|
||||||
vertArray[index] = vertex.x;
|
vertArray[index] = vertex.x;
|
||||||
|
@ -552,10 +552,10 @@ void Grid3D::updateVertexAndTexCoordinate()
|
||||||
|
|
||||||
TiledGrid3D::~TiledGrid3D()
|
TiledGrid3D::~TiledGrid3D()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_texCoordinates);
|
AX_SAFE_FREE(_texCoordinates);
|
||||||
CC_SAFE_FREE(_vertices);
|
AX_SAFE_FREE(_vertices);
|
||||||
CC_SAFE_FREE(_originalVertices);
|
AX_SAFE_FREE(_originalVertices);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
TiledGrid3D* TiledGrid3D::create(const Vec2& gridSize)
|
TiledGrid3D* TiledGrid3D::create(const Vec2& gridSize)
|
||||||
|
@ -643,11 +643,11 @@ void TiledGrid3D::calculateVertexPoints()
|
||||||
float imageH = _texture->getContentSizeInPixels().height;
|
float imageH = _texture->getContentSizeInPixels().height;
|
||||||
|
|
||||||
int numQuads = (int)(_gridSize.width * _gridSize.height);
|
int numQuads = (int)(_gridSize.width * _gridSize.height);
|
||||||
CC_SAFE_FREE(_vertices);
|
AX_SAFE_FREE(_vertices);
|
||||||
CC_SAFE_FREE(_originalVertices);
|
AX_SAFE_FREE(_originalVertices);
|
||||||
CC_SAFE_FREE(_texCoordinates);
|
AX_SAFE_FREE(_texCoordinates);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
CC_SAFE_FREE(_vertexBuffer);
|
AX_SAFE_FREE(_vertexBuffer);
|
||||||
|
|
||||||
_vertices = malloc(numQuads * 4 * sizeof(Vec3));
|
_vertices = malloc(numQuads * 4 * sizeof(Vec3));
|
||||||
_originalVertices = malloc(numQuads * 4 * sizeof(Vec3));
|
_originalVertices = malloc(numQuads * 4 * sizeof(Vec3));
|
||||||
|
@ -718,7 +718,7 @@ void TiledGrid3D::calculateVertexPoints()
|
||||||
|
|
||||||
void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords)
|
void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords)
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
||||||
float* vertArray = (float*)_vertices;
|
float* vertArray = (float*)_vertices;
|
||||||
memcpy(&vertArray[idx], &coords, sizeof(Quad3));
|
memcpy(&vertArray[idx], &coords, sizeof(Quad3));
|
||||||
|
@ -726,7 +726,7 @@ void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords)
|
||||||
|
|
||||||
Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const
|
Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
||||||
float* vertArray = (float*)_originalVertices;
|
float* vertArray = (float*)_originalVertices;
|
||||||
|
|
||||||
|
@ -738,7 +738,7 @@ Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const
|
||||||
|
|
||||||
Quad3 TiledGrid3D::getTile(const Vec2& pos) const
|
Quad3 TiledGrid3D::getTile(const Vec2& pos) const
|
||||||
{
|
{
|
||||||
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
|
||||||
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
|
||||||
float* vertArray = (float*)_vertices;
|
float* vertArray = (float*)_vertices;
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RenderTarget;
|
||||||
|
|
||||||
/** Base class for Other grid.
|
/** Base class for Other grid.
|
||||||
*/
|
*/
|
||||||
class CC_DLL GridBase : public Ref
|
class AX_DLL GridBase : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -174,7 +174,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
Grid3D is a 3D grid implementation. Each vertex has 3 dimensions: x,y,z
|
Grid3D is a 3D grid implementation. Each vertex has 3 dimensions: x,y,z
|
||||||
*/
|
*/
|
||||||
class CC_DLL Grid3D : public GridBase
|
class AX_DLL Grid3D : public GridBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** create one Grid. */
|
/** create one Grid. */
|
||||||
|
@ -248,7 +248,7 @@ protected:
|
||||||
TiledGrid3D is a 3D grid implementation. It differs from Grid3D in that
|
TiledGrid3D is a 3D grid implementation. It differs from Grid3D in that
|
||||||
the tiles can be separated from the grid.
|
the tiles can be separated from the grid.
|
||||||
*/
|
*/
|
||||||
class CC_DLL TiledGrid3D : public GridBase
|
class AX_DLL TiledGrid3D : public GridBase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create one Grid. */
|
/** Create one Grid. */
|
||||||
|
|
|
@ -95,7 +95,7 @@ public:
|
||||||
letter->autorelease();
|
letter->autorelease();
|
||||||
return letter;
|
return letter;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(letter);
|
AX_SAFE_DELETE(letter);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,9 +206,9 @@ Label::BatchCommand::BatchCommand()
|
||||||
|
|
||||||
Label::BatchCommand::~BatchCommand()
|
Label::BatchCommand::~BatchCommand()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(textCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE(textCommand.getPipelineDescriptor().programState);
|
||||||
CC_SAFE_RELEASE(shadowCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE(shadowCommand.getPipelineDescriptor().programState);
|
||||||
CC_SAFE_RELEASE(outLineCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE(outLineCommand.getPipelineDescriptor().programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::BatchCommand::setProgramState(backend::ProgramState* programState)
|
void Label::BatchCommand::setProgramState(backend::ProgramState* programState)
|
||||||
|
@ -216,15 +216,15 @@ void Label::BatchCommand::setProgramState(backend::ProgramState* programState)
|
||||||
assert(programState);
|
assert(programState);
|
||||||
|
|
||||||
auto& programStateText = textCommand.getPipelineDescriptor().programState;
|
auto& programStateText = textCommand.getPipelineDescriptor().programState;
|
||||||
CC_SAFE_RELEASE(programStateText);
|
AX_SAFE_RELEASE(programStateText);
|
||||||
programStateText = programState->clone();
|
programStateText = programState->clone();
|
||||||
|
|
||||||
auto& programStateShadow = shadowCommand.getPipelineDescriptor().programState;
|
auto& programStateShadow = shadowCommand.getPipelineDescriptor().programState;
|
||||||
CC_SAFE_RELEASE(programStateShadow);
|
AX_SAFE_RELEASE(programStateShadow);
|
||||||
programStateShadow = programState->clone();
|
programStateShadow = programState->clone();
|
||||||
|
|
||||||
auto& programStateOutline = outLineCommand.getPipelineDescriptor().programState;
|
auto& programStateOutline = outLineCommand.getPipelineDescriptor().programState;
|
||||||
CC_SAFE_RELEASE(programStateOutline);
|
AX_SAFE_RELEASE(programStateOutline);
|
||||||
programStateOutline = programState->clone();
|
programStateOutline = programState->clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ Label* Label::createWithTTF(std::string_view text,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -508,7 +508,7 @@ Label::Label(TextHAlignment hAlignment /* = TextHAlignment::LEFT */,
|
||||||
_hAlignment = hAlignment;
|
_hAlignment = hAlignment;
|
||||||
_vAlignment = vAlignment;
|
_vAlignment = vAlignment;
|
||||||
|
|
||||||
#if CC_LABEL_DEBUG_DRAW
|
#if AX_LABEL_DEBUG_DRAW
|
||||||
_debugDrawNode = DrawNode::create();
|
_debugDrawNode = DrawNode::create();
|
||||||
addChild(_debugDrawNode);
|
addChild(_debugDrawNode);
|
||||||
#endif
|
#endif
|
||||||
|
@ -557,7 +557,7 @@ Label::~Label()
|
||||||
if (_fontAtlas)
|
if (_fontAtlas)
|
||||||
{
|
{
|
||||||
Node::removeAllChildrenWithCleanup(true);
|
Node::removeAllChildrenWithCleanup(true);
|
||||||
CC_SAFE_RELEASE_NULL(_reusedLetter);
|
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||||
}
|
}
|
||||||
|
@ -565,16 +565,16 @@ Label::~Label()
|
||||||
_eventDispatcher->removeEventListener(_purgeTextureListener);
|
_eventDispatcher->removeEventListener(_purgeTextureListener);
|
||||||
_eventDispatcher->removeEventListener(_resetTextureListener);
|
_eventDispatcher->removeEventListener(_resetTextureListener);
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(_textSprite);
|
AX_SAFE_RELEASE_NULL(_textSprite);
|
||||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
AX_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::reset()
|
void Label::reset()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_textSprite);
|
AX_SAFE_RELEASE_NULL(_textSprite);
|
||||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
AX_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
Node::removeAllChildrenWithCleanup(true);
|
Node::removeAllChildrenWithCleanup(true);
|
||||||
CC_SAFE_RELEASE_NULL(_reusedLetter);
|
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
||||||
_letters.clear();
|
_letters.clear();
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
_batchCommands.clear();
|
_batchCommands.clear();
|
||||||
|
@ -604,7 +604,7 @@ void Label::reset()
|
||||||
|
|
||||||
_systemFontDirty = false;
|
_systemFontDirty = false;
|
||||||
_systemFont = "Helvetica";
|
_systemFont = "Helvetica";
|
||||||
_systemFontSize = CC_DEFAULT_FONT_LABEL_SIZE;
|
_systemFontSize = AX_DEFAULT_FONT_LABEL_SIZE;
|
||||||
|
|
||||||
if (_horizontalKernings)
|
if (_horizontalKernings)
|
||||||
{
|
{
|
||||||
|
@ -780,7 +780,7 @@ void Label::updateShaderProgram()
|
||||||
|
|
||||||
void Label::updateBatchCommand(Label::BatchCommand& batch)
|
void Label::updateBatchCommand(Label::BatchCommand& batch)
|
||||||
{
|
{
|
||||||
CCASSERT(_programState, "programState should be set!");
|
AXASSERT(_programState, "programState should be set!");
|
||||||
batch.setProgramState(_programState);
|
batch.setProgramState(_programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -803,7 +803,7 @@ void Label::setFontAtlas(FontAtlas* atlas, bool distanceFieldEnabled /* = false
|
||||||
if (atlas == _fontAtlas)
|
if (atlas == _fontAtlas)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CC_SAFE_RETAIN(atlas);
|
AX_SAFE_RETAIN(atlas);
|
||||||
if (_fontAtlas)
|
if (_fontAtlas)
|
||||||
{
|
{
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
|
@ -858,7 +858,7 @@ bool Label::setBMFontFilePath(std::string_view bmfontFilePath, float fontSize)
|
||||||
if (bmFont)
|
if (bmFont)
|
||||||
{
|
{
|
||||||
float originalFontSize = bmFont->getOriginalFontSize();
|
float originalFontSize = bmFont->getOriginalFontSize();
|
||||||
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / AX_CONTENT_SCALE_FACTOR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -892,7 +892,7 @@ bool Label::setBMFontFilePath(std::string_view bmfontFilePath, const Rect& image
|
||||||
if (bmFont)
|
if (bmFont)
|
||||||
{
|
{
|
||||||
float originalFontSize = bmFont->getOriginalFontSize();
|
float originalFontSize = bmFont->getOriginalFontSize();
|
||||||
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / AX_CONTENT_SCALE_FACTOR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -928,7 +928,7 @@ bool Label::setBMFontFilePath(std::string_view bmfontFilePath, std::string_view
|
||||||
if (bmFont)
|
if (bmFont)
|
||||||
{
|
{
|
||||||
float originalFontSize = bmFont->getOriginalFontSize();
|
float originalFontSize = bmFont->getOriginalFontSize();
|
||||||
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / AX_CONTENT_SCALE_FACTOR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,7 +1157,7 @@ bool Label::alignText()
|
||||||
|
|
||||||
if (fontSize > 0 && isVerticalClamp())
|
if (fontSize > 0 && isVerticalClamp())
|
||||||
{
|
{
|
||||||
this->shrinkLabelToContentSize(CC_CALLBACK_0(Label::isVerticalClamp, this));
|
this->shrinkLabelToContentSize(AX_CALLBACK_0(Label::isVerticalClamp, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1166,7 +1166,7 @@ bool Label::alignText()
|
||||||
ret = false;
|
ret = false;
|
||||||
if (_overflow == Overflow::SHRINK)
|
if (_overflow == Overflow::SHRINK)
|
||||||
{
|
{
|
||||||
this->shrinkLabelToContentSize(CC_CALLBACK_0(Label::isHorizontalClamp, this));
|
this->shrinkLabelToContentSize(AX_CALLBACK_0(Label::isHorizontalClamp, this));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1398,7 +1398,7 @@ void Label::enableGlow(const Color4B& glowColor)
|
||||||
|
|
||||||
void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 */)
|
void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 */)
|
||||||
{
|
{
|
||||||
CCASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF,
|
AXASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF,
|
||||||
"Only supported system font and TTF!");
|
"Only supported system font and TTF!");
|
||||||
|
|
||||||
if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
|
if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
|
||||||
|
@ -1543,7 +1543,7 @@ void Label::disableEffect(LabelEffect effect)
|
||||||
if (_shadowEnabled)
|
if (_shadowEnabled)
|
||||||
{
|
{
|
||||||
_shadowEnabled = false;
|
_shadowEnabled = false;
|
||||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
AX_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
updateShaderProgram();
|
updateShaderProgram();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1680,7 +1680,7 @@ void Label::updateContent()
|
||||||
{
|
{
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
_batchCommands.clear();
|
_batchCommands.clear();
|
||||||
CC_SAFE_RELEASE_NULL(_reusedLetter);
|
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
||||||
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
FontAtlasCache::releaseFontAtlas(_fontAtlas);
|
||||||
_fontAtlas = nullptr;
|
_fontAtlas = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -1688,8 +1688,8 @@ void Label::updateContent()
|
||||||
_systemFontDirty = false;
|
_systemFontDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(_textSprite);
|
AX_SAFE_RELEASE_NULL(_textSprite);
|
||||||
CC_SAFE_RELEASE_NULL(_shadowNode);
|
AX_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
bool updateFinished = true;
|
bool updateFinished = true;
|
||||||
|
|
||||||
if (_fontAtlas)
|
if (_fontAtlas)
|
||||||
|
@ -1760,7 +1760,7 @@ void Label::updateContent()
|
||||||
_contentDirty = false;
|
_contentDirty = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_LABEL_DEBUG_DRAW
|
#if AX_LABEL_DEBUG_DRAW
|
||||||
_debugDrawNode->clear();
|
_debugDrawNode->clear();
|
||||||
Vec2 vertices[4] = {Vec2::ZERO, Vec2(_contentSize.width, 0.0f), Vec2(_contentSize.width, _contentSize.height),
|
Vec2 vertices[4] = {Vec2::ZERO, Vec2(_contentSize.width, 0.0f), Vec2(_contentSize.width, _contentSize.height),
|
||||||
Vec2(0.0f, _contentSize.height)};
|
Vec2(0.0f, _contentSize.height)};
|
||||||
|
@ -1920,7 +1920,7 @@ void Label::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
||||||
}
|
}
|
||||||
// Don't do calculate the culling if the transform was not updated
|
// Don't do calculate the culling if the transform was not updated
|
||||||
bool transformUpdated = flags & FLAGS_TRANSFORM_DIRTY;
|
bool transformUpdated = flags & FLAGS_TRANSFORM_DIRTY;
|
||||||
#if CC_USE_CULLING
|
#if AX_USE_CULLING
|
||||||
auto visitingCamera = Camera::getVisitingCamera();
|
auto visitingCamera = Camera::getVisitingCamera();
|
||||||
auto defaultCamera = Camera::getDefaultCamera();
|
auto defaultCamera = Camera::getDefaultCamera();
|
||||||
if (visitingCamera == defaultCamera)
|
if (visitingCamera == defaultCamera)
|
||||||
|
@ -2197,7 +2197,7 @@ Sprite* Label::getLetter(int letterIndex)
|
||||||
|
|
||||||
void Label::setLineHeight(float height)
|
void Label::setLineHeight(float height)
|
||||||
{
|
{
|
||||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||||
|
|
||||||
if (_lineHeight != height)
|
if (_lineHeight != height)
|
||||||
{
|
{
|
||||||
|
@ -2208,7 +2208,7 @@ void Label::setLineHeight(float height)
|
||||||
|
|
||||||
float Label::getLineHeight() const
|
float Label::getLineHeight() const
|
||||||
{
|
{
|
||||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||||
return _textSprite ? 0.0f : _lineHeight * _bmfontScale;
|
return _textSprite ? 0.0f : _lineHeight * _bmfontScale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2238,12 +2238,12 @@ void Label::setAdditionalKerning(float space)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
CCLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
|
AXLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
|
||||||
}
|
}
|
||||||
|
|
||||||
float Label::getAdditionalKerning() const
|
float Label::getAdditionalKerning() const
|
||||||
{
|
{
|
||||||
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
|
||||||
|
|
||||||
return _additionalKerning;
|
return _additionalKerning;
|
||||||
}
|
}
|
||||||
|
@ -2356,7 +2356,7 @@ void Label::updateDisplayedOpacity(uint8_t parentOpacity)
|
||||||
// that's fine but it should be documented
|
// that's fine but it should be documented
|
||||||
void Label::setTextColor(const Color4B& color)
|
void Label::setTextColor(const Color4B& color)
|
||||||
{
|
{
|
||||||
CCASSERT(_currentLabelType == LabelType::TTF || _currentLabelType == LabelType::STRING_TEXTURE,
|
AXASSERT(_currentLabelType == LabelType::TTF || _currentLabelType == LabelType::STRING_TEXTURE,
|
||||||
"Only supported system font and ttf!");
|
"Only supported system font and ttf!");
|
||||||
|
|
||||||
if (_currentLabelType == LabelType::STRING_TEXTURE && _textColor != color)
|
if (_currentLabelType == LabelType::STRING_TEXTURE && _textColor != color)
|
||||||
|
@ -2502,10 +2502,10 @@ FontDefinition Label::_getFontDefinition() const
|
||||||
systemFontDef._stroke._strokeEnabled = false;
|
systemFontDef._stroke._strokeEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
#if (AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID) && (AX_TARGET_PLATFORM != AX_PLATFORM_IOS)
|
||||||
if (systemFontDef._stroke._strokeEnabled)
|
if (systemFontDef._stroke._strokeEnabled)
|
||||||
{
|
{
|
||||||
CCLOGERROR("Stroke Currently only supported on iOS and Android!");
|
AXLOGERROR("Stroke Currently only supported on iOS and Android!");
|
||||||
}
|
}
|
||||||
systemFontDef._stroke._strokeEnabled = false;
|
systemFontDef._stroke._strokeEnabled = false;
|
||||||
#endif
|
#endif
|
||||||
|
@ -2530,7 +2530,7 @@ void Label::setGlobalZOrder(float globalZOrder)
|
||||||
_underlineNode->setGlobalZOrder(globalZOrder);
|
_underlineNode->setGlobalZOrder(globalZOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_LABEL_DEBUG_DRAW
|
#if AX_LABEL_DEBUG_DRAW
|
||||||
_debugDrawNode->setGlobalZOrder(globalZOrder);
|
_debugDrawNode->setGlobalZOrder(globalZOrder);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ NS_AX_BEGIN
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define CC_DEFAULT_FONT_LABEL_SIZE 12
|
#define AX_DEFAULT_FONT_LABEL_SIZE 12
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @struct TTFConfig
|
* @struct TTFConfig
|
||||||
|
@ -64,7 +64,7 @@ typedef struct _ttfConfig
|
||||||
bool strikethrough;
|
bool strikethrough;
|
||||||
|
|
||||||
_ttfConfig(std::string_view filePath = {},
|
_ttfConfig(std::string_view filePath = {},
|
||||||
float size = CC_DEFAULT_FONT_LABEL_SIZE,
|
float size = AX_DEFAULT_FONT_LABEL_SIZE,
|
||||||
const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC,
|
const GlyphCollection& glyphCollection = GlyphCollection::DYNAMIC,
|
||||||
const char* customGlyphCollection = nullptr, /* nullable */
|
const char* customGlyphCollection = nullptr, /* nullable */
|
||||||
bool useDistanceField = false,
|
bool useDistanceField = false,
|
||||||
|
@ -113,7 +113,7 @@ class TextureAtlas;
|
||||||
* - http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
* - http://www.angelcode.com/products/bmfont/ (Free, Windows only)
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL Label : public Node, public LabelProtocol, public BlendProtocol
|
class AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Overflow
|
enum class Overflow
|
||||||
|
@ -274,7 +274,7 @@ public:
|
||||||
* @return An automatically released Label object.
|
* @return An automatically released Label object.
|
||||||
* @see setBMFontFilePath setMaxLineWidth
|
* @see setBMFontFilePath setMaxLineWidth
|
||||||
*/
|
*/
|
||||||
CC_DEPRECATED_ATTRIBUTE static Label* createWithBMFont(std::string_view bmfontPath,
|
AX_DEPRECATED_ATTRIBUTE static Label* createWithBMFont(std::string_view bmfontPath,
|
||||||
std::string_view text,
|
std::string_view text,
|
||||||
const TextHAlignment& hAlignment,
|
const TextHAlignment& hAlignment,
|
||||||
int maxLineWidth,
|
int maxLineWidth,
|
||||||
|
@ -344,7 +344,7 @@ public:
|
||||||
virtual bool setBMFontFilePath(std::string_view bmfontFilePath, std::string_view subTextureKey, float fontSize = 0);
|
virtual bool setBMFontFilePath(std::string_view bmfontFilePath, std::string_view subTextureKey, float fontSize = 0);
|
||||||
|
|
||||||
/** Sets a new bitmap font to Label */
|
/** Sets a new bitmap font to Label */
|
||||||
CC_DEPRECATED_ATTRIBUTE virtual bool setBMFontFilePath(std::string_view bmfontFilePath,
|
AX_DEPRECATED_ATTRIBUTE virtual bool setBMFontFilePath(std::string_view bmfontFilePath,
|
||||||
const Vec2& imageOffset,
|
const Vec2& imageOffset,
|
||||||
float fontSize = 0);
|
float fontSize = 0);
|
||||||
|
|
||||||
|
@ -899,7 +899,7 @@ protected:
|
||||||
EventListenerCustom* _purgeTextureListener;
|
EventListenerCustom* _purgeTextureListener;
|
||||||
EventListenerCustom* _resetTextureListener;
|
EventListenerCustom* _resetTextureListener;
|
||||||
|
|
||||||
#if CC_LABEL_DEBUG_DRAW
|
#if AX_LABEL_DEBUG_DRAW
|
||||||
DrawNode* _debugDrawNode;
|
DrawNode* _debugDrawNode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ protected:
|
||||||
backend::UniformLocation _effectTypeLocation;
|
backend::UniformLocation _effectTypeLocation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Label);
|
AX_DISALLOW_COPY_AND_ASSIGN(Label);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end group
|
// end group
|
||||||
|
|
|
@ -32,7 +32,7 @@ THE SOFTWARE.
|
||||||
#include "base/ccUTF8.h"
|
#include "base/ccUTF8.h"
|
||||||
#include "renderer/CCTextureCache.h"
|
#include "renderer/CCTextureCache.h"
|
||||||
|
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
# include "renderer/CCRenderer.h"
|
# include "renderer/CCRenderer.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ LabelAtlas* LabelAtlas::create(std::string_view string,
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ LabelAtlas* LabelAtlas::create(std::string_view string, std::string_view fntFile
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -111,7 +111,7 @@ LabelAtlas* LabelAtlas::create(std::string_view string,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -124,12 +124,12 @@ bool LabelAtlas::initWithString(std::string_view theString, std::string_view fnt
|
||||||
|
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
|
||||||
|
|
||||||
CCASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
|
AXASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
|
||||||
|
|
||||||
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
||||||
|
|
||||||
unsigned int width = static_cast<unsigned int>(dict["itemWidth"].asInt() / CC_CONTENT_SCALE_FACTOR());
|
unsigned int width = static_cast<unsigned int>(dict["itemWidth"].asInt() / AX_CONTENT_SCALE_FACTOR());
|
||||||
unsigned int height = static_cast<unsigned int>(dict["itemHeight"].asInt() / CC_CONTENT_SCALE_FACTOR());
|
unsigned int height = static_cast<unsigned int>(dict["itemHeight"].asInt() / AX_CONTENT_SCALE_FACTOR());
|
||||||
unsigned int startChar = dict["firstChar"].asInt();
|
unsigned int startChar = dict["firstChar"].asInt();
|
||||||
|
|
||||||
this->initWithString(theString, textureFilename, width, height, startChar);
|
this->initWithString(theString, textureFilename, width, height, startChar);
|
||||||
|
@ -152,15 +152,15 @@ void LabelAtlas::updateAtlasValues()
|
||||||
Texture2D* texture = _textureAtlas->getTexture();
|
Texture2D* texture = _textureAtlas->getTexture();
|
||||||
float textureWide = (float)texture->getPixelsWide();
|
float textureWide = (float)texture->getPixelsWide();
|
||||||
float textureHigh = (float)texture->getPixelsHigh();
|
float textureHigh = (float)texture->getPixelsHigh();
|
||||||
float itemWidthInPixels = _itemWidth * CC_CONTENT_SCALE_FACTOR();
|
float itemWidthInPixels = _itemWidth * AX_CONTENT_SCALE_FACTOR();
|
||||||
float itemHeightInPixels = _itemHeight * CC_CONTENT_SCALE_FACTOR();
|
float itemHeightInPixels = _itemHeight * AX_CONTENT_SCALE_FACTOR();
|
||||||
if (_ignoreContentScaleFactor)
|
if (_ignoreContentScaleFactor)
|
||||||
{
|
{
|
||||||
itemWidthInPixels = static_cast<float>(_itemWidth);
|
itemWidthInPixels = static_cast<float>(_itemWidth);
|
||||||
itemHeightInPixels = static_cast<float>(_itemHeight);
|
itemHeightInPixels = static_cast<float>(_itemHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
CCASSERT(n <= _textureAtlas->getCapacity(), "updateAtlasValues: Invalid String length");
|
AXASSERT(n <= _textureAtlas->getCapacity(), "updateAtlasValues: Invalid String length");
|
||||||
V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads();
|
V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads();
|
||||||
for (ssize_t i = 0; i < n; i++)
|
for (ssize_t i = 0; i < n; i++)
|
||||||
{
|
{
|
||||||
|
@ -169,7 +169,7 @@ void LabelAtlas::updateAtlasValues()
|
||||||
float row = (float)(a % _itemsPerRow);
|
float row = (float)(a % _itemsPerRow);
|
||||||
float col = (float)(a / _itemsPerRow);
|
float col = (float)(a / _itemsPerRow);
|
||||||
|
|
||||||
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#if AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
||||||
// Issue #938. Don't use texStepX & texStepY
|
// Issue #938. Don't use texStepX & texStepY
|
||||||
float left = (2 * row * itemWidthInPixels + 1) / (2 * textureWide);
|
float left = (2 * row * itemWidthInPixels + 1) / (2 * textureWide);
|
||||||
float right = left + (itemWidthInPixels * 2 - 2) / (2 * textureWide);
|
float right = left + (itemWidthInPixels * 2 - 2) / (2 * textureWide);
|
||||||
|
@ -180,7 +180,7 @@ void LabelAtlas::updateAtlasValues()
|
||||||
float right = left + itemWidthInPixels / textureWide;
|
float right = left + itemWidthInPixels / textureWide;
|
||||||
float top = col * itemHeightInPixels / textureHigh;
|
float top = col * itemHeightInPixels / textureHigh;
|
||||||
float bottom = top + itemHeightInPixels / textureHigh;
|
float bottom = top + itemHeightInPixels / textureHigh;
|
||||||
#endif // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#endif // ! AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
||||||
|
|
||||||
quads[i].tl.texCoords.u = left;
|
quads[i].tl.texCoords.u = left;
|
||||||
quads[i].tl.texCoords.v = top;
|
quads[i].tl.texCoords.v = top;
|
||||||
|
@ -269,7 +269,7 @@ void LabelAtlas::updateColor()
|
||||||
}
|
}
|
||||||
|
|
||||||
// CCLabelAtlas - draw
|
// CCLabelAtlas - draw
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
void LabelAtlas::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
void LabelAtlas::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
AtlasNode::draw(renderer, transform, _transformUpdated);
|
AtlasNode::draw(renderer, transform, _transformUpdated);
|
||||||
|
|
|
@ -29,7 +29,7 @@ THE SOFTWARE.
|
||||||
#define __CCLABEL_ATLAS_H__
|
#define __CCLABEL_ATLAS_H__
|
||||||
|
|
||||||
#include "2d/CCAtlasNode.h"
|
#include "2d/CCAtlasNode.h"
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
# include "renderer/CCCustomCommand.h"
|
# include "renderer/CCCustomCommand.h"
|
||||||
# include "2d/CCDrawNode.h"
|
# include "2d/CCDrawNode.h"
|
||||||
#endif
|
#endif
|
||||||
|
@ -53,7 +53,7 @@ NS_AX_BEGIN
|
||||||
*
|
*
|
||||||
* A more flexible class is LabelBMFont. It supports variable width characters and it also has a nice editor.
|
* A more flexible class is LabelBMFont. It supports variable width characters and it also has a nice editor.
|
||||||
*/
|
*/
|
||||||
class CC_DLL LabelAtlas : public AtlasNode, public LabelProtocol
|
class AX_DLL LabelAtlas : public AtlasNode, public LabelProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the LabelAtlas with a string, a char map file(the atlas), the width and height of each element and the
|
/** Creates the LabelAtlas with a string, a char map file(the atlas), the width and height of each element and the
|
||||||
|
@ -107,13 +107,13 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual std::string getDescription() const override;
|
virtual std::string getDescription() const override;
|
||||||
|
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
virtual void draw(Renderer* renderer, const Mat4& transform, uint32_t flags) override;
|
virtual void draw(Renderer* renderer, const Mat4& transform, uint32_t flags) override;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
LabelAtlas()
|
LabelAtlas()
|
||||||
{
|
{
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
_debugDrawNode = DrawNode::create();
|
_debugDrawNode = DrawNode::create();
|
||||||
addChild(_debugDrawNode);
|
addChild(_debugDrawNode);
|
||||||
#endif
|
#endif
|
||||||
|
@ -124,7 +124,7 @@ public:
|
||||||
protected:
|
protected:
|
||||||
virtual void updateColor() override;
|
virtual void updateColor() override;
|
||||||
|
|
||||||
#if CC_LABELATLAS_DEBUG_DRAW
|
#if AX_LABELATLAS_DEBUG_DRAW
|
||||||
DrawNode* _debugDrawNode;
|
DrawNode* _debugDrawNode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -83,7 +83,7 @@ int Label::getFirstWordLen(const std::u32string& utf32Text, int startIndex, int
|
||||||
int len = 0;
|
int len = 0;
|
||||||
auto nextLetterX = 0;
|
auto nextLetterX = 0;
|
||||||
FontLetterDefinition letterDef;
|
FontLetterDefinition letterDef;
|
||||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = AX_CONTENT_SCALE_FACTOR();
|
||||||
|
|
||||||
for (int index = startIndex; index < textLen; ++index)
|
for (int index = startIndex; index < textLen; ++index)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ void Label::updateBMFontScale()
|
||||||
{
|
{
|
||||||
FontFNT* bmFont = (FontFNT*)font;
|
FontFNT* bmFont = (FontFNT*)font;
|
||||||
auto originalFontSize = bmFont->getOriginalFontSize();
|
auto originalFontSize = bmFont->getOriginalFontSize();
|
||||||
_bmfontScale = _bmFontSize * CC_CONTENT_SCALE_FACTOR() / originalFontSize;
|
_bmfontScale = _bmFontSize * AX_CONTENT_SCALE_FACTOR() / originalFontSize;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
|
||||||
float letterRight = 0.f;
|
float letterRight = 0.f;
|
||||||
float nextWhitespaceWidth = 0.f;
|
float nextWhitespaceWidth = 0.f;
|
||||||
|
|
||||||
auto contentScaleFactor = CC_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = AX_CONTENT_SCALE_FACTOR();
|
||||||
float lineSpacing = _lineSpacing * contentScaleFactor;
|
float lineSpacing = _lineSpacing * contentScaleFactor;
|
||||||
float highestY = 0.f;
|
float highestY = 0.f;
|
||||||
float lowestY = 0.f;
|
float lowestY = 0.f;
|
||||||
|
@ -212,7 +212,7 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
|
||||||
if (!getFontLetterDef(character, letterDef))
|
if (!getFontLetterDef(character, letterDef))
|
||||||
{
|
{
|
||||||
recordPlaceholderInfo(letterIndex, character);
|
recordPlaceholderInfo(letterIndex, character);
|
||||||
CCLOG("LabelTextFormatter error: can't find letter definition in font file for letter: 0x%x",
|
AXLOG("LabelTextFormatter error: can't find letter definition in font file for letter: 0x%x",
|
||||||
character);
|
character);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -318,12 +318,12 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
|
||||||
|
|
||||||
bool Label::multilineTextWrapByWord()
|
bool Label::multilineTextWrapByWord()
|
||||||
{
|
{
|
||||||
return multilineTextWrap(CC_CALLBACK_3(Label::getFirstWordLen, this));
|
return multilineTextWrap(AX_CALLBACK_3(Label::getFirstWordLen, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::multilineTextWrapByChar()
|
bool Label::multilineTextWrapByChar()
|
||||||
{
|
{
|
||||||
return multilineTextWrap(CC_CALLBACK_3(Label::getFirstCharLen, this));
|
return multilineTextWrap(AX_CALLBACK_3(Label::getFirstCharLen, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::isVerticalClamp()
|
bool Label::isVerticalClamp()
|
||||||
|
|
|
@ -46,7 +46,7 @@ THE SOFTWARE.
|
||||||
#include "renderer/ccShaders.h"
|
#include "renderer/ccShaders.h"
|
||||||
#include "renderer/backend/ProgramState.h"
|
#include "renderer/backend/ProgramState.h"
|
||||||
|
|
||||||
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
|
#if (AX_TARGET_PLATFORM == AX_PLATFORM_MAC)
|
||||||
# include "platform/desktop/CCGLViewImpl-desktop.h"
|
# include "platform/desktop/CCGLViewImpl-desktop.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ LayerColor* LayerColor::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ LayerColor* LayerColor::create(const Color4B& color, float width, float height)
|
||||||
layer->autorelease();
|
layer->autorelease();
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(layer);
|
AX_SAFE_DELETE(layer);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -97,7 +97,7 @@ LayerColor* LayerColor::create(const Color4B& color)
|
||||||
layer->autorelease();
|
layer->autorelease();
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(layer);
|
AX_SAFE_DELETE(layer);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -162,7 +162,7 @@ LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end)
|
||||||
layer->autorelease();
|
layer->autorelease();
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(layer);
|
AX_SAFE_DELETE(layer);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -174,7 +174,7 @@ LayerGradient* LayerGradient::create(const Color4B& start, const Color4B& end, c
|
||||||
layer->autorelease();
|
layer->autorelease();
|
||||||
return layer;
|
return layer;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(layer);
|
AX_SAFE_DELETE(layer);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ LayerGradient* LayerGradient::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ LayerRadialGradient::LayerRadialGradient()
|
||||||
|
|
||||||
LayerRadialGradient::~LayerRadialGradient()
|
LayerRadialGradient::~LayerRadialGradient()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE_NULL(_customCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE_NULL(_customCommand.getPipelineDescriptor().programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool LayerRadialGradient::initWithColor(const axis::Color4B& startColor,
|
bool LayerRadialGradient::initWithColor(const axis::Color4B& startColor,
|
||||||
|
@ -603,7 +603,7 @@ LayerMultiplex* LayerMultiplex::create(Node* layer, ...)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
va_end(args);
|
va_end(args);
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ LayerMultiplex* LayerMultiplex::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -635,20 +635,20 @@ LayerMultiplex* LayerMultiplex::createWithArray(const Vector<Node*>& arrayOfLaye
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerMultiplex::addLayer(Node* layer)
|
void LayerMultiplex::addLayer(Node* layer)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, layer);
|
sEngine->retainScriptObject(this, layer);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_layers.pushBack(layer);
|
_layers.pushBack(layer);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -667,24 +667,24 @@ bool LayerMultiplex::initWithLayers(Node* layer, va_list params)
|
||||||
if (Node::initLayer())
|
if (Node::initLayer())
|
||||||
{
|
{
|
||||||
_layers.reserve(5);
|
_layers.reserve(5);
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, layer);
|
sEngine->retainScriptObject(this, layer);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_layers.pushBack(layer);
|
_layers.pushBack(layer);
|
||||||
|
|
||||||
Node* l = va_arg(params, Node*);
|
Node* l = va_arg(params, Node*);
|
||||||
while (l)
|
while (l)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, l);
|
sEngine->retainScriptObject(this, l);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_layers.pushBack(l);
|
_layers.pushBack(l);
|
||||||
l = va_arg(params, Node*);
|
l = va_arg(params, Node*);
|
||||||
}
|
}
|
||||||
|
@ -701,7 +701,7 @@ bool LayerMultiplex::initWithArray(const Vector<Node*>& arrayOfLayers)
|
||||||
{
|
{
|
||||||
if (Node::initLayer())
|
if (Node::initLayer())
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -713,7 +713,7 @@ bool LayerMultiplex::initWithArray(const Vector<Node*>& arrayOfLayers)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_layers.reserve(arrayOfLayers.size());
|
_layers.reserve(arrayOfLayers.size());
|
||||||
_layers.pushBack(arrayOfLayers);
|
_layers.pushBack(arrayOfLayers);
|
||||||
|
|
||||||
|
@ -732,7 +732,7 @@ void LayerMultiplex::switchTo(int n)
|
||||||
|
|
||||||
void LayerMultiplex::switchTo(int n, bool cleanup)
|
void LayerMultiplex::switchTo(int n, bool cleanup)
|
||||||
{
|
{
|
||||||
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
AXASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
||||||
|
|
||||||
this->removeChild(_layers.at(_enabledLayer), cleanup);
|
this->removeChild(_layers.at(_enabledLayer), cleanup);
|
||||||
|
|
||||||
|
@ -743,16 +743,16 @@ void LayerMultiplex::switchTo(int n, bool cleanup)
|
||||||
|
|
||||||
void LayerMultiplex::switchToAndReleaseMe(int n)
|
void LayerMultiplex::switchToAndReleaseMe(int n)
|
||||||
{
|
{
|
||||||
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
AXASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
||||||
|
|
||||||
this->removeChild(_layers.at(_enabledLayer), true);
|
this->removeChild(_layers.at(_enabledLayer), true);
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->releaseScriptObject(this, _layers.at(_enabledLayer));
|
sEngine->releaseScriptObject(this, _layers.at(_enabledLayer));
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
|
|
||||||
_layers.replace(_enabledLayer, nullptr);
|
_layers.replace(_enabledLayer, nullptr);
|
||||||
|
|
||||||
|
|
|
@ -41,7 +41,7 @@ NS_AX_BEGIN
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* !!!HACK, the memory model of 'Layer' is identical to 'Node' */
|
/* !!!HACK, the memory model of 'Layer' is identical to 'Node' */
|
||||||
class CC_DLL Layer : public Node
|
class AX_DLL Layer : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static Layer* create();
|
static Layer* create();
|
||||||
|
@ -56,7 +56,7 @@ All features from Layer are valid, plus the following new features:
|
||||||
- opacity
|
- opacity
|
||||||
- RGB colors
|
- RGB colors
|
||||||
*/
|
*/
|
||||||
class CC_DLL LayerColor : public Sprite
|
class AX_DLL LayerColor : public Sprite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
bool initWithColor(const Color4B& color);
|
bool initWithColor(const Color4B& color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
AX_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ If ' compressedInterpolation' is enabled (default mode) you will see both the st
|
||||||
|
|
||||||
@since v0.99.5
|
@since v0.99.5
|
||||||
*/
|
*/
|
||||||
class CC_DLL LayerGradient : public LayerColor
|
class AX_DLL LayerGradient : public LayerColor
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a fullscreen black layer.
|
/** Creates a fullscreen black layer.
|
||||||
|
@ -257,7 +257,7 @@ protected:
|
||||||
* @brief LayerRadialGradient is a subclass of Layer that draws radial gradients across the background.
|
* @brief LayerRadialGradient is a subclass of Layer that draws radial gradients across the background.
|
||||||
@since v3.16
|
@since v3.16
|
||||||
*/
|
*/
|
||||||
class CC_DLL LayerRadialGradient : public Node, BlendProtocol
|
class AX_DLL LayerRadialGradient : public Node, BlendProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a LayerRadialGradient
|
/** Create a LayerRadialGradient
|
||||||
|
@ -349,7 +349,7 @@ Features:
|
||||||
- It supports one or more children
|
- It supports one or more children
|
||||||
- Only one children will be active a time
|
- Only one children will be active a time
|
||||||
*/
|
*/
|
||||||
class CC_DLL LayerMultiplex : public Node
|
class AX_DLL LayerMultiplex : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates and initializes a LayerMultiplex object.
|
/** Creates and initializes a LayerMultiplex object.
|
||||||
|
@ -439,7 +439,7 @@ protected:
|
||||||
Vector<Node*> _layers;
|
Vector<Node*> _layers;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(LayerMultiplex);
|
AX_DISALLOW_COPY_AND_ASSIGN(LayerMultiplex);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -29,7 +29,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
void BaseLight::setIntensity(float intensity)
|
void BaseLight::setIntensity(float intensity)
|
||||||
{
|
{
|
||||||
CC_ASSERT(intensity >= 0);
|
AX_ASSERT(intensity >= 0);
|
||||||
_intensity = intensity;
|
_intensity = intensity;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,8 +61,8 @@ void BaseLight::onExit()
|
||||||
void BaseLight::setRotationFromDirection(const Vec3& direction)
|
void BaseLight::setRotationFromDirection(const Vec3& direction)
|
||||||
{
|
{
|
||||||
float projLen = sqrt(direction.x * direction.x + direction.z * direction.z);
|
float projLen = sqrt(direction.x * direction.x + direction.z * direction.z);
|
||||||
float rotY = CC_RADIANS_TO_DEGREES(atan2f(-direction.x, -direction.z));
|
float rotY = AX_RADIANS_TO_DEGREES(atan2f(-direction.x, -direction.z));
|
||||||
float rotX = -CC_RADIANS_TO_DEGREES(atan2f(-direction.y, projLen));
|
float rotX = -AX_RADIANS_TO_DEGREES(atan2f(-direction.y, projLen));
|
||||||
setRotation3D(Vec3(rotX, rotY, 0.0f));
|
setRotation3D(Vec3(rotX, rotY, 0.0f));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -61,7 +61,7 @@ enum class LightFlag
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL BaseLight : public Node
|
class AX_DLL BaseLight : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -103,7 +103,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL DirectionLight : public BaseLight
|
class AX_DLL DirectionLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL PointLight : public BaseLight
|
class AX_DLL PointLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +172,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL SpotLight : public BaseLight
|
class AX_DLL SpotLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -270,7 +270,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL AmbientLight : public BaseLight
|
class AX_DLL AmbientLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum
|
||||||
|
|
||||||
Menu::~Menu()
|
Menu::~Menu()
|
||||||
{
|
{
|
||||||
CCLOGINFO("In the destructor of Menu. %p", this);
|
AXLOGINFO("In the destructor of Menu. %p", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
Menu* Menu::create()
|
Menu* Menu::create()
|
||||||
|
@ -79,7 +79,7 @@ Menu* Menu::createWithArray(const Vector<MenuItem*>& arrayOfItems)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -144,10 +144,10 @@ bool Menu::initWithArray(const Vector<MenuItem*>& arrayOfItems)
|
||||||
auto touchListener = EventListenerTouchOneByOne::create();
|
auto touchListener = EventListenerTouchOneByOne::create();
|
||||||
touchListener->setSwallowTouches(true);
|
touchListener->setSwallowTouches(true);
|
||||||
|
|
||||||
touchListener->onTouchBegan = CC_CALLBACK_2(Menu::onTouchBegan, this);
|
touchListener->onTouchBegan = AX_CALLBACK_2(Menu::onTouchBegan, this);
|
||||||
touchListener->onTouchMoved = CC_CALLBACK_2(Menu::onTouchMoved, this);
|
touchListener->onTouchMoved = AX_CALLBACK_2(Menu::onTouchMoved, this);
|
||||||
touchListener->onTouchEnded = CC_CALLBACK_2(Menu::onTouchEnded, this);
|
touchListener->onTouchEnded = AX_CALLBACK_2(Menu::onTouchEnded, this);
|
||||||
touchListener->onTouchCancelled = CC_CALLBACK_2(Menu::onTouchCancelled, this);
|
touchListener->onTouchCancelled = AX_CALLBACK_2(Menu::onTouchCancelled, this);
|
||||||
|
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
|
||||||
|
|
||||||
|
@ -171,13 +171,13 @@ void Menu::addChild(Node* child, int zOrder)
|
||||||
|
|
||||||
void Menu::addChild(Node* child, int zOrder, int tag)
|
void Menu::addChild(Node* child, int zOrder, int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
||||||
Node::addChild(child, zOrder, tag);
|
Node::addChild(child, zOrder, tag);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Menu::addChild(Node* child, int zOrder, std::string_view name)
|
void Menu::addChild(Node* child, int zOrder, std::string_view name)
|
||||||
{
|
{
|
||||||
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
||||||
Node::addChild(child, zOrder, name);
|
Node::addChild(child, zOrder, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -204,7 +204,7 @@ void Menu::onExit()
|
||||||
|
|
||||||
void Menu::removeChild(Node* child, bool cleanup)
|
void Menu::removeChild(Node* child, bool cleanup)
|
||||||
{
|
{
|
||||||
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
|
||||||
|
|
||||||
if (_selectedItem == child)
|
if (_selectedItem == child)
|
||||||
{
|
{
|
||||||
|
@ -247,7 +247,7 @@ bool Menu::onTouchBegan(Touch* touch, Event* /*event*/)
|
||||||
|
|
||||||
void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/)
|
void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/)
|
||||||
{
|
{
|
||||||
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchEnded] -- invalid state");
|
AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchEnded] -- invalid state");
|
||||||
this->retain();
|
this->retain();
|
||||||
if (_selectedItem)
|
if (_selectedItem)
|
||||||
{
|
{
|
||||||
|
@ -261,7 +261,7 @@ void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/)
|
||||||
|
|
||||||
void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/)
|
void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/)
|
||||||
{
|
{
|
||||||
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchCancelled] -- invalid state");
|
AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchCancelled] -- invalid state");
|
||||||
this->retain();
|
this->retain();
|
||||||
if (_selectedItem)
|
if (_selectedItem)
|
||||||
{
|
{
|
||||||
|
@ -273,7 +273,7 @@ void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/)
|
||||||
|
|
||||||
void Menu::onTouchMoved(Touch* touch, Event* /*event*/)
|
void Menu::onTouchMoved(Touch* touch, Event* /*event*/)
|
||||||
{
|
{
|
||||||
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchMoved] -- invalid state");
|
AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchMoved] -- invalid state");
|
||||||
MenuItem* currentItem = this->getItemForTouch(touch, _selectedWithCamera);
|
MenuItem* currentItem = this->getItemForTouch(touch, _selectedWithCamera);
|
||||||
if (currentItem != _selectedItem)
|
if (currentItem != _selectedItem)
|
||||||
{
|
{
|
||||||
|
@ -343,7 +343,7 @@ void Menu::alignItemsInColumns(int columns, ...)
|
||||||
|
|
||||||
void Menu::alignItemsInColumns(int columns, va_list args)
|
void Menu::alignItemsInColumns(int columns, va_list args)
|
||||||
{
|
{
|
||||||
CCASSERT(columns >= 0, "Columns must be >= 0");
|
AXASSERT(columns >= 0, "Columns must be >= 0");
|
||||||
ValueVector rows;
|
ValueVector rows;
|
||||||
while (columns)
|
while (columns)
|
||||||
{
|
{
|
||||||
|
@ -363,11 +363,11 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
|
||||||
|
|
||||||
for (const auto& child : _children)
|
for (const auto& child : _children)
|
||||||
{
|
{
|
||||||
CCASSERT(row < rows.size(), "row should less than rows.size()!");
|
AXASSERT(row < rows.size(), "row should less than rows.size()!");
|
||||||
|
|
||||||
rowColumns = rows[row].asInt();
|
rowColumns = rows[row].asInt();
|
||||||
// can not have zero columns on a row
|
// can not have zero columns on a row
|
||||||
CCASSERT(rowColumns, "rowColumns can't be 0.");
|
AXASSERT(rowColumns, "rowColumns can't be 0.");
|
||||||
|
|
||||||
float tmp = child->getContentSize().height;
|
float tmp = child->getContentSize().height;
|
||||||
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
|
||||||
|
@ -384,7 +384,7 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if too many rows/columns for available menu items
|
// check if too many rows/columns for available menu items
|
||||||
CCASSERT(!columnsOccupied, "columnsOccupied should be 0.");
|
AXASSERT(!columnsOccupied, "columnsOccupied should be 0.");
|
||||||
|
|
||||||
Vec2 winSize = getContentSize();
|
Vec2 winSize = getContentSize();
|
||||||
|
|
||||||
|
@ -460,11 +460,11 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
|
||||||
for (const auto& child : _children)
|
for (const auto& child : _children)
|
||||||
{
|
{
|
||||||
// check if too many menu items for the amount of rows/columns
|
// check if too many menu items for the amount of rows/columns
|
||||||
CCASSERT(column < columns.size(), "column should be less than columns.size().");
|
AXASSERT(column < columns.size(), "column should be less than columns.size().");
|
||||||
|
|
||||||
columnRows = columns[column].asInt();
|
columnRows = columns[column].asInt();
|
||||||
// can't have zero rows on a column
|
// can't have zero rows on a column
|
||||||
CCASSERT(columnRows, "columnRows can't be 0.");
|
AXASSERT(columnRows, "columnRows can't be 0.");
|
||||||
|
|
||||||
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
// columnWidth = fmaxf(columnWidth, [item contentSize].width);
|
||||||
float tmp = child->getContentSize().width;
|
float tmp = child->getContentSize().width;
|
||||||
|
@ -487,7 +487,7 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
|
||||||
}
|
}
|
||||||
|
|
||||||
// check if too many rows/columns for available menu items.
|
// check if too many rows/columns for available menu items.
|
||||||
CCASSERT(!rowsOccupied, "rowsOccupied should be 0.");
|
AXASSERT(!rowsOccupied, "rowsOccupied should be 0.");
|
||||||
|
|
||||||
Vec2 winSize = getContentSize();
|
Vec2 winSize = getContentSize();
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ class Touch;
|
||||||
* - You can add MenuItem objects in runtime using addChild.
|
* - You can add MenuItem objects in runtime using addChild.
|
||||||
* - But the only accepted children are MenuItem objects.
|
* - But the only accepted children are MenuItem objects.
|
||||||
*/
|
*/
|
||||||
class CC_DLL Menu : public Node
|
class AX_DLL Menu : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -63,7 +63,7 @@ public:
|
||||||
static Menu* create();
|
static Menu* create();
|
||||||
|
|
||||||
/** Creates a Menu with MenuItem objects. */
|
/** Creates a Menu with MenuItem objects. */
|
||||||
static Menu* create(MenuItem* item, ...) CC_REQUIRES_NULL_TERMINATION;
|
static Menu* create(MenuItem* item, ...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Creates a Menu with a Array of MenuItem objects.
|
* Creates a Menu with a Array of MenuItem objects.
|
||||||
|
@ -101,7 +101,7 @@ public:
|
||||||
void alignItemsHorizontallyWithPadding(float padding);
|
void alignItemsHorizontallyWithPadding(float padding);
|
||||||
|
|
||||||
/** Align items in rows of columns. */
|
/** Align items in rows of columns. */
|
||||||
void alignItemsInColumns(int columns, ...) CC_REQUIRES_NULL_TERMINATION;
|
void alignItemsInColumns(int columns, ...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
|
|
||||||
/** Align items in rows of columns. */
|
/** Align items in rows of columns. */
|
||||||
void alignItemsInColumns(int columns, va_list args);
|
void alignItemsInColumns(int columns, va_list args);
|
||||||
|
@ -112,7 +112,7 @@ public:
|
||||||
void alignItemsInColumnsWithArray(const ValueVector& rows);
|
void alignItemsInColumnsWithArray(const ValueVector& rows);
|
||||||
|
|
||||||
/** Align items in columns of rows. */
|
/** Align items in columns of rows. */
|
||||||
void alignItemsInRows(int rows, ...) CC_REQUIRES_NULL_TERMINATION;
|
void alignItemsInRows(int rows, ...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
|
|
||||||
/** Align items in columns of rows. */
|
/** Align items in columns of rows. */
|
||||||
void alignItemsInRows(int rows, va_list args);
|
void alignItemsInRows(int rows, va_list args);
|
||||||
|
@ -179,7 +179,7 @@ protected:
|
||||||
const Camera* _selectedWithCamera;
|
const Camera* _selectedWithCamera;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Menu);
|
AX_DISALLOW_COPY_AND_ASSIGN(Menu);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -88,7 +88,7 @@ void MenuItem::activate()
|
||||||
{
|
{
|
||||||
_callback(this);
|
_callback(this);
|
||||||
}
|
}
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
BasicScriptData data(this);
|
BasicScriptData data(this);
|
||||||
ScriptEvent scriptEvent(kMenuClickedEvent, &data);
|
ScriptEvent scriptEvent(kMenuClickedEvent, &data);
|
||||||
ScriptEngineManager::sendEventToLua(scriptEvent);
|
ScriptEngineManager::sendEventToLua(scriptEvent);
|
||||||
|
@ -289,7 +289,7 @@ bool MenuItemAtlasFont::initWithString(std::string_view value,
|
||||||
char startCharMap,
|
char startCharMap,
|
||||||
const ccMenuCallback& callback)
|
const ccMenuCallback& callback)
|
||||||
{
|
{
|
||||||
CCASSERT(value.size() != 0, "value length must be greater than 0");
|
AXASSERT(value.size() != 0, "value length must be greater than 0");
|
||||||
LabelAtlas* label = LabelAtlas::create(value, charMapFile, itemWidth, itemHeight, startCharMap);
|
LabelAtlas* label = LabelAtlas::create(value, charMapFile, itemWidth, itemHeight, startCharMap);
|
||||||
if (MenuItemLabel::initWithLabel(label, callback))
|
if (MenuItemLabel::initWithLabel(label, callback))
|
||||||
{
|
{
|
||||||
|
@ -347,12 +347,12 @@ MenuItemFont::MenuItemFont() : _fontSize(0), _fontName("") {}
|
||||||
|
|
||||||
MenuItemFont::~MenuItemFont()
|
MenuItemFont::~MenuItemFont()
|
||||||
{
|
{
|
||||||
CCLOGINFO("In the destructor of MenuItemFont (%p).", this);
|
AXLOGINFO("In the destructor of MenuItemFont (%p).", this);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MenuItemFont::initWithString(std::string_view value, const ccMenuCallback& callback)
|
bool MenuItemFont::initWithString(std::string_view value, const ccMenuCallback& callback)
|
||||||
{
|
{
|
||||||
CCASSERT(!value.empty(), "Value length must be greater than 0");
|
AXASSERT(!value.empty(), "Value length must be greater than 0");
|
||||||
|
|
||||||
_fontName = _globalFontName;
|
_fontName = _globalFontName;
|
||||||
_fontSize = _globalFontSize;
|
_fontSize = _globalFontSize;
|
||||||
|
@ -591,7 +591,7 @@ MenuItemImage* MenuItemImage::create()
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -623,7 +623,7 @@ MenuItemImage* MenuItemImage::create(std::string_view normalImage,
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -637,7 +637,7 @@ MenuItemImage* MenuItemImage::create(std::string_view normalImage,
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,7 +694,7 @@ MenuItemToggle* MenuItemToggle::createWithCallback(const ccMenuCallback& callbac
|
||||||
MenuItemToggle* ret = new MenuItemToggle();
|
MenuItemToggle* ret = new MenuItemToggle();
|
||||||
ret->MenuItem::initWithCallback(callback);
|
ret->MenuItem::initWithCallback(callback);
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -706,7 +706,7 @@ MenuItemToggle* MenuItemToggle::createWithCallback(const ccMenuCallback& callbac
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
ret->_subItems = menuItems;
|
ret->_subItems = menuItems;
|
||||||
ret->_selectedIndex = UINT_MAX;
|
ret->_selectedIndex = UINT_MAX;
|
||||||
ret->setSelectedIndex(0);
|
ret->setSelectedIndex(0);
|
||||||
|
@ -739,19 +739,19 @@ bool MenuItemToggle::initWithCallback(const ccMenuCallback& callback, MenuItem*
|
||||||
int z = 0;
|
int z = 0;
|
||||||
MenuItem* i = item;
|
MenuItem* i = item;
|
||||||
|
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
|
|
||||||
while (i)
|
while (i)
|
||||||
{
|
{
|
||||||
z++;
|
z++;
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, i);
|
sEngine->retainScriptObject(this, i);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_subItems.pushBack(i);
|
_subItems.pushBack(i);
|
||||||
i = va_arg(args, MenuItem*);
|
i = va_arg(args, MenuItem*);
|
||||||
}
|
}
|
||||||
|
@ -787,13 +787,13 @@ bool MenuItemToggle::initWithItem(MenuItem* item)
|
||||||
|
|
||||||
void MenuItemToggle::addSubItem(MenuItem* item)
|
void MenuItemToggle::addSubItem(MenuItem* item)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, item);
|
sEngine->retainScriptObject(this, item);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_subItems.pushBack(item);
|
_subItems.pushBack(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -801,7 +801,7 @@ void MenuItemToggle::cleanup()
|
||||||
{
|
{
|
||||||
for (const auto& item : _subItems)
|
for (const auto& item : _subItems)
|
||||||
{
|
{
|
||||||
#if defined(CC_NATIVE_CONTROL_SCRIPT) && !CC_NATIVE_CONTROL_SCRIPT
|
#if defined(AX_NATIVE_CONTROL_SCRIPT) && !AX_NATIVE_CONTROL_SCRIPT
|
||||||
ScriptEngineManager::getInstance()->getScriptEngine()->releaseScriptObject(this, item);
|
ScriptEngineManager::getInstance()->getScriptEngine()->releaseScriptObject(this, item);
|
||||||
#endif
|
#endif
|
||||||
item->cleanup();
|
item->cleanup();
|
||||||
|
|
|
@ -55,7 +55,7 @@ class SpriteFrame;
|
||||||
*
|
*
|
||||||
* Subclass MenuItem (or any subclass) to create your custom MenuItem objects.
|
* Subclass MenuItem (or any subclass) to create your custom MenuItem objects.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItem : public Node
|
class AX_DLL MenuItem : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a MenuItem with no target/selector. */
|
/** Creates a MenuItem with no target/selector. */
|
||||||
|
@ -113,7 +113,7 @@ protected:
|
||||||
ccMenuCallback _callback;
|
ccMenuCallback _callback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief An abstract class for "label" MenuItemLabel items.
|
/** @brief An abstract class for "label" MenuItemLabel items.
|
||||||
|
@ -124,7 +124,7 @@ private:
|
||||||
- LabelTTF
|
- LabelTTF
|
||||||
- Label
|
- Label
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemLabel : public MenuItem
|
class AX_DLL MenuItemLabel : public MenuItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a MenuItemLabel with a Label and a callback. */
|
/** Creates a MenuItemLabel with a Label and a callback. */
|
||||||
|
@ -180,13 +180,13 @@ protected:
|
||||||
Node* _label;
|
Node* _label;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemLabel);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemLabel);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief A MenuItemAtlasFont.
|
/** @brief A MenuItemAtlasFont.
|
||||||
Helper class that creates a MenuItemLabel class with a LabelAtlas.
|
Helper class that creates a MenuItemLabel class with a LabelAtlas.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemAtlasFont : public MenuItemLabel
|
class AX_DLL MenuItemAtlasFont : public MenuItemLabel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a menu item from a string and atlas with a target/selector. */
|
/** Creates a menu item from a string and atlas with a target/selector. */
|
||||||
|
@ -222,13 +222,13 @@ public:
|
||||||
const ccMenuCallback& callback);
|
const ccMenuCallback& callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief A MenuItemFont.
|
/** @brief A MenuItemFont.
|
||||||
Helper class that creates a MenuItemLabel class with a Label.
|
Helper class that creates a MenuItemLabel class with a Label.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemFont : public MenuItemLabel
|
class AX_DLL MenuItemFont : public MenuItemLabel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a menu item from a string without target/selector. To be used with MenuItemToggle. */
|
/** Creates a menu item from a string without target/selector. To be used with MenuItemToggle. */
|
||||||
|
@ -292,7 +292,7 @@ protected:
|
||||||
std::string _fontName;
|
std::string _fontName;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemFont);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemFont);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief MenuItemSprite accepts Node<RGBAProtocol> objects as items.
|
/** @brief MenuItemSprite accepts Node<RGBAProtocol> objects as items.
|
||||||
|
@ -303,7 +303,7 @@ private:
|
||||||
|
|
||||||
@since v0.8.0
|
@since v0.8.0
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemSprite : public MenuItem
|
class AX_DLL MenuItemSprite : public MenuItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a menu item with a normal, selected and disabled image.*/
|
/** Creates a menu item with a normal, selected and disabled image.*/
|
||||||
|
@ -365,7 +365,7 @@ protected:
|
||||||
Node* _disabledImage;
|
Node* _disabledImage;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemSprite);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemSprite);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief MenuItemImage accepts images as items.
|
/** @brief MenuItemImage accepts images as items.
|
||||||
|
@ -376,7 +376,7 @@ private:
|
||||||
|
|
||||||
For best results try that all images are of the same size.
|
For best results try that all images are of the same size.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemImage : public MenuItemSprite
|
class AX_DLL MenuItemImage : public MenuItemSprite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates an MenuItemImage. */
|
/** Creates an MenuItemImage. */
|
||||||
|
@ -423,14 +423,14 @@ public:
|
||||||
const ccMenuCallback& callback);
|
const ccMenuCallback& callback);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @brief A MenuItemToggle.
|
/** @brief A MenuItemToggle.
|
||||||
A simple container class that "toggles" it's inner items.
|
A simple container class that "toggles" it's inner items.
|
||||||
The inner items can be any MenuItem.
|
The inner items can be any MenuItem.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MenuItemToggle : public MenuItem
|
class AX_DLL MenuItemToggle : public MenuItem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -440,7 +440,7 @@ public:
|
||||||
/** Creates a menu item from a list of items with a callable object. */
|
/** Creates a menu item from a list of items with a callable object. */
|
||||||
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback,
|
static MenuItemToggle* createWithCallback(const ccMenuCallback& callback,
|
||||||
MenuItem* item,
|
MenuItem* item,
|
||||||
...) CC_REQUIRES_NULL_TERMINATION;
|
...) AX_REQUIRES_NULL_TERMINATION;
|
||||||
/** Creates a menu item with no target/selector and no items. */
|
/** Creates a menu item with no target/selector and no items. */
|
||||||
static MenuItemToggle* create();
|
static MenuItemToggle* create();
|
||||||
|
|
||||||
|
@ -501,7 +501,7 @@ protected:
|
||||||
Vector<MenuItem*> _subItems;
|
Vector<MenuItem*> _subItems;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of 2d group
|
// end of 2d group
|
||||||
|
|
|
@ -44,12 +44,12 @@ MotionStreak::MotionStreak()
|
||||||
|
|
||||||
MotionStreak::~MotionStreak()
|
MotionStreak::~MotionStreak()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
CC_SAFE_FREE(_pointState);
|
AX_SAFE_FREE(_pointState);
|
||||||
CC_SAFE_FREE(_pointVertexes);
|
AX_SAFE_FREE(_pointVertexes);
|
||||||
CC_SAFE_FREE(_vertices);
|
AX_SAFE_FREE(_vertices);
|
||||||
CC_SAFE_FREE(_colorPointer);
|
AX_SAFE_FREE(_colorPointer);
|
||||||
CC_SAFE_FREE(_texCoords);
|
AX_SAFE_FREE(_texCoords);
|
||||||
}
|
}
|
||||||
|
|
||||||
MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
|
MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
|
||||||
|
@ -61,7 +61,7 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,13 +74,13 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
|
bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
|
||||||
{
|
{
|
||||||
CCASSERT(!path.empty(), "Invalid filename");
|
AXASSERT(!path.empty(), "Invalid filename");
|
||||||
|
|
||||||
Texture2D* texture = _director->getTextureCache()->addImage(path);
|
Texture2D* texture = _director->getTextureCache()->addImage(path);
|
||||||
return initWithFade(fade, minSeg, stroke, color, texture);
|
return initWithFade(fade, minSeg, stroke, color, texture);
|
||||||
|
@ -215,8 +215,8 @@ void MotionStreak::setTexture(Texture2D* texture)
|
||||||
{
|
{
|
||||||
if (_texture != texture)
|
if (_texture != texture)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(texture);
|
AX_SAFE_RETAIN(texture);
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
_texture = texture;
|
_texture = texture;
|
||||||
|
|
||||||
setProgramStateWithRegistry(backend::ProgramType::POSITION_TEXTURE_COLOR, _texture);
|
setProgramStateWithRegistry(backend::ProgramType::POSITION_TEXTURE_COLOR, _texture);
|
||||||
|
@ -227,7 +227,7 @@ bool MotionStreak::setProgramState(backend::ProgramState* programState, bool nee
|
||||||
{
|
{
|
||||||
if (Node::setProgramState(programState, needsRetain))
|
if (Node::setProgramState(programState, needsRetain))
|
||||||
{
|
{
|
||||||
CCASSERT(programState, "argument should not be nullptr");
|
AXASSERT(programState, "argument should not be nullptr");
|
||||||
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
|
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
|
||||||
pipelineDescriptor.programState = _programState;
|
pipelineDescriptor.programState = _programState;
|
||||||
|
|
||||||
|
@ -273,12 +273,12 @@ const BlendFunc& MotionStreak::getBlendFunc() const
|
||||||
|
|
||||||
void MotionStreak::setOpacity(uint8_t /*opacity*/)
|
void MotionStreak::setOpacity(uint8_t /*opacity*/)
|
||||||
{
|
{
|
||||||
CCASSERT(false, "Set opacity no supported");
|
AXASSERT(false, "Set opacity no supported");
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t MotionStreak::getOpacity() const
|
uint8_t MotionStreak::getOpacity() const
|
||||||
{
|
{
|
||||||
CCASSERT(false, "Opacity no supported");
|
AXASSERT(false, "Opacity no supported");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Texture2D;
|
||||||
/** @class MotionStreak.
|
/** @class MotionStreak.
|
||||||
* @brief Creates a trailing path.
|
* @brief Creates a trailing path.
|
||||||
*/
|
*/
|
||||||
class CC_DLL MotionStreak : public Node, public TextureProtocol
|
class AX_DLL MotionStreak : public Node, public TextureProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture
|
/** Creates and initializes a motion streak with fade in seconds, minimum segments, stroke's width, color, texture
|
||||||
|
@ -200,7 +200,7 @@ protected:
|
||||||
backend::UniformLocation _textureLocation;
|
backend::UniformLocation _textureLocation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
AX_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -47,7 +47,7 @@ THE SOFTWARE.
|
||||||
#include "math/TransformUtils.h"
|
#include "math/TransformUtils.h"
|
||||||
#include "renderer/backend/ProgramStateRegistry.h"
|
#include "renderer/backend/ProgramStateRegistry.h"
|
||||||
|
|
||||||
#if CC_NODE_RENDER_SUBPIXEL
|
#if AX_NODE_RENDER_SUBPIXEL
|
||||||
# define RENDER_IN_SUBPIXEL
|
# define RENDER_IN_SUBPIXEL
|
||||||
#else
|
#else
|
||||||
# define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
|
# define RENDER_IN_SUBPIXEL(__ARGS__) (ceil(__ARGS__))
|
||||||
|
@ -56,7 +56,7 @@ THE SOFTWARE.
|
||||||
/*
|
/*
|
||||||
* 4.5x faster than std::hash in release mode
|
* 4.5x faster than std::hash in release mode
|
||||||
*/
|
*/
|
||||||
#define CC_HASH_NODE_NAME(name) (!name.empty() ? XXH3_64bits(name.data(), name.length()) : 0)
|
#define AX_HASH_NODE_NAME(name) (!name.empty() ? XXH3_64bits(name.data(), name.length()) : 0)
|
||||||
|
|
||||||
NS_AX_BEGIN
|
NS_AX_BEGIN
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ Node::Node()
|
||||||
, _ignoreAnchorPointForPosition(false)
|
, _ignoreAnchorPointForPosition(false)
|
||||||
, _reorderChildDirty(false)
|
, _reorderChildDirty(false)
|
||||||
, _isTransitionFinished(false)
|
, _isTransitionFinished(false)
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
, _scriptHandler(0)
|
, _scriptHandler(0)
|
||||||
, _updateScriptHandler(0)
|
, _updateScriptHandler(0)
|
||||||
#endif
|
#endif
|
||||||
|
@ -123,7 +123,7 @@ Node::Node()
|
||||||
, _onExitCallback(nullptr)
|
, _onExitCallback(nullptr)
|
||||||
, _onEnterTransitionDidFinishCallback(nullptr)
|
, _onEnterTransitionDidFinishCallback(nullptr)
|
||||||
, _onExitTransitionDidStartCallback(nullptr)
|
, _onExitTransitionDidStartCallback(nullptr)
|
||||||
#if CC_USE_PHYSICS
|
#if AX_USE_PHYSICS
|
||||||
, _physicsBody(nullptr)
|
, _physicsBody(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -148,18 +148,18 @@ Node* Node::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Node::~Node()
|
Node::~Node()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
|
AXLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
|
||||||
|
|
||||||
CC_SAFE_DELETE(_childrenIndexer);
|
AX_SAFE_DELETE(_childrenIndexer);
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
if (_updateScriptHandler)
|
if (_updateScriptHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
||||||
|
@ -168,8 +168,8 @@ Node::~Node()
|
||||||
|
|
||||||
// User object has to be released before others, since userObject may have a weak reference of this node
|
// User object has to be released before others, since userObject may have a weak reference of this node
|
||||||
// It may invoke `node->stopAllActions();` while `_actionManager` is null if the next line is after
|
// It may invoke `node->stopAllActions();` while `_actionManager` is null if the next line is after
|
||||||
// `CC_SAFE_RELEASE_NULL(_actionManager)`.
|
// `AX_SAFE_RELEASE_NULL(_actionManager)`.
|
||||||
CC_SAFE_RELEASE_NULL(_userObject);
|
AX_SAFE_RELEASE_NULL(_userObject);
|
||||||
|
|
||||||
for (auto& child : _children)
|
for (auto& child : _children)
|
||||||
{
|
{
|
||||||
|
@ -178,26 +178,26 @@ Node::~Node()
|
||||||
|
|
||||||
removeAllComponents();
|
removeAllComponents();
|
||||||
|
|
||||||
CC_SAFE_DELETE(_componentContainer);
|
AX_SAFE_DELETE(_componentContainer);
|
||||||
|
|
||||||
stopAllActions();
|
stopAllActions();
|
||||||
unscheduleAllCallbacks();
|
unscheduleAllCallbacks();
|
||||||
CC_SAFE_RELEASE_NULL(_actionManager);
|
AX_SAFE_RELEASE_NULL(_actionManager);
|
||||||
CC_SAFE_RELEASE_NULL(_scheduler);
|
AX_SAFE_RELEASE_NULL(_scheduler);
|
||||||
|
|
||||||
_eventDispatcher->removeEventListenersForTarget(this);
|
_eventDispatcher->removeEventListenersForTarget(this);
|
||||||
|
|
||||||
#if CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0
|
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && AXIS_DEBUG > 0
|
||||||
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
|
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCASSERT(!_running,
|
AXASSERT(!_running,
|
||||||
"Node still marked as running on node destruction! Was base class onExit() called in derived class "
|
"Node still marked as running on node destruction! Was base class onExit() called in derived class "
|
||||||
"onExit() implementations?");
|
"onExit() implementations?");
|
||||||
CC_SAFE_RELEASE(_eventDispatcher);
|
AX_SAFE_RELEASE(_eventDispatcher);
|
||||||
|
|
||||||
delete[] _additionalTransform;
|
delete[] _additionalTransform;
|
||||||
CC_SAFE_RELEASE(_programState);
|
AX_SAFE_RELEASE(_programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Node::init()
|
bool Node::init()
|
||||||
|
@ -214,9 +214,9 @@ bool Node::initLayer() {
|
||||||
|
|
||||||
void Node::cleanup()
|
void Node::cleanup()
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnCleanup);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnCleanup);
|
||||||
#endif // #if CC_ENABLE_SCRIPT_BINDING
|
#endif // #if AX_ENABLE_SCRIPT_BINDING
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
this->stopAllActions();
|
this->stopAllActions();
|
||||||
|
@ -310,7 +310,7 @@ void Node::setGlobalZOrder(float globalZOrder)
|
||||||
/// rotation getter
|
/// rotation getter
|
||||||
float Node::getRotation() const
|
float Node::getRotation() const
|
||||||
{
|
{
|
||||||
CCASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
|
AXASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
|
||||||
return _rotationZ_X;
|
return _rotationZ_X;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,7 +350,7 @@ void Node::setRotation3D(const Vec3& rotation)
|
||||||
Vec3 Node::getRotation3D() const
|
Vec3 Node::getRotation3D() const
|
||||||
{
|
{
|
||||||
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
// rotation Z is decomposed in 2 to simulate Skew for Flash animations
|
||||||
CCASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y");
|
AXASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y");
|
||||||
|
|
||||||
return Vec3(_rotationX, _rotationY, _rotationZ_X);
|
return Vec3(_rotationX, _rotationY, _rotationZ_X);
|
||||||
}
|
}
|
||||||
|
@ -360,8 +360,8 @@ void Node::updateRotationQuat()
|
||||||
// convert Euler angle to quaternion
|
// convert Euler angle to quaternion
|
||||||
// when _rotationZ_X == _rotationZ_Y, _rotationQuat = RotationZ_X * RotationY * RotationX
|
// when _rotationZ_X == _rotationZ_Y, _rotationQuat = RotationZ_X * RotationY * RotationX
|
||||||
// when _rotationZ_X != _rotationZ_Y, _rotationQuat = RotationY * RotationX
|
// when _rotationZ_X != _rotationZ_Y, _rotationQuat = RotationY * RotationX
|
||||||
float halfRadx = CC_DEGREES_TO_RADIANS(_rotationX / 2.f), halfRady = CC_DEGREES_TO_RADIANS(_rotationY / 2.f),
|
float halfRadx = AX_DEGREES_TO_RADIANS(_rotationX / 2.f), halfRady = AX_DEGREES_TO_RADIANS(_rotationY / 2.f),
|
||||||
halfRadz = _rotationZ_X == _rotationZ_Y ? -CC_DEGREES_TO_RADIANS(_rotationZ_X / 2.f) : 0;
|
halfRadz = _rotationZ_X == _rotationZ_Y ? -AX_DEGREES_TO_RADIANS(_rotationZ_X / 2.f) : 0;
|
||||||
float coshalfRadx = cosf(halfRadx), sinhalfRadx = sinf(halfRadx), coshalfRady = cosf(halfRady),
|
float coshalfRadx = cosf(halfRadx), sinhalfRadx = sinf(halfRadx), coshalfRady = cosf(halfRady),
|
||||||
sinhalfRady = sinf(halfRady), coshalfRadz = cosf(halfRadz), sinhalfRadz = sinf(halfRadz);
|
sinhalfRady = sinf(halfRady), coshalfRadz = cosf(halfRadz), sinhalfRadz = sinf(halfRadz);
|
||||||
_rotationQuat.x = sinhalfRadx * coshalfRady * coshalfRadz - coshalfRadx * sinhalfRady * sinhalfRadz;
|
_rotationQuat.x = sinhalfRadx * coshalfRady * coshalfRadz - coshalfRadx * sinhalfRady * sinhalfRadz;
|
||||||
|
@ -380,9 +380,9 @@ void Node::updateRotation3D()
|
||||||
_rotationY = asinf(sy);
|
_rotationY = asinf(sy);
|
||||||
_rotationZ_X = atan2f(2.f * (w * z + x * y), 1.f - 2.f * (y * y + z * z));
|
_rotationZ_X = atan2f(2.f * (w * z + x * y), 1.f - 2.f * (y * y + z * z));
|
||||||
|
|
||||||
_rotationX = CC_RADIANS_TO_DEGREES(_rotationX);
|
_rotationX = AX_RADIANS_TO_DEGREES(_rotationX);
|
||||||
_rotationY = CC_RADIANS_TO_DEGREES(_rotationY);
|
_rotationY = AX_RADIANS_TO_DEGREES(_rotationY);
|
||||||
_rotationZ_X = _rotationZ_Y = -CC_RADIANS_TO_DEGREES(_rotationZ_X);
|
_rotationZ_X = _rotationZ_Y = -AX_RADIANS_TO_DEGREES(_rotationZ_X);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setRotationQuat(const Quaternion& quat)
|
void Node::setRotationQuat(const Quaternion& quat)
|
||||||
|
@ -427,7 +427,7 @@ void Node::setRotationSkewY(float rotationY)
|
||||||
/// scale getter
|
/// scale getter
|
||||||
float Node::getScale() const
|
float Node::getScale() const
|
||||||
{
|
{
|
||||||
CCASSERT(_scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
|
AXASSERT(_scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
|
||||||
return _scaleX;
|
return _scaleX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -727,11 +727,11 @@ void Node::updateParentChildrenIndexer(int tag)
|
||||||
|
|
||||||
void Node::updateParentChildrenIndexer(std::string_view name)
|
void Node::updateParentChildrenIndexer(std::string_view name)
|
||||||
{
|
{
|
||||||
uint64_t newHash = CC_HASH_NODE_NAME(name);
|
uint64_t newHash = AX_HASH_NODE_NAME(name);
|
||||||
auto parentChildrenIndexer = getParentChildrenIndexer();
|
auto parentChildrenIndexer = getParentChildrenIndexer();
|
||||||
if (parentChildrenIndexer)
|
if (parentChildrenIndexer)
|
||||||
{
|
{
|
||||||
auto oldHash = CC_HASH_NODE_NAME(_name);
|
auto oldHash = AX_HASH_NODE_NAME(_name);
|
||||||
if (oldHash != newHash)
|
if (oldHash != newHash)
|
||||||
parentChildrenIndexer->erase(oldHash);
|
parentChildrenIndexer->erase(oldHash);
|
||||||
(*parentChildrenIndexer)[newHash] = this;
|
(*parentChildrenIndexer)[newHash] = this;
|
||||||
|
@ -763,7 +763,7 @@ void Node::setUserData(void* userData)
|
||||||
|
|
||||||
void Node::setUserObject(Ref* userObject)
|
void Node::setUserObject(Ref* userObject)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -772,9 +772,9 @@ void Node::setUserObject(Ref* userObject)
|
||||||
if (_userObject)
|
if (_userObject)
|
||||||
sEngine->releaseScriptObject(this, _userObject);
|
sEngine->releaseScriptObject(this, _userObject);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
CC_SAFE_RETAIN(userObject);
|
AX_SAFE_RETAIN(userObject);
|
||||||
CC_SAFE_RELEASE(_userObject);
|
AX_SAFE_RELEASE(_userObject);
|
||||||
_userObject = userObject;
|
_userObject = userObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -808,7 +808,7 @@ void Node::childrenAlloc()
|
||||||
|
|
||||||
Node* Node::getChildByTag(int tag) const
|
Node* Node::getChildByTag(int tag) const
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
||||||
|
|
||||||
if (_childrenIndexer)
|
if (_childrenIndexer)
|
||||||
{
|
{
|
||||||
|
@ -827,8 +827,8 @@ Node* Node::getChildByTag(int tag) const
|
||||||
|
|
||||||
Node* Node::getChildByName(std::string_view name) const
|
Node* Node::getChildByName(std::string_view name) const
|
||||||
{
|
{
|
||||||
// CCASSERT(!name.empty(), "Invalid name");
|
// AXASSERT(!name.empty(), "Invalid name");
|
||||||
auto hash = CC_HASH_NODE_NAME(name);
|
auto hash = AX_HASH_NODE_NAME(name);
|
||||||
if (_childrenIndexer)
|
if (_childrenIndexer)
|
||||||
{
|
{
|
||||||
auto it = _childrenIndexer->find(hash);
|
auto it = _childrenIndexer->find(hash);
|
||||||
|
@ -847,8 +847,8 @@ Node* Node::getChildByName(std::string_view name) const
|
||||||
|
|
||||||
void Node::enumerateChildren(std::string_view name, std::function<bool(Node*)> callback) const
|
void Node::enumerateChildren(std::string_view name, std::function<bool(Node*)> callback) const
|
||||||
{
|
{
|
||||||
CCASSERT(!name.empty(), "Invalid name");
|
AXASSERT(!name.empty(), "Invalid name");
|
||||||
CCASSERT(callback != nullptr, "Invalid callback function");
|
AXASSERT(callback != nullptr, "Invalid callback function");
|
||||||
|
|
||||||
size_t length = name.length();
|
size_t length = name.length();
|
||||||
|
|
||||||
|
@ -968,16 +968,16 @@ bool Node::doEnumerate(std::string name, std::function<bool(Node*)> callback) co
|
||||||
*/
|
*/
|
||||||
void Node::addChild(Node* child, int localZOrder, int tag)
|
void Node::addChild(Node* child, int localZOrder, int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again");
|
AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
|
||||||
|
|
||||||
addChildHelper(child, localZOrder, tag, "", true);
|
addChildHelper(child, localZOrder, tag, "", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::addChild(Node* child, int localZOrder, std::string_view name)
|
void Node::addChild(Node* child, int localZOrder, std::string_view name)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again");
|
AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
|
||||||
|
|
||||||
addChildHelper(child, localZOrder, INVALID_TAG, name, false);
|
addChildHelper(child, localZOrder, INVALID_TAG, name, false);
|
||||||
}
|
}
|
||||||
|
@ -993,7 +993,7 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, std::string_vie
|
||||||
});
|
});
|
||||||
(void)assertNotSelfChild;
|
(void)assertNotSelfChild;
|
||||||
|
|
||||||
CCASSERT(assertNotSelfChild(), "A node cannot be the child of his own children");
|
AXASSERT(assertNotSelfChild(), "A node cannot be the child of his own children");
|
||||||
|
|
||||||
if (_children.empty())
|
if (_children.empty())
|
||||||
{
|
{
|
||||||
|
@ -1046,13 +1046,13 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, std::string_vie
|
||||||
|
|
||||||
void Node::addChild(Node* child, int zOrder)
|
void Node::addChild(Node* child, int zOrder)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
this->addChild(child, zOrder, child->_name);
|
this->addChild(child, zOrder, child->_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::addChild(Node* child)
|
void Node::addChild(Node* child)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
this->addChild(child, child->getLocalZOrder(), child->_name);
|
this->addChild(child, child->getLocalZOrder(), child->_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1082,19 +1082,19 @@ void Node::removeChild(Node* child, bool cleanup /* = true */)
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t index = _children.getIndex(child);
|
ssize_t index = _children.getIndex(child);
|
||||||
if (index != CC_INVALID_INDEX)
|
if (index != AX_INVALID_INDEX)
|
||||||
this->detachChild(child, index, cleanup);
|
this->detachChild(child, index, cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::removeChildByTag(int tag, bool cleanup /* = true */)
|
void Node::removeChildByTag(int tag, bool cleanup /* = true */)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
||||||
|
|
||||||
Node* child = this->getChildByTag(tag);
|
Node* child = this->getChildByTag(tag);
|
||||||
|
|
||||||
if (child == nullptr)
|
if (child == nullptr)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
|
AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1104,13 +1104,13 @@ void Node::removeChildByTag(int tag, bool cleanup /* = true */)
|
||||||
|
|
||||||
void Node::removeChildByName(std::string_view name, bool cleanup)
|
void Node::removeChildByName(std::string_view name, bool cleanup)
|
||||||
{
|
{
|
||||||
CCASSERT(!name.empty(), "Invalid name");
|
AXASSERT(!name.empty(), "Invalid name");
|
||||||
|
|
||||||
Node* child = this->getChildByName(name);
|
Node* child = this->getChildByName(name);
|
||||||
|
|
||||||
if (child == nullptr)
|
if (child == nullptr)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data());
|
AXLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data());
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1132,7 +1132,7 @@ void Node::removeAllChildrenWithCleanup(bool cleanup)
|
||||||
}
|
}
|
||||||
|
|
||||||
_children.clear();
|
_children.clear();
|
||||||
CC_SAFE_DELETE(_childrenIndexer);
|
AX_SAFE_DELETE(_childrenIndexer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::resetChild(Node* child, bool cleanup)
|
void Node::resetChild(Node* child, bool cleanup)
|
||||||
|
@ -1152,13 +1152,13 @@ void Node::resetChild(Node* child, bool cleanup)
|
||||||
child->cleanup();
|
child->cleanup();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->releaseScriptObject(this, child);
|
sEngine->releaseScriptObject(this, child);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
// set parent nil at the end
|
// set parent nil at the end
|
||||||
child->setParent(nullptr);
|
child->setParent(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -1178,13 +1178,13 @@ void Node::detachChild(Node* child, ssize_t childIndex, bool cleanup)
|
||||||
// helper used by reorderChild & add
|
// helper used by reorderChild & add
|
||||||
void Node::insertChild(Node* child, int z)
|
void Node::insertChild(Node* child, int z)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, child);
|
sEngine->retainScriptObject(this, child);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_transformUpdated = true;
|
_transformUpdated = true;
|
||||||
_reorderChildDirty = true;
|
_reorderChildDirty = true;
|
||||||
_children.pushBack(child);
|
_children.pushBack(child);
|
||||||
|
@ -1193,7 +1193,7 @@ void Node::insertChild(Node* child, int z)
|
||||||
|
|
||||||
void Node::reorderChild(Node* child, int zOrder)
|
void Node::reorderChild(Node* child, int zOrder)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Child must be non-nil");
|
AXASSERT(child != nullptr, "Child must be non-nil");
|
||||||
_reorderChildDirty = true;
|
_reorderChildDirty = true;
|
||||||
child->updateOrderOfArrival();
|
child->updateOrderOfArrival();
|
||||||
child->_setLocalZOrder(zOrder);
|
child->_setLocalZOrder(zOrder);
|
||||||
|
@ -1230,7 +1230,7 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
|
||||||
{
|
{
|
||||||
if (_usingNormalizedPosition)
|
if (_usingNormalizedPosition)
|
||||||
{
|
{
|
||||||
CCASSERT(_parent, "setPositionNormalized() doesn't work with orphan nodes");
|
AXASSERT(_parent, "setPositionNormalized() doesn't work with orphan nodes");
|
||||||
if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty)
|
if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty)
|
||||||
{
|
{
|
||||||
auto& s = _parent->getContentSize();
|
auto& s = _parent->getContentSize();
|
||||||
|
@ -1350,7 +1350,7 @@ void Node::onEnter()
|
||||||
|
|
||||||
_running = true;
|
_running = true;
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnEnter);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnEnter);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1364,7 +1364,7 @@ void Node::onEnterTransitionDidFinish()
|
||||||
for (const auto& child : _children)
|
for (const auto& child : _children)
|
||||||
child->onEnterTransitionDidFinish();
|
child->onEnterTransitionDidFinish();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnEnterTransitionDidFinish);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnEnterTransitionDidFinish);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1377,7 +1377,7 @@ void Node::onExitTransitionDidStart()
|
||||||
for (const auto& child : _children)
|
for (const auto& child : _children)
|
||||||
child->onExitTransitionDidStart();
|
child->onExitTransitionDidStart();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnExitTransitionDidStart);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnExitTransitionDidStart);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1404,7 +1404,7 @@ void Node::onExit()
|
||||||
for (const auto& child : _children)
|
for (const auto& child : _children)
|
||||||
child->onExit();
|
child->onExit();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnExit);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnExit);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1414,8 +1414,8 @@ void Node::setEventDispatcher(EventDispatcher* dispatcher)
|
||||||
if (dispatcher != _eventDispatcher)
|
if (dispatcher != _eventDispatcher)
|
||||||
{
|
{
|
||||||
_eventDispatcher->removeEventListenersForTarget(this);
|
_eventDispatcher->removeEventListenersForTarget(this);
|
||||||
CC_SAFE_RETAIN(dispatcher);
|
AX_SAFE_RETAIN(dispatcher);
|
||||||
CC_SAFE_RELEASE(_eventDispatcher);
|
AX_SAFE_RELEASE(_eventDispatcher);
|
||||||
_eventDispatcher = dispatcher;
|
_eventDispatcher = dispatcher;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1425,8 +1425,8 @@ void Node::setActionManager(ActionManager* actionManager)
|
||||||
if (actionManager != _actionManager)
|
if (actionManager != _actionManager)
|
||||||
{
|
{
|
||||||
this->stopAllActions();
|
this->stopAllActions();
|
||||||
CC_SAFE_RETAIN(actionManager);
|
AX_SAFE_RETAIN(actionManager);
|
||||||
CC_SAFE_RELEASE(_actionManager);
|
AX_SAFE_RELEASE(_actionManager);
|
||||||
_actionManager = actionManager;
|
_actionManager = actionManager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1435,7 +1435,7 @@ void Node::setActionManager(ActionManager* actionManager)
|
||||||
|
|
||||||
Action* Node::runAction(Action* action)
|
Action* Node::runAction(Action* action)
|
||||||
{
|
{
|
||||||
CCASSERT(action != nullptr, "Argument must be non-nil");
|
AXASSERT(action != nullptr, "Argument must be non-nil");
|
||||||
_actionManager->addAction(action, this, !_running);
|
_actionManager->addAction(action, this, !_running);
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -1452,13 +1452,13 @@ void Node::stopAction(Action* action)
|
||||||
|
|
||||||
void Node::stopActionByTag(int tag)
|
void Node::stopActionByTag(int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
||||||
_actionManager->removeActionByTag(tag, this);
|
_actionManager->removeActionByTag(tag, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::stopAllActionsByTag(int tag)
|
void Node::stopAllActionsByTag(int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
||||||
_actionManager->removeAllActionsByTag(tag, this);
|
_actionManager->removeAllActionsByTag(tag, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1472,7 +1472,7 @@ void Node::stopActionsByFlags(unsigned int flags)
|
||||||
|
|
||||||
Action* Node::getActionByTag(int tag)
|
Action* Node::getActionByTag(int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
|
||||||
return _actionManager->getActionByTag(tag, this);
|
return _actionManager->getActionByTag(tag, this);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1493,8 +1493,8 @@ void Node::setScheduler(Scheduler* scheduler)
|
||||||
if (scheduler != _scheduler)
|
if (scheduler != _scheduler)
|
||||||
{
|
{
|
||||||
this->unscheduleAllCallbacks();
|
this->unscheduleAllCallbacks();
|
||||||
CC_SAFE_RETAIN(scheduler);
|
AX_SAFE_RETAIN(scheduler);
|
||||||
CC_SAFE_RELEASE(_scheduler);
|
AX_SAFE_RELEASE(_scheduler);
|
||||||
_scheduler = scheduler;
|
_scheduler = scheduler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1523,7 +1523,7 @@ void Node::scheduleUpdateWithPriorityLua(int nHandler, int priority)
|
||||||
{
|
{
|
||||||
unscheduleUpdate();
|
unscheduleUpdate();
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
_updateScriptHandler = nHandler;
|
_updateScriptHandler = nHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1534,7 +1534,7 @@ void Node::unscheduleUpdate()
|
||||||
{
|
{
|
||||||
_scheduler->unscheduleUpdate(this);
|
_scheduler->unscheduleUpdate(this);
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
if (_updateScriptHandler)
|
if (_updateScriptHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
||||||
|
@ -1545,18 +1545,18 @@ void Node::unscheduleUpdate()
|
||||||
|
|
||||||
void Node::schedule(SEL_SCHEDULE selector)
|
void Node::schedule(SEL_SCHEDULE selector)
|
||||||
{
|
{
|
||||||
this->schedule(selector, 0.0f, CC_REPEAT_FOREVER, 0.0f);
|
this->schedule(selector, 0.0f, AX_REPEAT_FOREVER, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::schedule(SEL_SCHEDULE selector, float interval)
|
void Node::schedule(SEL_SCHEDULE selector, float interval)
|
||||||
{
|
{
|
||||||
this->schedule(selector, interval, CC_REPEAT_FOREVER, 0.0f);
|
this->schedule(selector, interval, AX_REPEAT_FOREVER, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay)
|
void Node::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay)
|
||||||
{
|
{
|
||||||
CCASSERT(selector, "Argument must be non-nil");
|
AXASSERT(selector, "Argument must be non-nil");
|
||||||
CCASSERT(interval >= 0, "Argument must be positive");
|
AXASSERT(interval >= 0, "Argument must be positive");
|
||||||
|
|
||||||
_scheduler->schedule(selector, this, interval, repeat, delay, !_running);
|
_scheduler->schedule(selector, this, interval, repeat, delay, !_running);
|
||||||
}
|
}
|
||||||
|
@ -1626,7 +1626,7 @@ void Node::pause()
|
||||||
// override me
|
// override me
|
||||||
void Node::update(float fDelta)
|
void Node::update(float fDelta)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
if (0 != _updateScriptHandler)
|
if (0 != _updateScriptHandler)
|
||||||
{
|
{
|
||||||
// only lua use
|
// only lua use
|
||||||
|
@ -1702,8 +1702,8 @@ const Mat4& Node::getNodeToParentTransform() const
|
||||||
// Rotation values
|
// Rotation values
|
||||||
// Change rotation code to handle X and Y
|
// Change rotation code to handle X and Y
|
||||||
// If we skew with the exact same value for both x and y then we're simply just rotating
|
// If we skew with the exact same value for both x and y then we're simply just rotating
|
||||||
float radiansX = -CC_DEGREES_TO_RADIANS(_rotationZ_X);
|
float radiansX = -AX_DEGREES_TO_RADIANS(_rotationZ_X);
|
||||||
float radiansY = -CC_DEGREES_TO_RADIANS(_rotationZ_Y);
|
float radiansY = -AX_DEGREES_TO_RADIANS(_rotationZ_Y);
|
||||||
float cx = cosf(radiansX);
|
float cx = cosf(radiansX);
|
||||||
float sx = sinf(radiansX);
|
float sx = sinf(radiansX);
|
||||||
float cy = cosf(radiansY);
|
float cy = cosf(radiansY);
|
||||||
|
@ -1744,10 +1744,10 @@ const Mat4& Node::getNodeToParentTransform() const
|
||||||
if (needsSkewMatrix)
|
if (needsSkewMatrix)
|
||||||
{
|
{
|
||||||
float skewMatArray[16] = {1,
|
float skewMatArray[16] = {1,
|
||||||
(float)tanf(CC_DEGREES_TO_RADIANS(_skewY)),
|
(float)tanf(AX_DEGREES_TO_RADIANS(_skewY)),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(float)tanf(CC_DEGREES_TO_RADIANS(_skewX)),
|
(float)tanf(AX_DEGREES_TO_RADIANS(_skewX)),
|
||||||
1,
|
1,
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
|
@ -2225,10 +2225,10 @@ bool Node::setProgramState(backend::ProgramState* programState, bool needsRetain
|
||||||
{
|
{
|
||||||
if (_programState != programState)
|
if (_programState != programState)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_programState);
|
AX_SAFE_RELEASE(_programState);
|
||||||
_programState = programState;
|
_programState = programState;
|
||||||
if (needsRetain)
|
if (needsRetain)
|
||||||
CC_SAFE_RETAIN(_programState);
|
AX_SAFE_RETAIN(_programState);
|
||||||
return !!_programState;
|
return !!_programState;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -41,7 +41,7 @@
|
||||||
#include "2d/CCComponentContainer.h"
|
#include "2d/CCComponentContainer.h"
|
||||||
#include "2d/CCComponent.h"
|
#include "2d/CCComponent.h"
|
||||||
|
|
||||||
#if CC_USE_PHYSICS
|
#if AX_USE_PHYSICS
|
||||||
# include "physics/CCPhysicsBody.h"
|
# include "physics/CCPhysicsBody.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ Node and override `draw`.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CC_DLL Node : public Ref
|
class AX_DLL Node : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Default tag used for all the nodes */
|
/** Default tag used for all the nodes */
|
||||||
|
@ -949,7 +949,7 @@ public:
|
||||||
inline static void sortNodes(axis::Vector<_T*>& nodes)
|
inline static void sortNodes(axis::Vector<_T*>& nodes)
|
||||||
{
|
{
|
||||||
static_assert(std::is_base_of<Node, _T>::value, "Node::sortNodes: Only accept derived of Node!");
|
static_assert(std::is_base_of<Node, _T>::value, "Node::sortNodes: Only accept derived of Node!");
|
||||||
#if CC_64BITS
|
#if AX_64BITS
|
||||||
std::sort(std::begin(nodes), std::end(nodes),
|
std::sort(std::begin(nodes), std::end(nodes),
|
||||||
[](_T* n1, _T* n2) { return (n1->_localZOrder$Arrival < n2->_localZOrder$Arrival); });
|
[](_T* n1, _T* n2) { return (n1->_localZOrder$Arrival < n2->_localZOrder$Arrival); });
|
||||||
#else
|
#else
|
||||||
|
@ -1344,13 +1344,13 @@ public:
|
||||||
// firstly, implement a schedule function
|
// firstly, implement a schedule function
|
||||||
void MyNode::TickMe(float dt);
|
void MyNode::TickMe(float dt);
|
||||||
// wrap this function into a selector via schedule_selector macro.
|
// wrap this function into a selector via schedule_selector macro.
|
||||||
this->schedule(CC_SCHEDULE_SELECTOR(MyNode::TickMe), 0, 0, 0);
|
this->schedule(AX_SCHEDULE_SELECTOR(MyNode::TickMe), 0, 0, 0);
|
||||||
@endcode
|
@endcode
|
||||||
*
|
*
|
||||||
* @param selector The SEL_SCHEDULE selector to be scheduled.
|
* @param selector The SEL_SCHEDULE selector to be scheduled.
|
||||||
* @param interval Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use
|
* @param interval Tick interval in seconds. 0 means tick every frame. If interval = 0, it's recommended to use
|
||||||
scheduleUpdate() instead.
|
scheduleUpdate() instead.
|
||||||
* @param repeat The selector will be executed (repeat + 1) times, you can use CC_REPEAT_FOREVER for tick
|
* @param repeat The selector will be executed (repeat + 1) times, you can use AX_REPEAT_FOREVER for tick
|
||||||
infinitely.
|
infinitely.
|
||||||
* @param delay The amount of time that the first tick will wait before execution.
|
* @param delay The amount of time that the first tick will wait before execution.
|
||||||
* @lua NA
|
* @lua NA
|
||||||
|
@ -1420,7 +1420,7 @@ public:
|
||||||
*
|
*
|
||||||
* @param callback The lambda function to be schedule.
|
* @param callback The lambda function to be schedule.
|
||||||
* @param interval Tick interval in seconds. 0 means tick every frame.
|
* @param interval Tick interval in seconds. 0 means tick every frame.
|
||||||
* @param repeat The selector will be executed (repeat + 1) times, you can use CC_REPEAT_FOREVER for tick
|
* @param repeat The selector will be executed (repeat + 1) times, you can use AX_REPEAT_FOREVER for tick
|
||||||
* infinitely.
|
* infinitely.
|
||||||
* @param delay The amount of time that the first tick will wait before execution.
|
* @param delay The amount of time that the first tick will wait before execution.
|
||||||
* @param key The key of the lambda function. To be used if you want to unschedule it.
|
* @param key The key of the lambda function. To be used if you want to unschedule it.
|
||||||
|
@ -1915,7 +1915,7 @@ protected:
|
||||||
mutable Mat4 _inverse; ///< inverse transform
|
mutable Mat4 _inverse; ///< inverse transform
|
||||||
mutable Mat4* _additionalTransform; ///< two transforms needed by additional transforms
|
mutable Mat4* _additionalTransform; ///< two transforms needed by additional transforms
|
||||||
|
|
||||||
#if CC_LITTLE_ENDIAN
|
#if AX_LITTLE_ENDIAN
|
||||||
union
|
union
|
||||||
{
|
{
|
||||||
struct
|
struct
|
||||||
|
@ -1982,7 +1982,7 @@ protected:
|
||||||
// camera mask, it is visible only when _cameraMask & current camera' camera flag is true
|
// camera mask, it is visible only when _cameraMask & current camera' camera flag is true
|
||||||
unsigned short _cameraMask;
|
unsigned short _cameraMask;
|
||||||
|
|
||||||
#if CC_ENABLE_SCRIPT_BINDING
|
#if AX_ENABLE_SCRIPT_BINDING
|
||||||
int _scriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding.
|
int _scriptHandler; ///< script handler for onEnter() & onExit(), used in Javascript binding and Lua binding.
|
||||||
int _updateScriptHandler; ///< script handler for update() callback per frame, which is invoked from lua &
|
int _updateScriptHandler; ///< script handler for update() callback per frame, which is invoked from lua &
|
||||||
///< javascript.
|
///< javascript.
|
||||||
|
@ -2004,7 +2004,7 @@ protected:
|
||||||
backend::ProgramState* _programState = nullptr;
|
backend::ProgramState* _programState = nullptr;
|
||||||
|
|
||||||
// Physics:remaining backwardly compatible
|
// Physics:remaining backwardly compatible
|
||||||
#if CC_USE_PHYSICS
|
#if AX_USE_PHYSICS
|
||||||
PhysicsBody* _physicsBody;
|
PhysicsBody* _physicsBody;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2025,7 +2025,7 @@ public:
|
||||||
static int __attachedNodeCount;
|
static int __attachedNodeCount;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(Node);
|
AX_DISALLOW_COPY_AND_ASSIGN(Node);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2043,7 +2043,7 @@ private:
|
||||||
* @parma p Point to a Vec3 for store the intersect point, if don't need them set to nullptr.
|
* @parma p Point to a Vec3 for store the intersect point, if don't need them set to nullptr.
|
||||||
* @return true if the point is in content rectangle, false otherwise.
|
* @return true if the point is in content rectangle, false otherwise.
|
||||||
*/
|
*/
|
||||||
bool CC_DLL isScreenPointInRect(const Vec2& pt, const Camera* camera, const Mat4& w2l, const Rect& rect, Vec3* p);
|
bool AX_DLL isScreenPointInRect(const Vec2& pt, const Camera* camera, const Mat4& w2l, const Rect& rect, Vec3* p);
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
/// @}
|
/// @}
|
||||||
|
|
|
@ -37,7 +37,7 @@ NodeGrid* NodeGrid::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ NodeGrid::NodeGrid() {}
|
||||||
|
|
||||||
void NodeGrid::setTarget(Node* target)
|
void NodeGrid::setTarget(Node* target)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -65,16 +65,16 @@ void NodeGrid::setTarget(Node* target)
|
||||||
if (target)
|
if (target)
|
||||||
sEngine->retainScriptObject(this, target);
|
sEngine->retainScriptObject(this, target);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
CC_SAFE_RELEASE(_gridTarget);
|
AX_SAFE_RELEASE(_gridTarget);
|
||||||
CC_SAFE_RETAIN(target);
|
AX_SAFE_RETAIN(target);
|
||||||
_gridTarget = target;
|
_gridTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeGrid::~NodeGrid()
|
NodeGrid::~NodeGrid()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_nodeGrid);
|
AX_SAFE_RELEASE(_nodeGrid);
|
||||||
CC_SAFE_RELEASE(_gridTarget);
|
AX_SAFE_RELEASE(_gridTarget);
|
||||||
}
|
}
|
||||||
|
|
||||||
void NodeGrid::onGridBeginDraw()
|
void NodeGrid::onGridBeginDraw()
|
||||||
|
@ -173,8 +173,8 @@ void NodeGrid::visit(Renderer* renderer, const Mat4& parentTransform, uint32_t p
|
||||||
|
|
||||||
void NodeGrid::setGrid(GridBase* grid)
|
void NodeGrid::setGrid(GridBase* grid)
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_nodeGrid);
|
AX_SAFE_RELEASE(_nodeGrid);
|
||||||
CC_SAFE_RETAIN(grid);
|
AX_SAFE_RETAIN(grid);
|
||||||
_nodeGrid = grid;
|
_nodeGrid = grid;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,7 +40,7 @@ class GridBase;
|
||||||
* @brief Base class for Grid Node.
|
* @brief Base class for Grid Node.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CC_DLL NodeGrid : public Node
|
class AX_DLL NodeGrid : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a Grid Node.
|
/** Create a Grid Node.
|
||||||
|
@ -104,7 +104,7 @@ protected:
|
||||||
Rect _gridRect = Rect::ZERO;
|
Rect _gridRect = Rect::ZERO;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(NodeGrid);
|
AX_DISALLOW_COPY_AND_ASSIGN(NodeGrid);
|
||||||
};
|
};
|
||||||
/** @} */
|
/** @} */
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
|
@ -88,17 +88,17 @@ ParallaxNode* ParallaxNode::create()
|
||||||
|
|
||||||
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, int /*tag*/)
|
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, int /*tag*/)
|
||||||
{
|
{
|
||||||
CCASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
|
AXASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, std::string_view /*name*/)
|
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, std::string_view /*name*/)
|
||||||
{
|
{
|
||||||
CCASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
|
AXASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParallaxNode::addChild(Node* child, int z, const Vec2& ratio, const Vec2& offset)
|
void ParallaxNode::addChild(Node* child, int z, const Vec2& ratio, const Vec2& offset)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
PointObject* obj = PointObject::create(ratio, offset);
|
PointObject* obj = PointObject::create(ratio, offset);
|
||||||
obj->setChild(child);
|
obj->setChild(child);
|
||||||
ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);
|
ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);
|
||||||
|
|
|
@ -46,7 +46,7 @@ struct _ccArray;
|
||||||
The children will be moved faster / slower than the parent according the parallax ratio.
|
The children will be moved faster / slower than the parent according the parallax ratio.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParallaxNode : public Node
|
class AX_DLL ParallaxNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a Parallax node.
|
/** Create a Parallax node.
|
||||||
|
@ -107,7 +107,7 @@ protected:
|
||||||
struct _ccArray* _parallaxArray;
|
struct _ccArray* _parallaxArray;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -85,8 +85,8 @@ ParticleBatchNode::ParticleBatchNode()
|
||||||
|
|
||||||
ParticleBatchNode::~ParticleBatchNode()
|
ParticleBatchNode::~ParticleBatchNode()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_textureAtlas);
|
AX_SAFE_RELEASE(_textureAtlas);
|
||||||
CC_SAFE_RELEASE(_customCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE(_customCommand.getPipelineDescriptor().programState);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* creation with Texture2D
|
* creation with Texture2D
|
||||||
|
@ -100,7 +100,7 @@ ParticleBatchNode* ParticleBatchNode::createWithTexture(Texture2D* tex, int capa
|
||||||
p->autorelease();
|
p->autorelease();
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(p);
|
AX_SAFE_DELETE(p);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ ParticleBatchNode* ParticleBatchNode::create(std::string_view imageFile, int cap
|
||||||
p->autorelease();
|
p->autorelease();
|
||||||
return p;
|
return p;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(p);
|
AX_SAFE_DELETE(p);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -183,11 +183,11 @@ void ParticleBatchNode::visit(Renderer* renderer, const Mat4& parentTransform, u
|
||||||
// override addChild:
|
// override addChild:
|
||||||
void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
|
void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(aChild != nullptr, "Argument must be non-nullptr");
|
AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
|
||||||
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
||||||
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
||||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||||
CCASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
|
AXASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
|
||||||
"CCParticleSystem is not using the same texture id");
|
"CCParticleSystem is not using the same texture id");
|
||||||
|
|
||||||
addChildByTagOrName(child, zOrder, tag, "", true);
|
addChildByTagOrName(child, zOrder, tag, "", true);
|
||||||
|
@ -195,11 +195,11 @@ void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
|
||||||
|
|
||||||
void ParticleBatchNode::addChild(Node* aChild, int zOrder, std::string_view name)
|
void ParticleBatchNode::addChild(Node* aChild, int zOrder, std::string_view name)
|
||||||
{
|
{
|
||||||
CCASSERT(aChild != nullptr, "Argument must be non-nullptr");
|
AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
|
||||||
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
||||||
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
||||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||||
CCASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
|
AXASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
|
||||||
"CCParticleSystem is not using the same texture id");
|
"CCParticleSystem is not using the same texture id");
|
||||||
|
|
||||||
addChildByTagOrName(child, zOrder, 0, name, false);
|
addChildByTagOrName(child, zOrder, 0, name, false);
|
||||||
|
@ -217,7 +217,7 @@ void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child,
|
||||||
setBlendFunc(child->getBlendFunc());
|
setBlendFunc(child->getBlendFunc());
|
||||||
}
|
}
|
||||||
|
|
||||||
CCASSERT(_blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst,
|
AXASSERT(_blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst,
|
||||||
"Can't add a ParticleSystem that uses a different blending function");
|
"Can't add a ParticleSystem that uses a different blending function");
|
||||||
|
|
||||||
// no lazy sorting, so don't call super addChild, call helper instead
|
// no lazy sorting, so don't call super addChild, call helper instead
|
||||||
|
@ -253,8 +253,8 @@ void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child,
|
||||||
// this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting
|
// this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting
|
||||||
int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag)
|
int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
|
AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
|
||||||
|
|
||||||
_children.reserve(4);
|
_children.reserve(4);
|
||||||
|
|
||||||
|
@ -283,10 +283,10 @@ int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, st
|
||||||
// Reorder will be done in this function, no "lazy" reorder to particles
|
// Reorder will be done in this function, no "lazy" reorder to particles
|
||||||
void ParticleBatchNode::reorderChild(Node* aChild, int zOrder)
|
void ParticleBatchNode::reorderChild(Node* aChild, int zOrder)
|
||||||
{
|
{
|
||||||
CCASSERT(aChild != nullptr, "Child must be non-nullptr");
|
AXASSERT(aChild != nullptr, "Child must be non-nullptr");
|
||||||
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
||||||
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
||||||
CCASSERT(_children.contains(aChild), "Child doesn't belong to batch");
|
AXASSERT(_children.contains(aChild), "Child doesn't belong to batch");
|
||||||
|
|
||||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||||
|
|
||||||
|
@ -411,9 +411,9 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup)
|
||||||
if (aChild == nullptr)
|
if (aChild == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
|
||||||
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
"CCParticleBatchNode only supports QuadParticleSystems as children");
|
||||||
CCASSERT(_children.contains(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it");
|
AXASSERT(_children.contains(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it");
|
||||||
|
|
||||||
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ void ParticleBatchNode::removeAllChildrenWithCleanup(bool doCleanup)
|
||||||
|
|
||||||
void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
|
||||||
{
|
{
|
||||||
CC_PROFILER_START("CCParticleBatchNode - draw");
|
AX_PROFILER_START("CCParticleBatchNode - draw");
|
||||||
|
|
||||||
if (_textureAtlas->getTotalQuads() == 0)
|
if (_textureAtlas->getTotalQuads() == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -476,19 +476,19 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t
|
||||||
|
|
||||||
renderer->addCommand(&_customCommand);
|
renderer->addCommand(&_customCommand);
|
||||||
|
|
||||||
CC_PROFILER_STOP("CCParticleBatchNode - draw");
|
AX_PROFILER_STOP("CCParticleBatchNode - draw");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity)
|
void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: ParticleBatchNode: resizing TextureAtlas capacity from [%d] to [%d].",
|
AXLOG("cocos2d: ParticleBatchNode: resizing TextureAtlas capacity from [%d] to [%d].",
|
||||||
(int)_textureAtlas->getCapacity(), (int)quantity);
|
(int)_textureAtlas->getCapacity(), (int)quantity);
|
||||||
|
|
||||||
if (!_textureAtlas->resizeCapacity(quantity))
|
if (!_textureAtlas->resizeCapacity(quantity))
|
||||||
{
|
{
|
||||||
// serious problems
|
// serious problems
|
||||||
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
|
AXLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
|
||||||
CCASSERT(false, "XXX: ParticleBatchNode #increaseAtlasCapacity SHALL handle this assert");
|
AXASSERT(false, "XXX: ParticleBatchNode #increaseAtlasCapacity SHALL handle this assert");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -564,7 +564,7 @@ void ParticleBatchNode::updateProgramStateTexture()
|
||||||
auto programState = _customCommand.getPipelineDescriptor().programState;
|
auto programState = _customCommand.getPipelineDescriptor().programState;
|
||||||
programState->setTexture(texture->getBackendTexture());
|
programState->setTexture(texture->getBackendTexture());
|
||||||
// If the new texture has No premultiplied alpha, AND the blendFunc hasn't been changed, then update it
|
// If the new texture has No premultiplied alpha, AND the blendFunc hasn't been changed, then update it
|
||||||
if (!texture->hasPremultipliedAlpha() && (_blendFunc.src == CC_BLEND_SRC && _blendFunc.dst == CC_BLEND_DST))
|
if (!texture->hasPremultipliedAlpha() && (_blendFunc.src == AX_BLEND_SRC && _blendFunc.dst == AX_BLEND_DST))
|
||||||
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
|
_blendFunc = BlendFunc::ALPHA_NON_PREMULTIPLIED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -68,7 +68,7 @@ class ParticleSystem;
|
||||||
* @since v1.1
|
* @since v1.1
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class CC_DLL ParticleBatchNode : public Node, public TextureProtocol
|
class AX_DLL ParticleBatchNode : public Node, public TextureProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the particle system with Texture2D, a capacity of particles, which particle system to use.
|
/** Create the particle system with Texture2D, a capacity of particles, which particle system to use.
|
||||||
|
|
|
@ -44,16 +44,16 @@ static Texture2D* getDefaultTexture()
|
||||||
{
|
{
|
||||||
const std::string key = "/__firePngData";
|
const std::string key = "/__firePngData";
|
||||||
texture = Director::getInstance()->getTextureCache()->getTextureForKey(key);
|
texture = Director::getInstance()->getTextureCache()->getTextureForKey(key);
|
||||||
CC_BREAK_IF(texture != nullptr);
|
AX_BREAK_IF(texture != nullptr);
|
||||||
|
|
||||||
image = new Image();
|
image = new Image();
|
||||||
bool ret = image->initWithImageData(__firePngData, sizeof(__firePngData));
|
bool ret = image->initWithImageData(__firePngData, sizeof(__firePngData));
|
||||||
CC_BREAK_IF(!ret);
|
AX_BREAK_IF(!ret);
|
||||||
|
|
||||||
texture = Director::getInstance()->getTextureCache()->addImage(image, key);
|
texture = Director::getInstance()->getTextureCache()->addImage(image, key);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
CC_SAFE_RELEASE(image);
|
AX_SAFE_RELEASE(image);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ ParticleFire* ParticleFire::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ ParticleFire* ParticleFire::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ ParticleFireworks* ParticleFireworks::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ ParticleFireworks* ParticleFireworks::createWithTotalParticles(int numberOfParti
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ ParticleSun* ParticleSun::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ ParticleSun* ParticleSun::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ ParticleGalaxy* ParticleGalaxy::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ ParticleFlower* ParticleFlower::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ ParticleFlower* ParticleFlower::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ ParticleMeteor* ParticleMeteor::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ ParticleMeteor* ParticleMeteor::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ ParticleSpiral* ParticleSpiral::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ ParticleSpiral* ParticleSpiral::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ ParticleExplosion* ParticleExplosion::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParti
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -921,7 +921,7 @@ ParticleSmoke* ParticleSmoke::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@ ParticleSmoke* ParticleSmoke::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ ParticleSnow* ParticleSnow::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ ParticleSnow* ParticleSnow::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1134,7 @@ ParticleRain* ParticleRain::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ ParticleRain* ParticleRain::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ NS_AX_BEGIN
|
||||||
/** @class ParticleFire
|
/** @class ParticleFire
|
||||||
* @brief A fire particle system.
|
* @brief A fire particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleFire : public ParticleSystemQuad
|
class AX_DLL ParticleFire : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a fire particle system.
|
/** Create a fire particle system.
|
||||||
|
@ -70,13 +70,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
virtual bool initWithTotalParticles(int numberOfParticles) override;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleFireworks
|
/** @class ParticleFireworks
|
||||||
* @brief A fireworks particle system.
|
* @brief A fireworks particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleFireworks : public ParticleSystemQuad
|
class AX_DLL ParticleFireworks : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a fireworks particle system.
|
/** Create a fireworks particle system.
|
||||||
|
@ -106,13 +106,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSun
|
/** @class ParticleSun
|
||||||
* @brief A sun particle system.
|
* @brief A sun particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSun : public ParticleSystemQuad
|
class AX_DLL ParticleSun : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a sun particle system.
|
/** Create a sun particle system.
|
||||||
|
@ -142,13 +142,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleGalaxy
|
/** @class ParticleGalaxy
|
||||||
* @brief A galaxy particle system.
|
* @brief A galaxy particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleGalaxy : public ParticleSystemQuad
|
class AX_DLL ParticleGalaxy : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a galaxy particle system.
|
/** Create a galaxy particle system.
|
||||||
|
@ -178,13 +178,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleFlower
|
/** @class ParticleFlower
|
||||||
* @brief A flower particle system.
|
* @brief A flower particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleFlower : public ParticleSystemQuad
|
class AX_DLL ParticleFlower : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a flower particle system.
|
/** Create a flower particle system.
|
||||||
|
@ -214,13 +214,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleMeteor
|
/** @class ParticleMeteor
|
||||||
* @brief A meteor particle system.
|
* @brief A meteor particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleMeteor : public ParticleSystemQuad
|
class AX_DLL ParticleMeteor : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a meteor particle system.
|
/** Create a meteor particle system.
|
||||||
|
@ -250,13 +250,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSpiral
|
/** @class ParticleSpiral
|
||||||
* @brief An spiral particle system.
|
* @brief An spiral particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSpiral : public ParticleSystemQuad
|
class AX_DLL ParticleSpiral : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a spiral particle system.
|
/** Create a spiral particle system.
|
||||||
|
@ -286,13 +286,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleExplosion
|
/** @class ParticleExplosion
|
||||||
* @brief An explosion particle system.
|
* @brief An explosion particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleExplosion : public ParticleSystemQuad
|
class AX_DLL ParticleExplosion : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a explosion particle system.
|
/** Create a explosion particle system.
|
||||||
|
@ -322,13 +322,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSmoke
|
/** @class ParticleSmoke
|
||||||
* @brief An smoke particle system.
|
* @brief An smoke particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSmoke : public ParticleSystemQuad
|
class AX_DLL ParticleSmoke : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a smoke particle system.
|
/** Create a smoke particle system.
|
||||||
|
@ -358,13 +358,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSnow
|
/** @class ParticleSnow
|
||||||
* @brief An snow particle system.
|
* @brief An snow particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSnow : public ParticleSystemQuad
|
class AX_DLL ParticleSnow : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a snow particle system.
|
/** Create a snow particle system.
|
||||||
|
@ -394,13 +394,13 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleRain
|
/** @class ParticleRain
|
||||||
* @brief A rain particle system.
|
* @brief A rain particle system.
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleRain : public ParticleSystemQuad
|
class AX_DLL ParticleRain : public ParticleSystemQuad
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create a rain particle system.
|
/** Create a rain particle system.
|
||||||
|
@ -430,7 +430,7 @@ public:
|
||||||
virtual bool initWithTotalParticles(int numberOfParticles);
|
virtual bool initWithTotalParticles(int numberOfParticles);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -147,47 +147,47 @@ bool ParticleData::init(int count)
|
||||||
|
|
||||||
void ParticleData::release()
|
void ParticleData::release()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(posx);
|
AX_SAFE_FREE(posx);
|
||||||
CC_SAFE_FREE(posy);
|
AX_SAFE_FREE(posy);
|
||||||
CC_SAFE_FREE(startPosX);
|
AX_SAFE_FREE(startPosX);
|
||||||
CC_SAFE_FREE(startPosY);
|
AX_SAFE_FREE(startPosY);
|
||||||
CC_SAFE_FREE(colorR);
|
AX_SAFE_FREE(colorR);
|
||||||
CC_SAFE_FREE(colorG);
|
AX_SAFE_FREE(colorG);
|
||||||
CC_SAFE_FREE(colorB);
|
AX_SAFE_FREE(colorB);
|
||||||
CC_SAFE_FREE(colorA);
|
AX_SAFE_FREE(colorA);
|
||||||
CC_SAFE_FREE(deltaColorR);
|
AX_SAFE_FREE(deltaColorR);
|
||||||
CC_SAFE_FREE(deltaColorG);
|
AX_SAFE_FREE(deltaColorG);
|
||||||
CC_SAFE_FREE(deltaColorB);
|
AX_SAFE_FREE(deltaColorB);
|
||||||
CC_SAFE_FREE(deltaColorA);
|
AX_SAFE_FREE(deltaColorA);
|
||||||
CC_SAFE_FREE(hue);
|
AX_SAFE_FREE(hue);
|
||||||
CC_SAFE_FREE(sat);
|
AX_SAFE_FREE(sat);
|
||||||
CC_SAFE_FREE(val);
|
AX_SAFE_FREE(val);
|
||||||
CC_SAFE_FREE(opacityFadeInDelta);
|
AX_SAFE_FREE(opacityFadeInDelta);
|
||||||
CC_SAFE_FREE(opacityFadeInLength);
|
AX_SAFE_FREE(opacityFadeInLength);
|
||||||
CC_SAFE_FREE(scaleInDelta);
|
AX_SAFE_FREE(scaleInDelta);
|
||||||
CC_SAFE_FREE(scaleInLength);
|
AX_SAFE_FREE(scaleInLength);
|
||||||
CC_SAFE_FREE(size);
|
AX_SAFE_FREE(size);
|
||||||
CC_SAFE_FREE(deltaSize);
|
AX_SAFE_FREE(deltaSize);
|
||||||
CC_SAFE_FREE(rotation);
|
AX_SAFE_FREE(rotation);
|
||||||
CC_SAFE_FREE(staticRotation);
|
AX_SAFE_FREE(staticRotation);
|
||||||
CC_SAFE_FREE(deltaRotation);
|
AX_SAFE_FREE(deltaRotation);
|
||||||
CC_SAFE_FREE(totalTimeToLive);
|
AX_SAFE_FREE(totalTimeToLive);
|
||||||
CC_SAFE_FREE(timeToLive);
|
AX_SAFE_FREE(timeToLive);
|
||||||
CC_SAFE_FREE(animTimeLength);
|
AX_SAFE_FREE(animTimeLength);
|
||||||
CC_SAFE_FREE(animTimeDelta);
|
AX_SAFE_FREE(animTimeDelta);
|
||||||
CC_SAFE_FREE(animIndex);
|
AX_SAFE_FREE(animIndex);
|
||||||
CC_SAFE_FREE(animCellIndex);
|
AX_SAFE_FREE(animCellIndex);
|
||||||
CC_SAFE_FREE(atlasIndex);
|
AX_SAFE_FREE(atlasIndex);
|
||||||
|
|
||||||
CC_SAFE_FREE(modeA.dirX);
|
AX_SAFE_FREE(modeA.dirX);
|
||||||
CC_SAFE_FREE(modeA.dirY);
|
AX_SAFE_FREE(modeA.dirY);
|
||||||
CC_SAFE_FREE(modeA.radialAccel);
|
AX_SAFE_FREE(modeA.radialAccel);
|
||||||
CC_SAFE_FREE(modeA.tangentialAccel);
|
AX_SAFE_FREE(modeA.tangentialAccel);
|
||||||
|
|
||||||
CC_SAFE_FREE(modeB.angle);
|
AX_SAFE_FREE(modeB.angle);
|
||||||
CC_SAFE_FREE(modeB.degreesPerSecond);
|
AX_SAFE_FREE(modeB.degreesPerSecond);
|
||||||
CC_SAFE_FREE(modeB.deltaRadius);
|
AX_SAFE_FREE(modeB.deltaRadius);
|
||||||
CC_SAFE_FREE(modeB.radius);
|
AX_SAFE_FREE(modeB.radius);
|
||||||
}
|
}
|
||||||
|
|
||||||
Vector<ParticleSystem*> ParticleSystem::__allInstances;
|
Vector<ParticleSystem*> ParticleSystem::__allInstances;
|
||||||
|
@ -279,7 +279,7 @@ ParticleSystem* ParticleSystem::create(std::string_view plistFile)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ ParticleSystem* ParticleSystem::createWithTotalParticles(int numberOfParticles)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +321,10 @@ bool ParticleSystem::allocAnimationMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocAnimationMem()
|
void ParticleSystem::deallocAnimationMem()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_particleData.animTimeLength);
|
AX_SAFE_FREE(_particleData.animTimeLength);
|
||||||
CC_SAFE_FREE(_particleData.animTimeDelta);
|
AX_SAFE_FREE(_particleData.animTimeDelta);
|
||||||
CC_SAFE_FREE(_particleData.animIndex);
|
AX_SAFE_FREE(_particleData.animIndex);
|
||||||
CC_SAFE_FREE(_particleData.animCellIndex);
|
AX_SAFE_FREE(_particleData.animCellIndex);
|
||||||
_isAnimAllocated = false;
|
_isAnimAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,9 +346,9 @@ bool ParticleSystem::allocHSVMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocHSVMem()
|
void ParticleSystem::deallocHSVMem()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_particleData.hue);
|
AX_SAFE_FREE(_particleData.hue);
|
||||||
CC_SAFE_FREE(_particleData.sat);
|
AX_SAFE_FREE(_particleData.sat);
|
||||||
CC_SAFE_FREE(_particleData.val);
|
AX_SAFE_FREE(_particleData.val);
|
||||||
_isHSVAllocated = false;
|
_isHSVAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +369,8 @@ bool ParticleSystem::allocOpacityFadeInMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocOpacityFadeInMem()
|
void ParticleSystem::deallocOpacityFadeInMem()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_particleData.opacityFadeInDelta);
|
AX_SAFE_FREE(_particleData.opacityFadeInDelta);
|
||||||
CC_SAFE_FREE(_particleData.opacityFadeInLength);
|
AX_SAFE_FREE(_particleData.opacityFadeInLength);
|
||||||
_isOpacityFadeInAllocated = false;
|
_isOpacityFadeInAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +391,8 @@ bool ParticleSystem::allocScaleInMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocScaleInMem()
|
void ParticleSystem::deallocScaleInMem()
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_particleData.scaleInDelta);
|
AX_SAFE_FREE(_particleData.scaleInDelta);
|
||||||
CC_SAFE_FREE(_particleData.scaleInLength);
|
AX_SAFE_FREE(_particleData.scaleInLength);
|
||||||
_isScaleInAllocated = false;
|
_isScaleInAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -412,7 +412,7 @@ bool ParticleSystem::initWithFile(std::string_view plistFile)
|
||||||
_plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile);
|
_plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile);
|
||||||
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile);
|
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile);
|
||||||
|
|
||||||
CCASSERT(!dict.empty(), "Particles: file not found");
|
AXASSERT(!dict.empty(), "Particles: file not found");
|
||||||
|
|
||||||
// FIXME: compute path from a path, should define a function somewhere to do it
|
// FIXME: compute path from a path, should define a function somewhere to do it
|
||||||
auto listFilePath = plistFile;
|
auto listFilePath = plistFile;
|
||||||
|
@ -573,8 +573,8 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCASSERT(false, "Invalid emitterType in config file");
|
AXASSERT(false, "Invalid emitterType in config file");
|
||||||
CC_BREAK_IF(true);
|
AX_BREAK_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// life span
|
// life span
|
||||||
|
@ -630,7 +630,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
else if (dictionary.find("textureImageData") != dictionary.end())
|
else if (dictionary.find("textureImageData") != dictionary.end())
|
||||||
{
|
{
|
||||||
std::string textureData = dictionary.at("textureImageData").asString();
|
std::string textureData = dictionary.at("textureImageData").asString();
|
||||||
CCASSERT(!textureData.empty(), "textureData can't be empty!");
|
AXASSERT(!textureData.empty(), "textureData can't be empty!");
|
||||||
|
|
||||||
auto dataLen = textureData.size();
|
auto dataLen = textureData.size();
|
||||||
if (dataLen != 0)
|
if (dataLen != 0)
|
||||||
|
@ -638,20 +638,20 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
// if it fails, try to get it from the base64-gzipped data
|
// if it fails, try to get it from the base64-gzipped data
|
||||||
int decodeLen =
|
int decodeLen =
|
||||||
base64Decode((unsigned char*)textureData.c_str(), (unsigned int)dataLen, &buffer);
|
base64Decode((unsigned char*)textureData.c_str(), (unsigned int)dataLen, &buffer);
|
||||||
CCASSERT(buffer != nullptr, "CCParticleSystem: error decoding textureImageData");
|
AXASSERT(buffer != nullptr, "CCParticleSystem: error decoding textureImageData");
|
||||||
CC_BREAK_IF(!buffer);
|
AX_BREAK_IF(!buffer);
|
||||||
|
|
||||||
unsigned char* deflated = nullptr;
|
unsigned char* deflated = nullptr;
|
||||||
ssize_t deflatedLen = ZipUtils::inflateMemory(buffer, decodeLen, &deflated);
|
ssize_t deflatedLen = ZipUtils::inflateMemory(buffer, decodeLen, &deflated);
|
||||||
CCASSERT(deflated != nullptr, "CCParticleSystem: error ungzipping textureImageData");
|
AXASSERT(deflated != nullptr, "CCParticleSystem: error ungzipping textureImageData");
|
||||||
CC_BREAK_IF(!deflated);
|
AX_BREAK_IF(!deflated);
|
||||||
|
|
||||||
// For android, we should retain it in VolatileTexture::addImage which invoked in
|
// For android, we should retain it in VolatileTexture::addImage which invoked in
|
||||||
// Director::getInstance()->getTextureCache()->addUIImage()
|
// Director::getInstance()->getTextureCache()->addUIImage()
|
||||||
image = new Image();
|
image = new Image();
|
||||||
bool isOK = image->initWithImageData(deflated, deflatedLen, true);
|
bool isOK = image->initWithImageData(deflated, deflatedLen, true);
|
||||||
CCASSERT(isOK, "CCParticleSystem: error init image with Data");
|
AXASSERT(isOK, "CCParticleSystem: error init image with Data");
|
||||||
CC_BREAK_IF(!isOK);
|
AX_BREAK_IF(!isOK);
|
||||||
|
|
||||||
setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName));
|
setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName));
|
||||||
|
|
||||||
|
@ -662,7 +662,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
_yCoordFlipped = optValue(dictionary, "yCoordFlipped").asInt(1);
|
_yCoordFlipped = optValue(dictionary, "yCoordFlipped").asInt(1);
|
||||||
|
|
||||||
if (!this->_texture)
|
if (!this->_texture)
|
||||||
CCLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
|
AXLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
|
||||||
}
|
}
|
||||||
ret = true;
|
ret = true;
|
||||||
}
|
}
|
||||||
|
@ -679,7 +679,7 @@ bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
|
||||||
|
|
||||||
if (!_particleData.init(_totalParticles))
|
if (!_particleData.init(_totalParticles))
|
||||||
{
|
{
|
||||||
CCLOG("Particle system: not enough memory");
|
AXLOG("Particle system: not enough memory");
|
||||||
this->release();
|
this->release();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -712,7 +712,7 @@ bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
|
||||||
|
|
||||||
// Optimization: compile updateParticle method
|
// Optimization: compile updateParticle method
|
||||||
// updateParticleSel = @selector(updateQuadWithParticle:newPosition:);
|
// updateParticleSel = @selector(updateQuadWithParticle:newPosition:);
|
||||||
// updateParticleImp = (CC_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel];
|
// updateParticleImp = (AX_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel];
|
||||||
// for batchNode
|
// for batchNode
|
||||||
_transformSystemDirty = false;
|
_transformSystemDirty = false;
|
||||||
|
|
||||||
|
@ -726,7 +726,7 @@ ParticleSystem::~ParticleSystem()
|
||||||
// unscheduleUpdate();
|
// unscheduleUpdate();
|
||||||
_particleData.release();
|
_particleData.release();
|
||||||
_animations.clear();
|
_animations.clear();
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::addParticles(int count, int animationIndex, int animationCellIndex)
|
void ParticleSystem::addParticles(int count, int animationIndex, int animationCellIndex)
|
||||||
|
@ -798,7 +798,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
auto val = _rng.float01() * shape.innerRadius / shape.innerRadius;
|
auto val = _rng.float01() * shape.innerRadius / shape.innerRadius;
|
||||||
val = powf(val, 1 / shape.edgeBias);
|
val = powf(val, 1 / shape.edgeBias);
|
||||||
auto point = Vec2(0.0F, val * shape.innerRadius);
|
auto point = Vec2(0.0F, val * shape.innerRadius);
|
||||||
point = point.rotateByAngle(Vec2::ZERO, -CC_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
point = point.rotateByAngle(Vec2::ZERO, -AX_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
||||||
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
||||||
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
||||||
|
|
||||||
|
@ -809,7 +809,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
auto val = _rng.float01() * shape.outerRadius / shape.outerRadius;
|
auto val = _rng.float01() * shape.outerRadius / shape.outerRadius;
|
||||||
val = powf(val, 1 / shape.edgeBias);
|
val = powf(val, 1 / shape.edgeBias);
|
||||||
auto point = Vec2(0.0F, ((val * (shape.outerRadius - shape.innerRadius) + shape.outerRadius) - (shape.outerRadius - shape.innerRadius)));
|
auto point = Vec2(0.0F, ((val * (shape.outerRadius - shape.innerRadius) + shape.outerRadius) - (shape.outerRadius - shape.innerRadius)));
|
||||||
point = point.rotateByAngle(Vec2::ZERO, -CC_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
point = point.rotateByAngle(Vec2::ZERO, -AX_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
||||||
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x / 2;
|
||||||
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y / 2;
|
||||||
|
|
||||||
|
@ -839,7 +839,7 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
point.x = point.x / size.x * overrideSize.x * scale.x;
|
point.x = point.x / size.x * overrideSize.x * scale.x;
|
||||||
point.y = point.y / size.y * overrideSize.y * scale.y;
|
point.y = point.y / size.y * overrideSize.y * scale.y;
|
||||||
|
|
||||||
point = point.rotateByAngle(Vec2::ZERO, -CC_DEGREES_TO_RADIANS(angle));
|
point = point.rotateByAngle(Vec2::ZERO, -AX_DEGREES_TO_RADIANS(angle));
|
||||||
|
|
||||||
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x;
|
_particleData.posx[i] = _sourcePosition.x + shape.x + point.x;
|
||||||
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y;
|
_particleData.posy[i] = _sourcePosition.y + shape.y + point.y;
|
||||||
|
@ -1053,20 +1053,20 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
{
|
{
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
float a = CC_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
float a = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
||||||
Vec2 v(cosf(a), sinf(a));
|
Vec2 v(cosf(a), sinf(a));
|
||||||
float s = modeA.speed + modeA.speedVar * _rng.rangef();
|
float s = modeA.speed + modeA.speedVar * _rng.rangef();
|
||||||
Vec2 dir = v * s;
|
Vec2 dir = v * s;
|
||||||
_particleData.modeA.dirX[i] = dir.x; // v * s ;
|
_particleData.modeA.dirX[i] = dir.x; // v * s ;
|
||||||
_particleData.modeA.dirY[i] = dir.y;
|
_particleData.modeA.dirY[i] = dir.y;
|
||||||
_particleData.rotation[i] = -CC_RADIANS_TO_DEGREES(dir.getAngle());
|
_particleData.rotation[i] = -AX_RADIANS_TO_DEGREES(dir.getAngle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
float a = CC_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
float a = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
||||||
Vec2 v(cosf(a), sinf(a));
|
Vec2 v(cosf(a), sinf(a));
|
||||||
float s = modeA.speed + modeA.speedVar * _rng.rangef();
|
float s = modeA.speed + modeA.speedVar * _rng.rangef();
|
||||||
Vec2 dir = v * s;
|
Vec2 dir = v * s;
|
||||||
|
@ -1088,13 +1088,13 @@ void ParticleSystem::addParticles(int count, int animationIndex, int animationCe
|
||||||
|
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
_particleData.modeB.angle[i] = CC_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
_particleData.modeB.angle[i] = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
_particleData.modeB.degreesPerSecond[i] =
|
_particleData.modeB.degreesPerSecond[i] =
|
||||||
CC_DEGREES_TO_RADIANS(modeB.rotatePerSecond + modeB.rotatePerSecondVar * _rng.rangef());
|
AX_DEGREES_TO_RADIANS(modeB.rotatePerSecond + modeB.rotatePerSecondVar * _rng.rangef());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (modeB.endRadius == START_RADIUS_EQUAL_TO_END_RADIUS)
|
if (modeB.endRadius == START_RADIUS_EQUAL_TO_END_RADIUS)
|
||||||
|
@ -1386,12 +1386,12 @@ void ParticleSystem::setAnimationIndicesAtlas()
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CCASSERT(false, "Couldn't figure out the atlas size and direction.");
|
AXASSERT(false, "Couldn't figure out the atlas size and direction.");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction)
|
void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction)
|
||||||
{
|
{
|
||||||
CCASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
|
AXASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
|
||||||
|
|
||||||
resetAnimationIndices();
|
resetAnimationIndices();
|
||||||
|
|
||||||
|
@ -1558,7 +1558,7 @@ void ParticleSystem::update(float dt)
|
||||||
if (!_visible)
|
if (!_visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
CC_PROFILER_START_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
AX_PROFILER_START_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
||||||
|
|
||||||
if (_componentContainer && !_componentContainer->isEmpty())
|
if (_componentContainer && !_componentContainer->isEmpty())
|
||||||
{
|
{
|
||||||
|
@ -1572,7 +1572,7 @@ void ParticleSystem::update(float dt)
|
||||||
{
|
{
|
||||||
updateParticleQuads();
|
updateParticleQuads();
|
||||||
_transformSystemDirty = false;
|
_transformSystemDirty = false;
|
||||||
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
AX_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dt = _fixedFPSDelta;
|
dt = _fixedFPSDelta;
|
||||||
|
@ -1838,7 +1838,7 @@ void ParticleSystem::update(float dt)
|
||||||
postStep();
|
postStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
AX_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::updateWithNoTime()
|
void ParticleSystem::updateWithNoTime()
|
||||||
|
@ -1861,8 +1861,8 @@ void ParticleSystem::setTexture(Texture2D* var)
|
||||||
{
|
{
|
||||||
if (_texture != var)
|
if (_texture != var)
|
||||||
{
|
{
|
||||||
CC_SAFE_RETAIN(var);
|
AX_SAFE_RETAIN(var);
|
||||||
CC_SAFE_RELEASE(_texture);
|
AX_SAFE_RELEASE(_texture);
|
||||||
_texture = var;
|
_texture = var;
|
||||||
updateBlendFunc();
|
updateBlendFunc();
|
||||||
}
|
}
|
||||||
|
@ -1870,7 +1870,7 @@ void ParticleSystem::setTexture(Texture2D* var)
|
||||||
|
|
||||||
void ParticleSystem::updateBlendFunc()
|
void ParticleSystem::updateBlendFunc()
|
||||||
{
|
{
|
||||||
CCASSERT(!_batchNode, "Can't change blending functions when the particle is being batched");
|
AXASSERT(!_batchNode, "Can't change blending functions when the particle is being batched");
|
||||||
|
|
||||||
if (_texture)
|
if (_texture)
|
||||||
{
|
{
|
||||||
|
@ -1878,7 +1878,7 @@ void ParticleSystem::updateBlendFunc()
|
||||||
|
|
||||||
_opacityModifyRGB = false;
|
_opacityModifyRGB = false;
|
||||||
|
|
||||||
if (_texture && (_blendFunc.src == CC_BLEND_SRC && _blendFunc.dst == CC_BLEND_DST))
|
if (_texture && (_blendFunc.src == AX_BLEND_SRC && _blendFunc.dst == AX_BLEND_DST))
|
||||||
{
|
{
|
||||||
if (premultiplied)
|
if (premultiplied)
|
||||||
{
|
{
|
||||||
|
@ -1921,170 +1921,170 @@ bool ParticleSystem::isBlendAdditive() const
|
||||||
// ParticleSystem - Properties of Gravity Mode
|
// ParticleSystem - Properties of Gravity Mode
|
||||||
void ParticleSystem::setTangentialAccel(float t)
|
void ParticleSystem::setTangentialAccel(float t)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.tangentialAccel = t;
|
modeA.tangentialAccel = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getTangentialAccel() const
|
float ParticleSystem::getTangentialAccel() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.tangentialAccel;
|
return modeA.tangentialAccel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setTangentialAccelVar(float t)
|
void ParticleSystem::setTangentialAccelVar(float t)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.tangentialAccelVar = t;
|
modeA.tangentialAccelVar = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getTangentialAccelVar() const
|
float ParticleSystem::getTangentialAccelVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.tangentialAccelVar;
|
return modeA.tangentialAccelVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setRadialAccel(float t)
|
void ParticleSystem::setRadialAccel(float t)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.radialAccel = t;
|
modeA.radialAccel = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getRadialAccel() const
|
float ParticleSystem::getRadialAccel() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.radialAccel;
|
return modeA.radialAccel;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setRadialAccelVar(float t)
|
void ParticleSystem::setRadialAccelVar(float t)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.radialAccelVar = t;
|
modeA.radialAccelVar = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getRadialAccelVar() const
|
float ParticleSystem::getRadialAccelVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.radialAccelVar;
|
return modeA.radialAccelVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setRotationIsDir(bool t)
|
void ParticleSystem::setRotationIsDir(bool t)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.rotationIsDir = t;
|
modeA.rotationIsDir = t;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ParticleSystem::getRotationIsDir() const
|
bool ParticleSystem::getRotationIsDir() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.rotationIsDir;
|
return modeA.rotationIsDir;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setGravity(const Vec2& g)
|
void ParticleSystem::setGravity(const Vec2& g)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.gravity = g;
|
modeA.gravity = g;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Vec2& ParticleSystem::getGravity()
|
const Vec2& ParticleSystem::getGravity()
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.gravity;
|
return modeA.gravity;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setSpeed(float speed)
|
void ParticleSystem::setSpeed(float speed)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.speed = speed;
|
modeA.speed = speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getSpeed() const
|
float ParticleSystem::getSpeed() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.speed;
|
return modeA.speed;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setSpeedVar(float speedVar)
|
void ParticleSystem::setSpeedVar(float speedVar)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
modeA.speedVar = speedVar;
|
modeA.speedVar = speedVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getSpeedVar() const
|
float ParticleSystem::getSpeedVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
|
||||||
return modeA.speedVar;
|
return modeA.speedVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
// ParticleSystem - Properties of Radius Mode
|
// ParticleSystem - Properties of Radius Mode
|
||||||
void ParticleSystem::setStartRadius(float startRadius)
|
void ParticleSystem::setStartRadius(float startRadius)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.startRadius = startRadius;
|
modeB.startRadius = startRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getStartRadius() const
|
float ParticleSystem::getStartRadius() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.startRadius;
|
return modeB.startRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setStartRadiusVar(float startRadiusVar)
|
void ParticleSystem::setStartRadiusVar(float startRadiusVar)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.startRadiusVar = startRadiusVar;
|
modeB.startRadiusVar = startRadiusVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getStartRadiusVar() const
|
float ParticleSystem::getStartRadiusVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.startRadiusVar;
|
return modeB.startRadiusVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setEndRadius(float endRadius)
|
void ParticleSystem::setEndRadius(float endRadius)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.endRadius = endRadius;
|
modeB.endRadius = endRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getEndRadius() const
|
float ParticleSystem::getEndRadius() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.endRadius;
|
return modeB.endRadius;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setEndRadiusVar(float endRadiusVar)
|
void ParticleSystem::setEndRadiusVar(float endRadiusVar)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.endRadiusVar = endRadiusVar;
|
modeB.endRadiusVar = endRadiusVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getEndRadiusVar() const
|
float ParticleSystem::getEndRadiusVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.endRadiusVar;
|
return modeB.endRadiusVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setRotatePerSecond(float degrees)
|
void ParticleSystem::setRotatePerSecond(float degrees)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.rotatePerSecond = degrees;
|
modeB.rotatePerSecond = degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getRotatePerSecond() const
|
float ParticleSystem::getRotatePerSecond() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.rotatePerSecond;
|
return modeB.rotatePerSecond;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleSystem::setRotatePerSecondVar(float degrees)
|
void ParticleSystem::setRotatePerSecondVar(float degrees)
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
modeB.rotatePerSecondVar = degrees;
|
modeB.rotatePerSecondVar = degrees;
|
||||||
}
|
}
|
||||||
|
|
||||||
float ParticleSystem::getRotatePerSecondVar() const
|
float ParticleSystem::getRotatePerSecondVar() const
|
||||||
{
|
{
|
||||||
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
|
||||||
return modeB.rotatePerSecondVar;
|
return modeB.rotatePerSecondVar;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2141,7 +2141,7 @@ int ParticleSystem::getTotalParticles() const
|
||||||
|
|
||||||
void ParticleSystem::setTotalParticles(int var)
|
void ParticleSystem::setTotalParticles(int var)
|
||||||
{
|
{
|
||||||
CCASSERT(var <= _allocatedParticles, "Particle: resizing particle array only supported for quads");
|
AXASSERT(var <= _allocatedParticles, "Particle: resizing particle array only supported for quads");
|
||||||
_totalParticles = var;
|
_totalParticles = var;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2286,7 +2286,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
|
||||||
img->Image::initWithImageFile(texturePath);
|
img->Image::initWithImageFile(texturePath);
|
||||||
img->autorelease();
|
img->autorelease();
|
||||||
|
|
||||||
CCASSERT(img, "image texture was nullptr.");
|
AXASSERT(img, "image texture was nullptr.");
|
||||||
bakeEmissionMask(maskId, img, alphaThreshold, inverted, inbetweenSamples);
|
bakeEmissionMask(maskId, img, alphaThreshold, inverted, inbetweenSamples);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2297,8 +2297,8 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
|
||||||
int inbetweenSamples)
|
int inbetweenSamples)
|
||||||
{
|
{
|
||||||
auto img = imageTexture;
|
auto img = imageTexture;
|
||||||
CCASSERT(img, "image texture was nullptr.");
|
AXASSERT(img, "image texture was nullptr.");
|
||||||
CCASSERT(img->hasAlpha(), "image data should contain an alpha channel.");
|
AXASSERT(img->hasAlpha(), "image data should contain an alpha channel.");
|
||||||
|
|
||||||
vector<Vec2> points;
|
vector<Vec2> points;
|
||||||
|
|
||||||
|
@ -2341,7 +2341,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
|
||||||
|
|
||||||
iter->second = desc;
|
iter->second = desc;
|
||||||
|
|
||||||
CCLOG("Particle emission mask '%u' baked (%dx%d), %zu samples generated taking %.2fmb of memory.",
|
AXLOG("Particle emission mask '%u' baked (%dx%d), %zu samples generated taking %.2fmb of memory.",
|
||||||
(unsigned int)htonl(fourccId), w, h, desc.points.size(), desc.points.size() * 8 / 1e+6);
|
(unsigned int)htonl(fourccId), w, h, desc.points.size(), desc.points.size() * 8 / 1e+6);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct ParticleFrameDescriptor
|
||||||
bool isRotated;
|
bool isRotated;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CC_DLL ParticleData
|
class AX_DLL ParticleData
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
float* posx;
|
float* posx;
|
||||||
|
@ -239,7 +239,7 @@ public:
|
||||||
* Particle emission mask cache.
|
* Particle emission mask cache.
|
||||||
* @since axis-1.0.0b8
|
* @since axis-1.0.0b8
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleEmissionMaskCache : public axis::Ref
|
class AX_DLL ParticleEmissionMaskCache : public axis::Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static ParticleEmissionMaskCache* getInstance();
|
static ParticleEmissionMaskCache* getInstance();
|
||||||
|
@ -306,7 +306,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Vec2);
|
// typedef void (*AX_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Vec2);
|
||||||
|
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ emitter.startSpin = 0;
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSystem : public Node, public TextureProtocol, public PlayableProtocol
|
class AX_DLL ParticleSystem : public Node, public TextureProtocol, public PlayableProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Mode
|
/** Mode
|
||||||
|
@ -1535,7 +1535,7 @@ protected:
|
||||||
float _emitCounter;
|
float _emitCounter;
|
||||||
|
|
||||||
// Optimization
|
// Optimization
|
||||||
// CC_UPDATE_PARTICLE_IMP updateParticleImp;
|
// AX_UPDATE_PARTICLE_IMP updateParticleImp;
|
||||||
// SEL updateParticleSel;
|
// SEL updateParticleSel;
|
||||||
|
|
||||||
/** weak reference to the SpriteBatchNode that renders the Sprite */
|
/** weak reference to the SpriteBatchNode that renders the Sprite */
|
||||||
|
@ -1684,7 +1684,7 @@ protected:
|
||||||
FastRNG _rng;
|
FastRNG _rng;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -83,11 +83,11 @@ ParticleSystemQuad::~ParticleSystemQuad()
|
||||||
{
|
{
|
||||||
if (nullptr == _batchNode)
|
if (nullptr == _batchNode)
|
||||||
{
|
{
|
||||||
CC_SAFE_FREE(_quads);
|
AX_SAFE_FREE(_quads);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
CC_SAFE_RELEASE_NULL(_quadCommand.getPipelineDescriptor().programState);
|
AX_SAFE_RELEASE_NULL(_quadCommand.getPipelineDescriptor().programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation ParticleSystemQuad
|
// implementation ParticleSystemQuad
|
||||||
|
@ -100,13 +100,13 @@ ParticleSystemQuad* ParticleSystemQuad::create(std::string_view filename)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles)
|
ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles)
|
||||||
{
|
{
|
||||||
CCASSERT(numberOfParticles <= 10000,
|
AXASSERT(numberOfParticles <= 10000,
|
||||||
"Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of "
|
"Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of "
|
||||||
"U_SHORT (uint16_t)");
|
"U_SHORT (uint16_t)");
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfPar
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ ParticleSystemQuad* ParticleSystemQuad::create(ValueMap& dictionary)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +149,10 @@ bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
|
||||||
initIndices();
|
initIndices();
|
||||||
// setupVBO();
|
// setupVBO();
|
||||||
|
|
||||||
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
||||||
// Need to listen the event only when not use batchnode, because it will use VBO
|
// Need to listen the event only when not use batchnode, because it will use VBO
|
||||||
auto listener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
|
auto listener = EventListenerCustom::create(EVENT_RENDERER_RECREATED,
|
||||||
CC_CALLBACK_1(ParticleSystemQuad::listenRendererRecreated, this));
|
AX_CALLBACK_1(ParticleSystemQuad::listenRendererRecreated, this));
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -167,8 +167,8 @@ void ParticleSystemQuad::initTexCoordsWithRect(const Rect& pointRect)
|
||||||
// convert to Tex coords
|
// convert to Tex coords
|
||||||
|
|
||||||
Rect rect =
|
Rect rect =
|
||||||
Rect(pointRect.origin.x * CC_CONTENT_SCALE_FACTOR(), pointRect.origin.y * CC_CONTENT_SCALE_FACTOR(),
|
Rect(pointRect.origin.x * AX_CONTENT_SCALE_FACTOR(), pointRect.origin.y * AX_CONTENT_SCALE_FACTOR(),
|
||||||
pointRect.size.width * CC_CONTENT_SCALE_FACTOR(), pointRect.size.height * CC_CONTENT_SCALE_FACTOR());
|
pointRect.size.width * AX_CONTENT_SCALE_FACTOR(), pointRect.size.height * AX_CONTENT_SCALE_FACTOR());
|
||||||
|
|
||||||
float wide = (float)pointRect.size.width;
|
float wide = (float)pointRect.size.width;
|
||||||
float high = (float)pointRect.size.height;
|
float high = (float)pointRect.size.height;
|
||||||
|
@ -179,7 +179,7 @@ void ParticleSystemQuad::initTexCoordsWithRect(const Rect& pointRect)
|
||||||
high = (float)_texture->getPixelsHigh();
|
high = (float)_texture->getPixelsHigh();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#if AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
||||||
float left = (rect.origin.x * 2 + 1) / (wide * 2);
|
float left = (rect.origin.x * 2 + 1) / (wide * 2);
|
||||||
float bottom = (rect.origin.y * 2 + 1) / (high * 2);
|
float bottom = (rect.origin.y * 2 + 1) / (high * 2);
|
||||||
float right = left + (rect.size.width * 2 - 2) / (wide * 2);
|
float right = left + (rect.size.width * 2 - 2) / (wide * 2);
|
||||||
|
@ -189,7 +189,7 @@ void ParticleSystemQuad::initTexCoordsWithRect(const Rect& pointRect)
|
||||||
float bottom = rect.origin.y / high;
|
float bottom = rect.origin.y / high;
|
||||||
float right = left + rect.size.width / wide;
|
float right = left + rect.size.width / wide;
|
||||||
float top = bottom + rect.size.height / high;
|
float top = bottom + rect.size.height / high;
|
||||||
#endif // ! CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#endif // ! AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
||||||
|
|
||||||
// Important. Texture in cocos2d are inverted, so the Y component should be inverted
|
// Important. Texture in cocos2d are inverted, so the Y component should be inverted
|
||||||
std::swap(top, bottom);
|
std::swap(top, bottom);
|
||||||
|
@ -257,7 +257,7 @@ void ParticleSystemQuad::setTexture(Texture2D* texture)
|
||||||
|
|
||||||
void ParticleSystemQuad::setDisplayFrame(SpriteFrame* spriteFrame)
|
void ParticleSystemQuad::setDisplayFrame(SpriteFrame* spriteFrame)
|
||||||
{
|
{
|
||||||
CCASSERT(spriteFrame->getOffsetInPixels().isZero(), "QuadParticle only supports SpriteFrames with no offsets");
|
AXASSERT(spriteFrame->getOffsetInPixels().isZero(), "QuadParticle only supports SpriteFrames with no offsets");
|
||||||
|
|
||||||
this->setTextureWithRect(spriteFrame->getTexture(), spriteFrame->getRect());
|
this->setTextureWithRect(spriteFrame->getTexture(), spriteFrame->getRect());
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ inline void updatePosWithParticle(V3F_C4B_T2F_Quad* quad,
|
||||||
float x = newPosition.x;
|
float x = newPosition.x;
|
||||||
float y = newPosition.y;
|
float y = newPosition.y;
|
||||||
|
|
||||||
float r = (float)-CC_DEGREES_TO_RADIANS(rotation + staticRotation);
|
float r = (float)-AX_DEGREES_TO_RADIANS(rotation + staticRotation);
|
||||||
float cr = cosf(r);
|
float cr = cosf(r);
|
||||||
float sr = sinf(r);
|
float sr = sinf(r);
|
||||||
float ax = x1 * cr - y1 * sr + x;
|
float ax = x1 * cr - y1 * sr + x;
|
||||||
|
@ -731,7 +731,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
|
||||||
_particleData.release();
|
_particleData.release();
|
||||||
if (!_particleData.init(tp))
|
if (!_particleData.init(tp))
|
||||||
{
|
{
|
||||||
CCLOG("Particle system: not enough memory");
|
AXLOG("Particle system: not enough memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize);
|
V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize);
|
||||||
|
@ -757,7 +757,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
|
||||||
if (indicesNew)
|
if (indicesNew)
|
||||||
_indices = indicesNew;
|
_indices = indicesNew;
|
||||||
|
|
||||||
CCLOG("Particle system: out of memory");
|
AXLOG("Particle system: out of memory");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -809,19 +809,19 @@ void ParticleSystemQuad::listenRendererRecreated(EventCustom* /*event*/)
|
||||||
|
|
||||||
bool ParticleSystemQuad::allocMemory()
|
bool ParticleSystemQuad::allocMemory()
|
||||||
{
|
{
|
||||||
CCASSERT(!_batchNode, "Memory should not be alloced when not using batchNode");
|
AXASSERT(!_batchNode, "Memory should not be alloced when not using batchNode");
|
||||||
|
|
||||||
CC_SAFE_FREE(_quads);
|
AX_SAFE_FREE(_quads);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
|
|
||||||
_quads = (V3F_C4B_T2F_Quad*)malloc(_totalParticles * sizeof(V3F_C4B_T2F_Quad));
|
_quads = (V3F_C4B_T2F_Quad*)malloc(_totalParticles * sizeof(V3F_C4B_T2F_Quad));
|
||||||
_indices = (unsigned short*)malloc(_totalParticles * 6 * sizeof(unsigned short));
|
_indices = (unsigned short*)malloc(_totalParticles * 6 * sizeof(unsigned short));
|
||||||
|
|
||||||
if (!_quads || !_indices)
|
if (!_quads || !_indices)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: Particle system: not enough memory");
|
AXLOG("cocos2d: Particle system: not enough memory");
|
||||||
CC_SAFE_FREE(_quads);
|
AX_SAFE_FREE(_quads);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -856,8 +856,8 @@ void ParticleSystemQuad::setBatchNode(ParticleBatchNode* batchNode)
|
||||||
V3F_C4B_T2F_Quad* quad = &(batchQuads[_atlasIndex]);
|
V3F_C4B_T2F_Quad* quad = &(batchQuads[_atlasIndex]);
|
||||||
memcpy(quad, _quads, _totalParticles * sizeof(_quads[0]));
|
memcpy(quad, _quads, _totalParticles * sizeof(_quads[0]));
|
||||||
|
|
||||||
CC_SAFE_FREE(_quads);
|
AX_SAFE_FREE(_quads);
|
||||||
CC_SAFE_FREE(_indices);
|
AX_SAFE_FREE(_indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,7 +870,7 @@ ParticleSystemQuad* ParticleSystemQuad::create()
|
||||||
particleSystemQuad->autorelease();
|
particleSystemQuad->autorelease();
|
||||||
return particleSystemQuad;
|
return particleSystemQuad;
|
||||||
}
|
}
|
||||||
CC_SAFE_DELETE(particleSystemQuad);
|
AX_SAFE_DELETE(particleSystemQuad);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -55,7 +55,7 @@ Special features and Limitations:
|
||||||
@since v0.8
|
@since v0.8
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class CC_DLL ParticleSystemQuad : public ParticleSystem
|
class AX_DLL ParticleSystemQuad : public ParticleSystem
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a Particle Emitter.
|
/** Creates a Particle Emitter.
|
||||||
|
@ -176,7 +176,7 @@ protected:
|
||||||
backend::UniformLocation _textureLocation;
|
backend::UniformLocation _textureLocation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -20,13 +20,13 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& cache)
|
void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& cache)
|
||||||
{
|
{
|
||||||
CCASSERT(!filePath.empty(), "plist filename should not be nullptr");
|
AXASSERT(!filePath.empty(), "plist filename should not be nullptr");
|
||||||
|
|
||||||
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
if (fullPath.empty())
|
if (fullPath.empty())
|
||||||
{
|
{
|
||||||
// return if plist file doesn't exist
|
// return if plist file doesn't exist
|
||||||
CCLOG("cocos2d: SpriteFrameCache: can not find %s", filePath.data());
|
AXLOG("cocos2d: SpriteFrameCache: can not find %s", filePath.data());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& c
|
||||||
// append .png
|
// append .png
|
||||||
texturePath = texturePath.append(".png");
|
texturePath = texturePath.append(".png");
|
||||||
|
|
||||||
CCLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str());
|
AXLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str());
|
||||||
}
|
}
|
||||||
addSpriteFramesWithDictionary(dict, texturePath, filePath, cache);
|
addSpriteFramesWithDictionary(dict, texturePath, filePath, cache);
|
||||||
}
|
}
|
||||||
|
@ -76,7 +76,7 @@ void PlistSpriteSheetLoader::load(std::string_view filePath, Texture2D* texture,
|
||||||
|
|
||||||
void PlistSpriteSheetLoader::load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache)
|
void PlistSpriteSheetLoader::load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache)
|
||||||
{
|
{
|
||||||
CCASSERT(!textureFileName.empty(), "texture name should not be null");
|
AXASSERT(!textureFileName.empty(), "texture name should not be null");
|
||||||
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
|
||||||
auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
|
||||||
addSpriteFramesWithDictionary(dict, textureFileName, filePath, cache);
|
addSpriteFramesWithDictionary(dict, textureFileName, filePath, cache);
|
||||||
|
@ -143,7 +143,7 @@ void PlistSpriteSheetLoader::reload(std::string_view filePath, SpriteFrameCache&
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
|
AXLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -189,7 +189,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the format
|
// check the format
|
||||||
CCASSERT(format >= 0 && format <= 3,
|
AXASSERT(format >= 0 && format <= 3,
|
||||||
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
|
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
|
||||||
|
|
||||||
std::vector<std::string> frameAliases;
|
std::vector<std::string> frameAliases;
|
||||||
|
@ -219,7 +219,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
|
||||||
// check ow/oh
|
// check ow/oh
|
||||||
if (!ow || !oh)
|
if (!ow || !oh)
|
||||||
{
|
{
|
||||||
CCLOGWARN(
|
AXLOGWARN(
|
||||||
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
|
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
|
||||||
"expected. Regenerate the .plist");
|
"expected. Regenerate the .plist");
|
||||||
}
|
}
|
||||||
|
@ -268,7 +268,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
|
AXLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
|
||||||
|
|
||||||
spriteSheet->full = true;
|
spriteSheet->full = true;
|
||||||
|
|
||||||
CC_SAFE_DELETE(image);
|
AX_SAFE_DELETE(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
|
void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
|
@ -367,7 +367,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
|
AXLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -387,7 +387,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
}
|
}
|
||||||
|
|
||||||
// check the format
|
// check the format
|
||||||
CCASSERT(format >= 0 && format <= 3,
|
AXASSERT(format >= 0 && format <= 3,
|
||||||
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
|
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
|
||||||
|
|
||||||
auto spriteSheet = std::make_shared<SpriteSheet>();
|
auto spriteSheet = std::make_shared<SpriteSheet>();
|
||||||
|
@ -417,7 +417,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
// check ow/oh
|
// check ow/oh
|
||||||
if (!ow || !oh)
|
if (!ow || !oh)
|
||||||
{
|
{
|
||||||
CCLOGWARN(
|
AXLOGWARN(
|
||||||
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
|
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
|
||||||
"expected. Regenerate the .plist");
|
"expected. Regenerate the .plist");
|
||||||
}
|
}
|
||||||
|
@ -466,7 +466,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
|
AXLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,7 +53,7 @@ backend::ProgramState* initPipelineDescriptor(axis::CustomCommand& command,
|
||||||
auto& pipelieDescriptor = command.getPipelineDescriptor();
|
auto& pipelieDescriptor = command.getPipelineDescriptor();
|
||||||
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR);
|
auto* program = backend::Program::getBuiltinProgram(backend::ProgramType::POSITION_TEXTURE_COLOR);
|
||||||
auto programState = new backend::ProgramState(program);
|
auto programState = new backend::ProgramState(program);
|
||||||
CC_SAFE_RELEASE(pipelieDescriptor.programState);
|
AX_SAFE_RELEASE(pipelieDescriptor.programState);
|
||||||
pipelieDescriptor.programState = programState;
|
pipelieDescriptor.programState = programState;
|
||||||
|
|
||||||
// set vertexLayout according to V2F_C4B_T2F structure
|
// set vertexLayout according to V2F_C4B_T2F structure
|
||||||
|
@ -117,7 +117,7 @@ bool ProgressTimer::initWithSprite(Sprite* sp)
|
||||||
setSprite(sp);
|
setSprite(sp);
|
||||||
|
|
||||||
// TODO: Use ProgramState Vector to Node
|
// TODO: Use ProgramState Vector to Node
|
||||||
CC_SAFE_RELEASE(_programState2);
|
AX_SAFE_RELEASE(_programState2);
|
||||||
setProgramState(initPipelineDescriptor(_customCommand, true, _locMVP1, _locTex1), false);
|
setProgramState(initPipelineDescriptor(_customCommand, true, _locMVP1, _locTex1), false);
|
||||||
_programState2 = initPipelineDescriptor(_customCommand2, false, _locMVP2, _locTex2);
|
_programState2 = initPipelineDescriptor(_customCommand2, false, _locMVP2, _locTex2);
|
||||||
|
|
||||||
|
@ -126,8 +126,8 @@ bool ProgressTimer::initWithSprite(Sprite* sp)
|
||||||
|
|
||||||
ProgressTimer::~ProgressTimer()
|
ProgressTimer::~ProgressTimer()
|
||||||
{
|
{
|
||||||
CC_SAFE_RELEASE(_sprite);
|
AX_SAFE_RELEASE(_sprite);
|
||||||
CC_SAFE_RELEASE(_programState2);
|
AX_SAFE_RELEASE(_programState2);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ProgressTimer::setPercentage(float percentage)
|
void ProgressTimer::setPercentage(float percentage)
|
||||||
|
@ -143,7 +143,7 @@ void ProgressTimer::setSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
if (_sprite != sprite)
|
if (_sprite != sprite)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -152,9 +152,9 @@ void ProgressTimer::setSprite(Sprite* sprite)
|
||||||
if (sprite)
|
if (sprite)
|
||||||
sEngine->retainScriptObject(this, sprite);
|
sEngine->retainScriptObject(this, sprite);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
CC_SAFE_RETAIN(sprite);
|
AX_SAFE_RETAIN(sprite);
|
||||||
CC_SAFE_RELEASE(_sprite);
|
AX_SAFE_RELEASE(_sprite);
|
||||||
_sprite = sprite;
|
_sprite = sprite;
|
||||||
setContentSize(_sprite->getContentSize());
|
setContentSize(_sprite->getContentSize());
|
||||||
|
|
||||||
|
|
|
@ -48,7 +48,7 @@ class Sprite;
|
||||||
* The progress can be Radial, Horizontal or vertical.
|
* The progress can be Radial, Horizontal or vertical.
|
||||||
* @since v0.99.1
|
* @since v0.99.1
|
||||||
*/
|
*/
|
||||||
class CC_DLL ProgressTimer : public Node
|
class AX_DLL ProgressTimer : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Types of progress
|
/** Types of progress
|
||||||
|
@ -201,7 +201,7 @@ protected:
|
||||||
backend::UniformLocation _locTex2;
|
backend::UniformLocation _locTex2;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
AX_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of misc_nodes group
|
// end of misc_nodes group
|
||||||
|
|
|
@ -38,7 +38,7 @@ ProtectedNode::ProtectedNode() : _reorderProtectedChildDirty(false) {}
|
||||||
|
|
||||||
ProtectedNode::~ProtectedNode()
|
ProtectedNode::~ProtectedNode()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag);
|
AXLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag);
|
||||||
removeAllProtectedChildren();
|
removeAllProtectedChildren();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ ProtectedNode* ProtectedNode::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CC_SAFE_DELETE(ret);
|
AX_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -80,8 +80,8 @@ void ProtectedNode::addProtectedChild(axis::Node* child, int localZOrder)
|
||||||
*/
|
*/
|
||||||
void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
|
void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Argument must be non-nil");
|
AXASSERT(child != nullptr, "Argument must be non-nil");
|
||||||
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
|
AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
|
||||||
|
|
||||||
if (_protectedChildren.empty())
|
if (_protectedChildren.empty())
|
||||||
{
|
{
|
||||||
|
@ -118,7 +118,7 @@ void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
|
||||||
|
|
||||||
Node* ProtectedNode::getProtectedChildByTag(int tag)
|
Node* ProtectedNode::getProtectedChildByTag(int tag)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
||||||
|
|
||||||
for (auto& child : _protectedChildren)
|
for (auto& child : _protectedChildren)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +141,7 @@ void ProtectedNode::removeProtectedChild(axis::Node* child, bool cleanup)
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t index = _protectedChildren.getIndex(child);
|
ssize_t index = _protectedChildren.getIndex(child);
|
||||||
if (index != CC_INVALID_INDEX)
|
if (index != AX_INVALID_INDEX)
|
||||||
{
|
{
|
||||||
|
|
||||||
// IMPORTANT:
|
// IMPORTANT:
|
||||||
|
@ -163,13 +163,13 @@ void ProtectedNode::removeProtectedChild(axis::Node* child, bool cleanup)
|
||||||
// set parent nil at the end
|
// set parent nil at the end
|
||||||
child->setParent(nullptr);
|
child->setParent(nullptr);
|
||||||
|
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->releaseScriptObject(this, child);
|
sEngine->releaseScriptObject(this, child);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_protectedChildren.erase(index);
|
_protectedChildren.erase(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -197,13 +197,13 @@ void ProtectedNode::removeAllProtectedChildrenWithCleanup(bool cleanup)
|
||||||
{
|
{
|
||||||
child->cleanup();
|
child->cleanup();
|
||||||
}
|
}
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->releaseScriptObject(this, child);
|
sEngine->releaseScriptObject(this, child);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
// set parent nil at the end
|
// set parent nil at the end
|
||||||
child->setParent(nullptr);
|
child->setParent(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -213,13 +213,13 @@ void ProtectedNode::removeAllProtectedChildrenWithCleanup(bool cleanup)
|
||||||
|
|
||||||
void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup)
|
void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup)
|
||||||
{
|
{
|
||||||
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
|
||||||
|
|
||||||
Node* child = this->getProtectedChildByTag(tag);
|
Node* child = this->getProtectedChildByTag(tag);
|
||||||
|
|
||||||
if (child == nullptr)
|
if (child == nullptr)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
|
AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -230,13 +230,13 @@ void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup)
|
||||||
// helper used by reorderChild & add
|
// helper used by reorderChild & add
|
||||||
void ProtectedNode::insertProtectedChild(axis::Node* child, int z)
|
void ProtectedNode::insertProtectedChild(axis::Node* child, int z)
|
||||||
{
|
{
|
||||||
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, child);
|
sEngine->retainScriptObject(this, child);
|
||||||
}
|
}
|
||||||
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_reorderProtectedChildDirty = true;
|
_reorderProtectedChildDirty = true;
|
||||||
_protectedChildren.pushBack(child);
|
_protectedChildren.pushBack(child);
|
||||||
child->setLocalZOrder(z);
|
child->setLocalZOrder(z);
|
||||||
|
@ -253,7 +253,7 @@ void ProtectedNode::sortAllProtectedChildren()
|
||||||
|
|
||||||
void ProtectedNode::reorderProtectedChild(axis::Node* child, int localZOrder)
|
void ProtectedNode::reorderProtectedChild(axis::Node* child, int localZOrder)
|
||||||
{
|
{
|
||||||
CCASSERT(child != nullptr, "Child must be non-nil");
|
AXASSERT(child != nullptr, "Child must be non-nil");
|
||||||
_reorderProtectedChildDirty = true;
|
_reorderProtectedChildDirty = true;
|
||||||
child->updateOrderOfArrival();
|
child->updateOrderOfArrival();
|
||||||
child->setLocalZOrder(localZOrder);
|
child->setLocalZOrder(localZOrder);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue