mirror of https://github.com/axmolengine/axmol.git
parent
41d2c44308
commit
ac1872494c
|
@ -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 AX_DEPEND_DLLS)
|
PROPERTY CC_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
|
||||||
AX_DEPEND_DLLS ${_dlls}
|
CC_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 AX_LUA_DEPEND
|
PROPERTY CC_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 AX_STATIC)
|
target_compile_definitions(${target} PUBLIC CC_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 AX_STATIC=1
|
PRIVATE CC_STATIC=1
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -81,7 +81,7 @@ Speed::Speed() : _speed(0.0), _innerAction(nullptr) {}
|
||||||
|
|
||||||
Speed::~Speed()
|
Speed::~Speed()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_SAFE_RELEASE(_innerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
Speed* Speed::create(ActionInterval* action, float speed)
|
Speed* Speed::create(ActionInterval* action, float speed)
|
||||||
|
@ -92,7 +92,7 @@ Speed* Speed::create(ActionInterval* action, float speed)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -161,9 +161,9 @@ void Speed::setInnerAction(ActionInterval* action)
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
AX_SAFE_RETAIN(_innerAction);
|
CC_SAFE_RETAIN(_innerAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -172,7 +172,7 @@ void Speed::setInnerAction(ActionInterval* action)
|
||||||
//
|
//
|
||||||
Follow::~Follow()
|
Follow::~Follow()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_followedNode);
|
CC_SAFE_RELEASE(_followedNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
Follow* Follow::create(Node* followedNode, const Rect& rect /* = Rect::ZERO*/)
|
Follow* Follow::create(Node* followedNode, const Rect& rect /* = Rect::ZERO*/)
|
||||||
|
|
|
@ -50,7 +50,7 @@ enum
|
||||||
/**
|
/**
|
||||||
* @brief Base class for Action objects.
|
* @brief Base class for Action objects.
|
||||||
*/
|
*/
|
||||||
class AX_DLL Action : public Ref, public Clonable
|
class CC_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
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,7 +78,7 @@ public:
|
||||||
*/
|
*/
|
||||||
virtual Action* reverse() const
|
virtual Action* reverse() const
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -180,7 +180,7 @@ protected:
|
||||||
unsigned int _flags;
|
unsigned int _flags;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Action);
|
CC_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 AX_DLL FiniteTimeAction : public Action
|
class CC_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
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
virtual FiniteTimeAction* clone() const override
|
virtual FiniteTimeAction* clone() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -227,7 +227,7 @@ protected:
|
||||||
float _duration;
|
float _duration;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FiniteTimeAction);
|
CC_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 AX_DLL Speed : public Action
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Speed);
|
CC_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 AX_DLL Follow : public Action
|
class CC_DLL Follow : public Action
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -439,7 +439,7 @@ protected:
|
||||||
Rect _worldRect;
|
Rect _worldRect;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Follow);
|
CC_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)AX_DEGREES_TO_RADIANS(deltaAngleZ);
|
_radDeltaZ = (float)CC_DEGREES_TO_RADIANS(deltaAngleZ);
|
||||||
_radDeltaX = (float)AX_DEGREES_TO_RADIANS(deltaAngleX);
|
_radDeltaX = (float)CC_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)AX_RADIANS_TO_DEGREES(zenith);
|
_angleZ = (float)CC_RADIANS_TO_DEGREES(zenith);
|
||||||
if (std::isnan(_angleX))
|
if (std::isnan(_angleX))
|
||||||
_angleX = (float)AX_RADIANS_TO_DEGREES(azimuth);
|
_angleX = (float)CC_RADIANS_TO_DEGREES(azimuth);
|
||||||
|
|
||||||
_radZ = (float)AX_DEGREES_TO_RADIANS(_angleZ);
|
_radZ = (float)CC_DEGREES_TO_RADIANS(_angleZ);
|
||||||
_radX = (float)AX_DEGREES_TO_RADIANS(_angleX);
|
_radX = (float)CC_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 AX_DLL ActionCamera : public ActionInterval
|
class CC_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 AX_DLL OrbitCamera : public ActionCamera
|
class CC_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.
|
||||||
|
|
|
@ -197,7 +197,7 @@ CardinalSplineTo* CardinalSplineTo::create(float duration, PointArray* points, f
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -220,7 +220,7 @@ bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, floa
|
||||||
|
|
||||||
CardinalSplineTo::~CardinalSplineTo()
|
CardinalSplineTo::~CardinalSplineTo()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(_points);
|
CC_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 AX_ENABLE_STACKABLE_ACTIONS
|
#if CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -398,7 +398,7 @@ CatmullRomTo* CatmullRomTo::create(float dt, PointArray* points)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -441,7 +441,7 @@ CatmullRomBy* CatmullRomBy::create(float dt, PointArray* points)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,7 +55,7 @@ class Node;
|
||||||
* @ingroup Actions
|
* @ingroup Actions
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL PointArray : public Ref, public Clonable
|
class CC_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 AX_DLL CardinalSplineTo : public ActionInterval
|
class CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(points);
|
CC_SAFE_RETAIN(points);
|
||||||
AX_SAFE_RELEASE(_points);
|
CC_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 AX_DLL CardinalSplineBy : public CardinalSplineTo
|
class CC_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 AX_DLL CatmullRomTo : public CardinalSplineTo
|
class CC_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 AX_DLL CatmullRomBy : public CardinalSplineBy
|
class CC_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 AX_DLL Vec2
|
extern CC_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
|
||||||
|
|
|
@ -66,7 +66,7 @@ bool ActionEase::initWithAction(ActionInterval* action)
|
||||||
|
|
||||||
ActionEase::~ActionEase()
|
ActionEase::~ActionEase()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_inner);
|
CC_SAFE_RELEASE(_inner);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ActionEase::startWithTarget(Node* target)
|
void ActionEase::startWithTarget(Node* target)
|
||||||
|
@ -115,7 +115,7 @@ EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
|
||||||
return easeRateAction;
|
return easeRateAction;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(easeRateAction);
|
CC_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 \
|
||||||
AX_SAFE_DELETE(ease); \
|
CC_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 \
|
||||||
AX_SAFE_DELETE(ease); \
|
CC_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 \
|
||||||
AX_SAFE_DELETE(ease); \
|
CC_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 AX_DLL ActionEase : public ActionInterval
|
class CC_DLL ActionEase : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -75,7 +75,7 @@ protected:
|
||||||
ActionInterval* _inner;
|
ActionInterval* _inner;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ActionEase);
|
CC_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 AX_DLL EaseRateAction : public ActionEase
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(EaseRateAction);
|
CC_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 AX_DLL CLASSNAME : public ActionEase \
|
class CC_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: \
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
CC_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 AX_DLL EaseBounce : public ActionEase
|
class CC_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 AX_DLL CLASSNAME : public EaseRateAction \
|
class CC_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: \
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
CC_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 AX_DLL EaseElastic : public ActionEase
|
class CC_DLL EaseElastic : public ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -451,7 +451,7 @@ protected:
|
||||||
float _period;
|
float _period;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(EaseElastic);
|
CC_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 AX_DLL CLASSNAME : public EaseElastic \
|
class CC_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: \
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(CLASSNAME); \
|
CC_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 AX_DLL EaseBezierAction : public axis::ActionEase
|
class CC_DLL EaseBezierAction : public axis::ActionEase
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -545,7 +545,7 @@ protected:
|
||||||
float _p3;
|
float _p3;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction);
|
CC_DISALLOW_COPY_AND_ASSIGN(EaseBezierAction);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -206,7 +206,7 @@ AccelDeccelAmplitude* AccelDeccelAmplitude::clone() const
|
||||||
|
|
||||||
AccelDeccelAmplitude::~AccelDeccelAmplitude()
|
AccelDeccelAmplitude::~AccelDeccelAmplitude()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_other);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(_other);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_other);
|
CC_SAFE_RELEASE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeccelAmplitude::startWithTarget(Node* target)
|
void DeccelAmplitude::startWithTarget(Node* target)
|
||||||
|
|
|
@ -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 AX_DLL GridAction : public ActionInterval
|
class CC_DLL GridAction : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +57,7 @@ public:
|
||||||
// overrides
|
// overrides
|
||||||
virtual GridAction* clone() const override
|
virtual GridAction* clone() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(GridAction);
|
CC_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 AX_DLL Grid3DAction : public GridAction
|
class CC_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
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@brief Base class for TiledGrid3D actions.
|
@brief Base class for TiledGrid3D actions.
|
||||||
*/
|
*/
|
||||||
class AX_DLL TiledGrid3DAction : public GridAction
|
class CC_DLL TiledGrid3DAction : public GridAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -180,7 +180,7 @@ public:
|
||||||
// Override
|
// Override
|
||||||
virtual TiledGrid3DAction* clone() const override
|
virtual TiledGrid3DAction* clone() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -189,7 +189,7 @@ public:
|
||||||
@brief AccelDeccelAmplitude action.
|
@brief AccelDeccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL AccelDeccelAmplitude : public ActionInterval
|
class CC_DLL AccelDeccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -233,14 +233,14 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelDeccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief AccelAmplitude action.
|
@brief AccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL AccelAmplitude : public ActionInterval
|
class CC_DLL AccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -278,14 +278,14 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
CC_DISALLOW_COPY_AND_ASSIGN(AccelAmplitude);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief DeccelAmplitude action.
|
@brief DeccelAmplitude action.
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL DeccelAmplitude : public ActionInterval
|
class CC_DLL DeccelAmplitude : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -329,7 +329,7 @@ protected:
|
||||||
ActionInterval* _other;
|
ActionInterval* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(DeccelAmplitude);
|
CC_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 AX_DLL StopGrid : public ActionInstant
|
class CC_DLL StopGrid : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -363,13 +363,13 @@ protected:
|
||||||
void cacheTargetAsGridNode();
|
void cacheTargetAsGridNode();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
CC_DISALLOW_COPY_AND_ASSIGN(StopGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@brief ReuseGrid action.
|
@brief ReuseGrid action.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ReuseGrid : public ActionInstant
|
class CC_DLL ReuseGrid : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -402,7 +402,7 @@ protected:
|
||||||
int _times;
|
int _times;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
CC_DISALLOW_COPY_AND_ASSIGN(ReuseGrid);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -209,7 +209,7 @@ FlipY3D* FlipY3D::create(float duration)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -291,7 +291,7 @@ Lens3D* Lens3D::create(float duration, const Vec2& gridSize, const Vec2& positio
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -392,7 +392,7 @@ Ripple3D* Ripple3D::create(float duration,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
return action;
|
return action;
|
||||||
}
|
}
|
||||||
|
@ -531,7 +531,7 @@ Liquid* Liquid::create(float duration, const Vec2& gridSize, unsigned int waves,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -594,7 +594,7 @@ Waves* Waves::create(float duration,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_SAFE_DELETE(action);
|
||||||
}
|
}
|
||||||
|
|
||||||
return action;
|
return action;
|
||||||
|
@ -668,7 +668,7 @@ Twirl* Twirl::create(float duration, const Vec2& gridSize, const Vec2& position,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(action);
|
CC_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 AX_DLL Waves3D : public Grid3DAction
|
class CC_DLL Waves3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -100,14 +100,14 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Waves3D);
|
CC_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 AX_DLL FlipX3D : public Grid3DAction
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FlipX3D);
|
CC_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 AX_DLL FlipY3D : public FlipX3D
|
class CC_DLL FlipY3D : public FlipX3D
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -165,7 +165,7 @@ public:
|
||||||
virtual ~FlipY3D() {}
|
virtual ~FlipY3D() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FlipY3D);
|
CC_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 AX_DLL Lens3D : public Grid3DAction
|
class CC_DLL Lens3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -247,7 +247,7 @@ protected:
|
||||||
bool _dirty;
|
bool _dirty;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Lens3D);
|
CC_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 AX_DLL Ripple3D : public Grid3DAction
|
class CC_DLL Ripple3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -343,7 +343,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Ripple3D);
|
CC_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 AX_DLL Shaky3D : public Grid3DAction
|
class CC_DLL Shaky3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -387,7 +387,7 @@ protected:
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Shaky3D);
|
CC_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 AX_DLL Liquid : public Grid3DAction
|
class CC_DLL Liquid : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -454,7 +454,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Liquid);
|
CC_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 AX_DLL Waves : public Grid3DAction
|
class CC_DLL Waves : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -538,7 +538,7 @@ protected:
|
||||||
bool _horizontal;
|
bool _horizontal;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Waves);
|
CC_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 AX_DLL Twirl : public Grid3DAction
|
class CC_DLL Twirl : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -628,7 +628,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Twirl);
|
CC_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
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -192,7 +192,7 @@ FlipX* FlipX::create(bool x)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,7 +232,7 @@ FlipY* FlipY::create(bool y)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -315,7 +315,7 @@ CallFunc* CallFunc::create(const std::function<void()>& func)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -370,7 +370,7 @@ CallFuncN* CallFuncN::create(const std::function<void(Node*)>& func)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 AX_DLL ActionInstant : public FiniteTimeAction
|
class CC_DLL ActionInstant : public FiniteTimeAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
//
|
//
|
||||||
|
@ -50,13 +50,13 @@ public:
|
||||||
//
|
//
|
||||||
virtual ActionInstant* clone() const override
|
virtual ActionInstant* clone() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ActionInstant* reverse() const override
|
virtual ActionInstant* reverse() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ private:
|
||||||
/** @class Show
|
/** @class Show
|
||||||
* @brief Show the node.
|
* @brief Show the node.
|
||||||
**/
|
**/
|
||||||
class AX_DLL Show : public ActionInstant
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Show);
|
CC_DISALLOW_COPY_AND_ASSIGN(Show);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Hide
|
/** @class Hide
|
||||||
* @brief Hide the node.
|
* @brief Hide the node.
|
||||||
*/
|
*/
|
||||||
class AX_DLL Hide : public ActionInstant
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Hide);
|
CC_DISALLOW_COPY_AND_ASSIGN(Hide);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ToggleVisibility
|
/** @class ToggleVisibility
|
||||||
* @brief Toggles the visibility of a node.
|
* @brief Toggles the visibility of a node.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ToggleVisibility : public ActionInstant
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
CC_DISALLOW_COPY_AND_ASSIGN(ToggleVisibility);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class RemoveSelf
|
/** @class RemoveSelf
|
||||||
* @brief Remove the node.
|
* @brief Remove the node.
|
||||||
*/
|
*/
|
||||||
class AX_DLL RemoveSelf : public ActionInstant
|
class CC_DLL RemoveSelf : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -196,14 +196,14 @@ protected:
|
||||||
bool _isNeedCleanUp;
|
bool _isNeedCleanUp;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(RemoveSelf);
|
CC_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 AX_DLL FlipX : public ActionInstant
|
class CC_DLL FlipX : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -233,14 +233,14 @@ protected:
|
||||||
bool _flipX;
|
bool _flipX;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FlipX);
|
CC_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 AX_DLL FlipY : public ActionInstant
|
class CC_DLL FlipY : public ActionInstant
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Create the action.
|
/** Create the action.
|
||||||
|
@ -270,13 +270,13 @@ protected:
|
||||||
bool _flipY;
|
bool _flipY;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FlipY);
|
CC_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 AX_DLL Place : public ActionInstant
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Place);
|
CC_DISALLOW_COPY_AND_ASSIGN(Place);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class CallFunc
|
/** @class CallFunc
|
||||||
* @brief Calls a 'callback'.
|
* @brief Calls a 'callback'.
|
||||||
*/
|
*/
|
||||||
class AX_DLL CallFunc : public ActionInstant
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(CallFunc);
|
CC_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 AX_DLL CallFuncN : public CallFunc
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
CC_DISALLOW_COPY_AND_ASSIGN(CallFuncN);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -287,8 +287,8 @@ Sequence::Sequence() : _split(0)
|
||||||
|
|
||||||
Sequence::~Sequence()
|
Sequence::~Sequence()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_actions[0]);
|
CC_SAFE_RELEASE(_actions[0]);
|
||||||
AX_SAFE_RELEASE(_actions[1]);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_SAFE_RELEASE(_innerAction);
|
||||||
}
|
}
|
||||||
|
|
||||||
RepeatForever* RepeatForever::create(ActionInterval* action)
|
RepeatForever* RepeatForever::create(ActionInterval* action)
|
||||||
|
@ -742,8 +742,8 @@ Spawn::Spawn() : _one(nullptr), _two(nullptr) {}
|
||||||
|
|
||||||
Spawn::~Spawn()
|
Spawn::~Spawn()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_one);
|
CC_SAFE_RELEASE(_one);
|
||||||
AX_SAFE_RELEASE(_two);
|
CC_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 AX_USE_PHYSICS
|
#if CC_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,7 +945,7 @@ 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 // AX_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1077,7 +1077,7 @@ void RotateBy::update(float time)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
#if AX_USE_PHYSICS
|
#if CC_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 // AX_USE_PHYSICS
|
#endif // CC_USE_PHYSICS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1174,7 +1174,7 @@ void MoveBy::update(float t)
|
||||||
{
|
{
|
||||||
if (_target)
|
if (_target)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_STACKABLE_ACTIONS
|
#if CC_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 // AX_ENABLE_STACKABLE_ACTIONS
|
#endif // CC_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 AX_ENABLE_STACKABLE_ACTIONS
|
#if CC_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 // !AX_ENABLE_STACKABLE_ACTIONS
|
#endif // !CC_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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 AX_ENABLE_STACKABLE_ACTIONS
|
#if CC_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 // !AX_ENABLE_STACKABLE_ACTIONS
|
#endif // !CC_ENABLE_STACKABLE_ACTIONS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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
|
||||||
AX_SAFE_RELEASE(_other);
|
CC_SAFE_RELEASE(_other);
|
||||||
|
|
||||||
_other = action;
|
_other = action;
|
||||||
action->retain();
|
action->retain();
|
||||||
|
@ -2414,7 +2414,7 @@ ReverseTime::ReverseTime() : _other(nullptr) {}
|
||||||
|
|
||||||
ReverseTime::~ReverseTime()
|
ReverseTime::~ReverseTime()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_other);
|
CC_SAFE_RELEASE(_other);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ReverseTime::startWithTarget(Node* target)
|
void ReverseTime::startWithTarget(Node* target)
|
||||||
|
@ -2464,10 +2464,10 @@ Animate::Animate() {}
|
||||||
|
|
||||||
Animate::~Animate()
|
Animate::~Animate()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_animation);
|
CC_SAFE_RELEASE(_animation);
|
||||||
AX_SAFE_RELEASE(_origFrame);
|
CC_SAFE_RELEASE(_origFrame);
|
||||||
AX_SAFE_DELETE(_splitTimes);
|
CC_SAFE_DELETE(_splitTimes);
|
||||||
AX_SAFE_RELEASE(_frameDisplayedEvent);
|
CC_SAFE_RELEASE(_frameDisplayedEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Animate::initWithAnimation(Animation* animation)
|
bool Animate::initWithAnimation(Animation* animation)
|
||||||
|
@ -2510,8 +2510,8 @@ void Animate::setAnimation(axis::Animation* animation)
|
||||||
{
|
{
|
||||||
if (_animation != animation)
|
if (_animation != animation)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(animation);
|
CC_SAFE_RETAIN(animation);
|
||||||
AX_SAFE_RELEASE(_animation);
|
CC_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);
|
||||||
|
|
||||||
AX_SAFE_RELEASE(_origFrame);
|
CC_SAFE_RELEASE(_origFrame);
|
||||||
|
|
||||||
if (_animation->getRestoreOriginalFrame())
|
if (_animation->getRestoreOriginalFrame())
|
||||||
{
|
{
|
||||||
|
@ -2637,8 +2637,8 @@ TargetedAction::TargetedAction() : _action(nullptr), _forcedTarget(nullptr) {}
|
||||||
|
|
||||||
TargetedAction::~TargetedAction()
|
TargetedAction::~TargetedAction()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_forcedTarget);
|
CC_SAFE_RELEASE(_forcedTarget);
|
||||||
AX_SAFE_RELEASE(_action);
|
CC_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()))
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(target);
|
CC_SAFE_RETAIN(target);
|
||||||
_forcedTarget = target;
|
_forcedTarget = target;
|
||||||
AX_SAFE_RETAIN(action);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(forcedTarget);
|
CC_SAFE_RETAIN(forcedTarget);
|
||||||
AX_SAFE_RELEASE(_forcedTarget);
|
CC_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 AX_DLL ActionInterval : public FiniteTimeAction
|
class CC_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
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_ASSERT(0);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual ActionInterval* clone() const override
|
virtual ActionInterval* clone() const override
|
||||||
{
|
{
|
||||||
AX_ASSERT(0);
|
CC_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 AX_DLL Sequence : public ActionInterval
|
class CC_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, ...) AX_REQUIRES_NULL_TERMINATION;
|
static Sequence* create(FiniteTimeAction* action1, ...) CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Sequence);
|
CC_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 AX_DLL Repeat : public ActionInterval
|
class CC_DLL Repeat : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
|
/** Creates a Repeat action. Times is an unsigned integer between 1 and pow(2,30).
|
||||||
|
@ -213,8 +213,8 @@ public:
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(action);
|
CC_SAFE_RETAIN(action);
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ protected:
|
||||||
FiniteTimeAction* _innerAction;
|
FiniteTimeAction* _innerAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Repeat);
|
CC_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 AX_DLL RepeatForever : public ActionInterval
|
class CC_DLL RepeatForever : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action.
|
/** Creates the action.
|
||||||
|
@ -279,9 +279,9 @@ public:
|
||||||
{
|
{
|
||||||
if (_innerAction != action)
|
if (_innerAction != action)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_innerAction);
|
CC_SAFE_RELEASE(_innerAction);
|
||||||
_innerAction = action;
|
_innerAction = action;
|
||||||
AX_SAFE_RETAIN(_innerAction);
|
CC_SAFE_RETAIN(_innerAction);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,13 +314,13 @@ protected:
|
||||||
ActionInterval* _innerAction;
|
ActionInterval* _innerAction;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
CC_DISALLOW_COPY_AND_ASSIGN(RepeatForever);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class Spawn
|
/** @class Spawn
|
||||||
* @brief Spawn a new action immediately
|
* @brief Spawn a new action immediately
|
||||||
*/
|
*/
|
||||||
class AX_DLL Spawn : public ActionInterval
|
class CC_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, ...) AX_REQUIRES_NULL_TERMINATION;
|
static Spawn* create(FiniteTimeAction* action1, ...) CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Spawn);
|
CC_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 AX_DLL RotateTo : public ActionInterval
|
class CC_DLL RotateTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -460,13 +460,13 @@ protected:
|
||||||
Vec3 _diffAngle;
|
Vec3 _diffAngle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(RotateTo);
|
CC_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 AX_DLL RotateBy : public ActionInterval
|
class CC_DLL RotateBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -525,7 +525,7 @@ protected:
|
||||||
Vec3 _startAngle;
|
Vec3 _startAngle;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(RotateBy);
|
CC_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 AX_DLL MoveBy : public ActionInterval
|
class CC_DLL MoveBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -580,7 +580,7 @@ protected:
|
||||||
Vec3 _previousPosition;
|
Vec3 _previousPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MoveBy);
|
CC_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 AX_DLL MoveTo : public MoveBy
|
class CC_DLL MoveTo : public MoveBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -632,14 +632,14 @@ protected:
|
||||||
Vec3 _endPosition;
|
Vec3 _endPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MoveTo);
|
CC_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 AX_DLL SkewTo : public ActionInterval
|
class CC_DLL SkewTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -680,14 +680,14 @@ protected:
|
||||||
float _deltaY;
|
float _deltaY;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(SkewTo);
|
CC_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 AX_DLL SkewBy : public SkewTo
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(SkewBy);
|
CC_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 AX_DLL ResizeTo : public ActionInterval
|
class CC_DLL ResizeTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -756,14 +756,14 @@ protected:
|
||||||
Vec2 _sizeDelta;
|
Vec2 _sizeDelta;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ResizeTo);
|
CC_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 AX_DLL ResizeBy : public ActionInterval
|
class CC_DLL ResizeBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -798,13 +798,13 @@ protected:
|
||||||
Vec2 _previousSize;
|
Vec2 _previousSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ResizeBy);
|
CC_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 AX_DLL JumpBy : public ActionInterval
|
class CC_DLL JumpBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -845,13 +845,13 @@ protected:
|
||||||
Vec2 _previousPos;
|
Vec2 _previousPos;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(JumpBy);
|
CC_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 AX_DLL JumpTo : public JumpBy
|
class CC_DLL JumpTo : public JumpBy
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -884,7 +884,7 @@ protected:
|
||||||
Vec2 _endPosition;
|
Vec2 _endPosition;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(JumpTo);
|
CC_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 AX_DLL BezierBy : public ActionInterval
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(BezierBy);
|
CC_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 AX_DLL BezierTo : public BezierBy
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(BezierTo);
|
CC_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 AX_DLL ScaleTo : public ActionInterval
|
class CC_DLL ScaleTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1066,14 +1066,14 @@ protected:
|
||||||
float _deltaZ;
|
float _deltaZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ScaleTo);
|
CC_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 AX_DLL ScaleBy : public ScaleTo
|
class CC_DLL ScaleBy : public ScaleTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1114,13 +1114,13 @@ public:
|
||||||
virtual ~ScaleBy() {}
|
virtual ~ScaleBy() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ScaleBy);
|
CC_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 AX_DLL Blink : public ActionInterval
|
class CC_DLL Blink : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1157,7 +1157,7 @@ protected:
|
||||||
bool _originalState;
|
bool _originalState;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Blink);
|
CC_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 AX_DLL FadeTo : public ActionInterval
|
class CC_DLL FadeTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1203,14 +1203,14 @@ protected:
|
||||||
friend class FadeIn;
|
friend class FadeIn;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeTo);
|
CC_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 AX_DLL FadeIn : public FadeTo
|
class CC_DLL FadeIn : public FadeTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1236,7 +1236,7 @@ public:
|
||||||
virtual ~FadeIn() {}
|
virtual ~FadeIn() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeIn);
|
CC_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 AX_DLL FadeOut : public FadeTo
|
class CC_DLL FadeOut : public FadeTo
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1269,7 +1269,7 @@ public:
|
||||||
virtual ~FadeOut() {}
|
virtual ~FadeOut() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeOut);
|
CC_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 AX_DLL TintTo : public ActionInterval
|
class CC_DLL TintTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1320,14 +1320,14 @@ protected:
|
||||||
Color3B _from;
|
Color3B _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(TintTo);
|
CC_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 AX_DLL TintBy : public ActionInterval
|
class CC_DLL TintBy : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1367,13 +1367,13 @@ protected:
|
||||||
int16_t _fromB;
|
int16_t _fromB;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(TintBy);
|
CC_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 AX_DLL DelayTime : public ActionInterval
|
class CC_DLL DelayTime : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1397,7 +1397,7 @@ public:
|
||||||
virtual ~DelayTime() {}
|
virtual ~DelayTime() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(DelayTime);
|
CC_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 AX_DLL ReverseTime : public ActionInterval
|
class CC_DLL ReverseTime : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action.
|
/** Creates the action.
|
||||||
|
@ -1440,14 +1440,14 @@ protected:
|
||||||
FiniteTimeAction* _other;
|
FiniteTimeAction* _other;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ReverseTime);
|
CC_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 AX_DLL Animate : public ActionInterval
|
class CC_DLL Animate : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates the action with an Animation and will restore the original frame when the animation is over.
|
/** Creates the action with an Animation and will restore the original frame when the animation is over.
|
||||||
|
@ -1504,14 +1504,14 @@ protected:
|
||||||
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
|
AnimationFrame::DisplayedEventInfo _frameDisplayedEventInfo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Animate);
|
CC_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 AX_DLL TargetedAction : public ActionInterval
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(TargetedAction);
|
CC_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 AX_DLL ActionFloat : public ActionInterval
|
class CC_DLL ActionFloat : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -1609,7 +1609,7 @@ protected:
|
||||||
ActionFloatCallback _callback;
|
ActionFloatCallback _callback;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
|
CC_DISALLOW_COPY_AND_ASSIGN(ActionFloat);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -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 != AX_INVALID_INDEX)
|
if (i != CC_INVALID_INDEX)
|
||||||
{
|
{
|
||||||
removeActionAtIndex(i, element);
|
removeActionAtIndex(i, element);
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ struct _hashElement;
|
||||||
|
|
||||||
@since v0.8
|
@since v0.8
|
||||||
*/
|
*/
|
||||||
class AX_DLL ActionManager : public Ref
|
class CC_DLL ActionManager : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -45,7 +45,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
@since v0.8.2
|
@since v0.8.2
|
||||||
*/
|
*/
|
||||||
class AX_DLL PageTurn3D : public Grid3DAction
|
class CC_DLL PageTurn3D : public Grid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -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 AX_DLL ProgressTo : public ActionInterval
|
class CC_DLL ProgressTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -77,14 +77,14 @@ protected:
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ProgressTo);
|
CC_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 AX_DLL ProgressFromTo : public ActionInterval
|
class CC_DLL ProgressFromTo : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -121,7 +121,7 @@ protected:
|
||||||
float _from;
|
float _from;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ProgressFromTo);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE_ARRAY(_tilesOrder);
|
CC_SAFE_DELETE_ARRAY(_tilesOrder);
|
||||||
AX_SAFE_DELETE_ARRAY(_tiles);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE_ARRAY(_tilesOrder);
|
CC_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 AX_DLL ShakyTiles3D : public TiledGrid3DAction
|
class CC_DLL ShakyTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -77,7 +77,7 @@ protected:
|
||||||
bool _shakeZ;
|
bool _shakeZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ShakyTiles3D);
|
CC_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 AX_DLL ShatteredTiles3D : public TiledGrid3DAction
|
class CC_DLL ShatteredTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -122,7 +122,7 @@ protected:
|
||||||
bool _shatterZ;
|
bool _shatterZ;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ShatteredTiles3D);
|
CC_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 AX_DLL ShuffleTiles : public TiledGrid3DAction
|
class CC_DLL ShuffleTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -172,14 +172,14 @@ protected:
|
||||||
Tile* _tiles;
|
Tile* _tiles;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ShuffleTiles);
|
CC_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 AX_DLL FadeOutTRTiles : public TiledGrid3DAction
|
class CC_DLL FadeOutTRTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -225,14 +225,14 @@ public:
|
||||||
virtual ~FadeOutTRTiles() {}
|
virtual ~FadeOutTRTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutTRTiles);
|
CC_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 AX_DLL FadeOutBLTiles : public FadeOutTRTiles
|
class CC_DLL FadeOutBLTiles : public FadeOutTRTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -251,14 +251,14 @@ public:
|
||||||
virtual ~FadeOutBLTiles() {}
|
virtual ~FadeOutBLTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutBLTiles);
|
CC_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 AX_DLL FadeOutUpTiles : public FadeOutTRTiles
|
class CC_DLL FadeOutUpTiles : public FadeOutTRTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -279,14 +279,14 @@ public:
|
||||||
virtual ~FadeOutUpTiles() {}
|
virtual ~FadeOutUpTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutUpTiles);
|
CC_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 AX_DLL FadeOutDownTiles : public FadeOutUpTiles
|
class CC_DLL FadeOutDownTiles : public FadeOutUpTiles
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -305,14 +305,14 @@ public:
|
||||||
virtual ~FadeOutDownTiles() {}
|
virtual ~FadeOutDownTiles() {}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FadeOutDownTiles);
|
CC_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 AX_DLL TurnOffTiles : public TiledGrid3DAction
|
class CC_DLL TurnOffTiles : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -373,14 +373,14 @@ protected:
|
||||||
unsigned int* _tilesOrder;
|
unsigned int* _tilesOrder;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(TurnOffTiles);
|
CC_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 AX_DLL WavesTiles3D : public TiledGrid3DAction
|
class CC_DLL WavesTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -438,14 +438,14 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(WavesTiles3D);
|
CC_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 AX_DLL JumpTiles3D : public TiledGrid3DAction
|
class CC_DLL JumpTiles3D : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -503,7 +503,7 @@ protected:
|
||||||
float _amplitudeRate;
|
float _amplitudeRate;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(JumpTiles3D);
|
CC_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 AX_DLL SplitRows : public TiledGrid3DAction
|
class CC_DLL SplitRows : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -543,7 +543,7 @@ protected:
|
||||||
Vec2 _winSize;
|
Vec2 _winSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(SplitRows);
|
CC_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 AX_DLL SplitCols : public TiledGrid3DAction
|
class CC_DLL SplitCols : public TiledGrid3DAction
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -586,7 +586,7 @@ protected:
|
||||||
Vec2 _winSize;
|
Vec2 _winSize;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
CC_DISALLOW_COPY_AND_ASSIGN(SplitCols);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of actions group
|
// end of actions group
|
||||||
|
|
|
@ -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 AX_DLL ActionTweenDelegate
|
class CC_DLL ActionTweenDelegate
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -82,7 +82,7 @@ public:
|
||||||
|
|
||||||
@since v0.99.2
|
@since v0.99.2
|
||||||
*/
|
*/
|
||||||
class AX_DLL ActionTween : public ActionInterval
|
class CC_DLL ActionTween : public ActionInterval
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -41,7 +41,7 @@ AnimationFrame* AnimationFrame::create(SpriteFrame* spriteFrame, float delayUnit
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -61,7 +61,7 @@ AnimationFrame::~AnimationFrame()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing AnimationFrame: %p", this);
|
CCLOGINFO("deallocing AnimationFrame: %p", this);
|
||||||
|
|
||||||
AX_SAFE_RELEASE(_spriteFrame);
|
CC_SAFE_RELEASE(_spriteFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimationFrame* AnimationFrame::clone() const
|
AnimationFrame* AnimationFrame::clone() const
|
||||||
|
|
|
@ -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 __AX_ANIMATION_H__
|
#ifndef __CC_ANIMATION_H__
|
||||||
#define __AX_ANIMATION_H__
|
#define __CC_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 AX_DLL AnimationFrame : public Ref, public Clonable
|
class CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(frame);
|
CC_SAFE_RETAIN(frame);
|
||||||
AX_SAFE_RELEASE(_spriteFrame);
|
CC_SAFE_RELEASE(_spriteFrame);
|
||||||
_spriteFrame = frame;
|
_spriteFrame = frame;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ protected:
|
||||||
ValueMap _userInfo;
|
ValueMap _userInfo;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(AnimationFrame);
|
CC_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 AX_DLL Animation : public Ref, public Clonable
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Animation);
|
CC_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 // __AX_ANIMATION_H__
|
#endif // __CC_ANIMATION_H__
|
||||||
|
|
|
@ -48,7 +48,7 @@ AnimationCache* AnimationCache::getInstance()
|
||||||
|
|
||||||
void AnimationCache::destroyInstance()
|
void AnimationCache::destroyInstance()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(s_sharedAnimationCache);
|
CC_SAFE_RELEASE_NULL(s_sharedAnimationCache);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool AnimationCache::init()
|
bool AnimationCache::init()
|
||||||
|
|
|
@ -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 __AX_ANIMATION_CACHE_H__
|
#ifndef __CC_ANIMATION_CACHE_H__
|
||||||
#define __AX_ANIMATION_CACHE_H__
|
#define __CC_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 AX_DLL AnimationCache : public Ref
|
class CC_DLL AnimationCache : public Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -129,4 +129,4 @@ private:
|
||||||
|
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
#endif // __AX_ANIMATION_CACHE_H__
|
#endif // __CC_ANIMATION_CACHE_H__
|
||||||
|
|
|
@ -44,7 +44,7 @@ NS_AX_BEGIN
|
||||||
|
|
||||||
AtlasNode::~AtlasNode()
|
AtlasNode::~AtlasNode()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_textureAtlas);
|
CC_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,7 +55,7 @@ AtlasNode* AtlasNode::create(std::string_view tile, int tileWidth, int tileHeigh
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -270,8 +270,8 @@ Texture2D* AtlasNode::getTexture() const
|
||||||
|
|
||||||
void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
|
void AtlasNode::setTextureAtlas(TextureAtlas* textureAtlas)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(textureAtlas);
|
CC_SAFE_RETAIN(textureAtlas);
|
||||||
AX_SAFE_RELEASE(_textureAtlas);
|
CC_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 AX_DLL AtlasNode : public Node, public TextureProtocol
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
CC_DISALLOW_COPY_AND_ASSIGN(AtlasNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of base_node group
|
// end of base_node group
|
||||||
|
|
|
@ -133,12 +133,12 @@ void PolygonInfo::releaseVertsAndIndices()
|
||||||
{
|
{
|
||||||
if (nullptr != triangles.verts)
|
if (nullptr != triangles.verts)
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE_ARRAY(triangles.verts);
|
CC_SAFE_DELETE_ARRAY(triangles.verts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (nullptr != triangles.indices)
|
if (nullptr != triangles.indices)
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE_ARRAY(triangles.indices);
|
CC_SAFE_DELETE_ARRAY(triangles.indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,7 +184,7 @@ AutoPolygon::AutoPolygon(std::string_view filename)
|
||||||
|
|
||||||
AutoPolygon::~AutoPolygon()
|
AutoPolygon::~AutoPolygon()
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(_image);
|
CC_SAFE_DELETE(_image);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<Vec2> AutoPolygon::trace(const Rect& rect, float threshold)
|
std::vector<Vec2> AutoPolygon::trace(const Rect& rect, float threshold)
|
||||||
|
@ -694,7 +694,7 @@ Rect AutoPolygon::getRealRect(const Rect& rect)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// rect is specified, so convert to real rect
|
// rect is specified, so convert to real rect
|
||||||
realRect = AX_RECT_POINTS_TO_PIXELS(rect);
|
realRect = CC_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 AX_DLL PolygonInfo
|
class CC_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 AX_DLL AutoPolygon
|
class CC_DLL AutoPolygon
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -119,7 +119,7 @@ Camera::Camera()
|
||||||
|
|
||||||
Camera::~Camera()
|
Camera::~Camera()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_clearBrush);
|
CC_SAFE_RELEASE(_clearBrush);
|
||||||
}
|
}
|
||||||
|
|
||||||
const Mat4& Camera::getProjectionMatrix() const
|
const Mat4& Camera::getProjectionMatrix() const
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(clearBrush);
|
CC_SAFE_RETAIN(clearBrush);
|
||||||
AX_SAFE_RELEASE(_clearBrush);
|
CC_SAFE_RELEASE(_clearBrush);
|
||||||
_clearBrush = clearBrush;
|
_clearBrush = clearBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,7 +63,7 @@ enum class CameraFlag
|
||||||
/**
|
/**
|
||||||
* Defines a camera .
|
* Defines a camera .
|
||||||
*/
|
*/
|
||||||
class AX_DLL Camera : public Node
|
class CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(_programState);
|
CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
, _backToForegroundListener(nullptr)
|
, _backToForegroundListener(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -122,7 +122,7 @@ CameraBackgroundDepthBrush* CameraBackgroundDepthBrush::create(float depth)
|
||||||
|
|
||||||
bool CameraBackgroundDepthBrush::init()
|
bool CameraBackgroundDepthBrush::init()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(_programState);
|
CC_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(AX_CALLBACK_0(CameraBackgroundDepthBrush::onBeforeDraw, this));
|
_customCommand.setBeforeCallback(CC_CALLBACK_0(CameraBackgroundDepthBrush::onBeforeDraw, this));
|
||||||
_customCommand.setAfterCallback(AX_CALLBACK_0(CameraBackgroundDepthBrush::onAfterDraw, this));
|
_customCommand.setAfterCallback(CC_CALLBACK_0(CameraBackgroundDepthBrush::onAfterDraw, this));
|
||||||
|
|
||||||
initBuffer();
|
initBuffer();
|
||||||
return true;
|
return true;
|
||||||
|
@ -273,7 +273,7 @@ CameraBackgroundColorBrush* CameraBackgroundColorBrush::create(const Color4F& co
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
, _backToForegroundListener(nullptr)
|
, _backToForegroundListener(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(texture);
|
CC_SAFE_DELETE(texture);
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ CameraBackgroundSkyBoxBrush* CameraBackgroundSkyBoxBrush::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -386,16 +386,16 @@ void CameraBackgroundSkyBoxBrush::drawBackground(Camera* camera)
|
||||||
|
|
||||||
renderer->popGroup();
|
renderer->popGroup();
|
||||||
|
|
||||||
AX_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
|
CC_INCREMENT_GL_DRAWN_BATCHES_AND_VERTICES(1, 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CameraBackgroundSkyBoxBrush::init()
|
bool CameraBackgroundSkyBoxBrush::init()
|
||||||
{
|
{
|
||||||
|
|
||||||
_customCommand.setBeforeCallback(AX_CALLBACK_0(CameraBackgroundSkyBoxBrush::onBeforeDraw, this));
|
_customCommand.setBeforeCallback(CC_CALLBACK_0(CameraBackgroundSkyBoxBrush::onBeforeDraw, this));
|
||||||
_customCommand.setAfterCallback(AX_CALLBACK_0(CameraBackgroundSkyBoxBrush::onAfterDraw, this));
|
_customCommand.setAfterCallback(CC_CALLBACK_0(CameraBackgroundSkyBoxBrush::onAfterDraw, this));
|
||||||
|
|
||||||
AX_SAFE_RELEASE_NULL(_programState);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(texture);
|
CC_SAFE_RETAIN(texture);
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_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 AX_DLL CameraBackgroundBrush : public Ref
|
class CC_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 AX_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
|
class CC_DLL CameraBackgroundDepthBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -167,7 +167,7 @@ private:
|
||||||
void onAfterDraw();
|
void onAfterDraw();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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 AX_DLL CameraBackgroundColorBrush : public CameraBackgroundDepthBrush
|
class CC_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 AX_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
|
class CC_DLL CameraBackgroundSkyBoxBrush : public CameraBackgroundBrush
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -298,7 +298,7 @@ protected:
|
||||||
|
|
||||||
TextureCube* _texture;
|
TextureCube* _texture;
|
||||||
|
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
EventListenerCustom* _backToForegroundListener;
|
EventListenerCustom* _backToForegroundListener;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ ClippingNode::~ClippingNode()
|
||||||
_stencil->stopAllActions();
|
_stencil->stopAllActions();
|
||||||
_stencil->release();
|
_stencil->release();
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(_stencilStateManager);
|
CC_SAFE_DELETE(_stencilStateManager);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClippingNode* ClippingNode::create()
|
ClippingNode* ClippingNode::create()
|
||||||
|
@ -55,7 +55,7 @@ ClippingNode* ClippingNode::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -70,7 +70,7 @@ ClippingNode* ClippingNode::create(Node* pStencil)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -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 = AX_CALLBACK_0(StencilStateManager::onBeforeVisit, _stencilStateManager);
|
// _beforeVisitCmd.func = CC_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);
|
||||||
|
|
||||||
AX_SAFE_RELEASE_NULL(programState);
|
CC_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 = AX_CALLBACK_0(StencilStateManager::onAfterDrawStencil, _stencilStateManager);
|
afterDrawStencilCmd->func = CC_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 = AX_CALLBACK_0(StencilStateManager::onAfterVisit, _stencilStateManager);
|
_afterVisitCmd->func = CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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();
|
||||||
}
|
}
|
||||||
AX_SAFE_RELEASE_NULL(_stencil);
|
CC_SAFE_RELEASE_NULL(_stencil);
|
||||||
|
|
||||||
// initialise new stencil
|
// initialise new stencil
|
||||||
_stencil = stencil;
|
_stencil = stencil;
|
||||||
AX_SAFE_RETAIN(_stencil);
|
CC_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 AX_DLL ClippingNode : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ClippingNode);
|
CC_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
|
||||||
AX_SAFE_DELETE(node);
|
CC_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
|
||||||
AX_SAFE_DELETE(node);
|
CC_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 = AX_CALLBACK_0(ClippingRectangleNode::onBeforeVisitScissor, this);
|
beforeVisitCmdScissor->func = CC_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 = AX_CALLBACK_0(ClippingRectangleNode::onAfterVisitScissor, this);
|
afterVisitCmdScissor->func = CC_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 AX_DLL ClippingRectangleNode : public Node
|
class CC_DLL ClippingRectangleNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -61,7 +61,7 @@ Component* Component::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 __AX_FRAMEWORK_COMPONENT_H__
|
#ifndef __CC_FRAMEWORK_COMPONENT_H__
|
||||||
#define __AX_FRAMEWORK_COMPONENT_H__
|
#define __CC_FRAMEWORK_COMPONENT_H__
|
||||||
|
|
||||||
/// @cond DO_NOT_SHOW
|
/// @cond DO_NOT_SHOW
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -44,7 +44,7 @@ enum
|
||||||
kComponentOnUpdate
|
kComponentOnUpdate
|
||||||
};
|
};
|
||||||
|
|
||||||
class AX_DLL Component : public Ref
|
class CC_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 // __AX_FRAMEWORK_COMPONENT_H__
|
#endif // __CC_FRAMEWORK_COMPONENT_H__
|
||||||
|
|
|
@ -76,7 +76,7 @@ bool ComponentContainer::remove(std::string_view componentName)
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
auto iter = _componentMap.find(componentName);
|
auto iter = _componentMap.find(componentName);
|
||||||
AX_BREAK_IF(iter == _componentMap.end());
|
CC_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())
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(_owner);
|
CC_SAFE_RETAIN(_owner);
|
||||||
for (auto& iter : _componentMap)
|
for (auto& iter : _componentMap)
|
||||||
{
|
{
|
||||||
iter.second->update(delta);
|
iter.second->update(delta);
|
||||||
}
|
}
|
||||||
AX_SAFE_RELEASE(_owner);
|
CC_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 __AX_FRAMEWORK_COMCONTAINER_H__
|
#ifndef __CC_FRAMEWORK_COMCONTAINER_H__
|
||||||
#define __AX_FRAMEWORK_COMCONTAINER_H__
|
#define __CC_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 AX_DLL ComponentContainer
|
class CC_DLL ComponentContainer
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
|
@ -77,4 +77,4 @@ private:
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
||||||
/// @endcond
|
/// @endcond
|
||||||
#endif // __AX_FRAMEWORK_COMCONTAINER_H__
|
#endif // __CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_bufferTriangle);
|
CC_SAFE_FREE(_bufferTriangle);
|
||||||
AX_SAFE_FREE(_bufferPoint);
|
CC_SAFE_FREE(_bufferPoint);
|
||||||
AX_SAFE_FREE(_bufferLine);
|
CC_SAFE_FREE(_bufferLine);
|
||||||
|
|
||||||
freeShaderInternal(_customCommandTriangle);
|
freeShaderInternal(_customCommandTriangle);
|
||||||
freeShaderInternal(_customCommandPoint);
|
freeShaderInternal(_customCommandPoint);
|
||||||
|
@ -82,7 +82,7 @@ DrawNode* DrawNode::create(float defaultLineWidth)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -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;
|
||||||
AX_SAFE_RELEASE(pipelinePS);
|
CC_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;
|
||||||
AX_SAFE_RELEASE_NULL(pipelinePS);
|
CC_SAFE_RELEASE_NULL(pipelinePS);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrawNode::setVertexLayout(CustomCommand& cmd)
|
void DrawNode::setVertexLayout(CustomCommand& cmd)
|
||||||
|
|
|
@ -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 AX_DLL DrawNode : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(DrawNode);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ bool FastTMXLayer::initWithTilesetInfo(TMXTilesetInfo* tilesetInfo, TMXLayerInfo
|
||||||
|
|
||||||
// tilesetInfo
|
// tilesetInfo
|
||||||
_tileSet = tilesetInfo;
|
_tileSet = tilesetInfo;
|
||||||
AX_SAFE_RETAIN(_tileSet);
|
CC_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(AX_POINT_PIXELS_TO_POINTS(offset));
|
this->setPosition(CC_POINT_PIXELS_TO_POINTS(offset));
|
||||||
|
|
||||||
this->setContentSize(
|
this->setContentSize(
|
||||||
AX_SIZE_PIXELS_TO_POINTS(Vec2(_layerSize.width * _mapTileSize.width, _layerSize.height * _mapTileSize.height)));
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_tileSet);
|
CC_SAFE_RELEASE(_tileSet);
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
AX_SAFE_FREE(_tiles);
|
CC_SAFE_FREE(_tiles);
|
||||||
AX_SAFE_RELEASE(_vertexBuffer);
|
CC_SAFE_RELEASE(_vertexBuffer);
|
||||||
AX_SAFE_RELEASE(_indexBuffer);
|
CC_SAFE_RELEASE(_indexBuffer);
|
||||||
|
|
||||||
for (auto& e : _customCommands)
|
for (auto& e : _customCommands)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(e.second->getPipelineDescriptor().programState);
|
CC_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 = AX_SIZE_PIXELS_TO_POINTS(_mapTileSize);
|
Vec2 mapTileSize = CC_SIZE_PIXELS_TO_POINTS(_mapTileSize);
|
||||||
Vec2 tileSize = AX_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
Vec2 tileSize = CC_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);
|
||||||
|
@ -275,7 +275,7 @@ void FastTMXLayer::updateVertexBuffer()
|
||||||
|
|
||||||
void FastTMXLayer::updateIndexBuffer()
|
void FastTMXLayer::updateIndexBuffer()
|
||||||
{
|
{
|
||||||
#ifdef AX_FAST_TILEMAP_32_BIT_INDICES
|
#ifdef CC_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());
|
||||||
|
@ -384,8 +384,8 @@ void FastTMXLayer::setupTiles()
|
||||||
|
|
||||||
Mat4 FastTMXLayer::tileToNodeTransform()
|
Mat4 FastTMXLayer::tileToNodeTransform()
|
||||||
{
|
{
|
||||||
float w = _mapTileSize.width / AX_CONTENT_SCALE_FACTOR();
|
float w = _mapTileSize.width / CC_CONTENT_SCALE_FACTOR();
|
||||||
float h = _mapTileSize.height / AX_CONTENT_SCALE_FACTOR();
|
float h = _mapTileSize.height / CC_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 AX_FAST_TILEMAP_32_BIT_INDICES
|
#if CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(pipelineDescriptor.programState);
|
CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(pipelineDescriptor.programState);
|
CC_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 = AX_SIZE_PIXELS_TO_POINTS(_tileSet->_tileSize);
|
Vec2 tileSize = CC_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));
|
||||||
|
@ -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 = AX_RECT_PIXELS_TO_POINTS(rect);
|
rect = CC_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);
|
||||||
|
@ -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 = AX_RECT_PIXELS_TO_POINTS(rect);
|
rect = CC_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(AX_CALLBACK_1(TMXTileAnimTask::tickAndScheduleNext, this),
|
_layer->getParent()->scheduleOnce(CC_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 AX_DLL FastTMXLayer : public Node
|
class CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(info);
|
CC_SAFE_RETAIN(info);
|
||||||
AX_SAFE_RELEASE(_tileSet);
|
CC_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 AX_FAST_TILEMAP_32_BIT_INDICES
|
#ifdef CC_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 AX_DLL TMXTileAnimTask : public Ref
|
class CC_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 AX_DLL TMXTileAnimManager : public Ref
|
class CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ FastTMXTiledMap* FastTMXTiledMap::createWithXML(std::string_view tmxString, std:
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ class FastTMXLayer;
|
||||||
* @since v3.2
|
* @since v3.2
|
||||||
* @js NA
|
* @js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL FastTMXTiledMap : public Node
|
class CC_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);
|
||||||
|
|
||||||
AX_DEPRECATED_ATTRIBUTE int getLayerNum() const { return getLayerCount(); }
|
CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(FastTMXTiledMap);
|
CC_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 AX_DLL Font : public Ref
|
class CC_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 AX_TARGET_PLATFORM != AX_PLATFORM_WIN32 && AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID
|
#if CC_TARGET_PLATFORM != CC_PLATFORM_WIN32 && CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID
|
||||||
#elif AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID
|
#elif CC_TARGET_PLATFORM == CC_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(AX_USE_METAL)
|
#if defined(CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
auto eventDispatcher = Director::getInstance()->getEventDispatcher();
|
||||||
|
|
||||||
_rendererRecreatedListener = EventListenerCustom::create(
|
_rendererRecreatedListener = EventListenerCustom::create(
|
||||||
EVENT_RENDERER_RECREATED, AX_CALLBACK_1(FontAtlas::listenRendererRecreated, this));
|
EVENT_RENDERER_RECREATED, CC_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(AX_USE_METAL)
|
#if defined(CC_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 AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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();
|
||||||
|
|
||||||
AX_SAFE_DELETE_ARRAY(_currentPageData);
|
CC_SAFE_DELETE_ARRAY(_currentPageData);
|
||||||
#if defined(AX_USE_METAL)
|
#if defined(CC_USE_METAL)
|
||||||
AX_SAFE_DELETE_ARRAY(_currentPageDataRGBA);
|
CC_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 = AX_CONTENT_SCALE_FACTOR();
|
auto scaleFactor = CC_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(AX_USE_METAL)
|
#if !defined(CC_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(AX_USE_METAL)
|
#if !defined(CC_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 AX_DLL FontAtlas : public Ref
|
class CC_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(AX_USE_METAL)
|
#if defined(CC_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())
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(it->second);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(item->second);
|
CC_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 AX_DLL FontAtlasCache
|
class CC_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);
|
||||||
AX_DEPRECATED_ATTRIBUTE static FontAtlas* getFontAtlasFNT(std::string_view fontFileName, const Vec2& imageOffset);
|
CC_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);
|
||||||
|
|
||||||
AX_DEPRECATED_ATTRIBUTE static void reloadFontAtlasFNT(std::string_view fontFileName,
|
CC_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.
|
||||||
|
|
|
@ -112,7 +112,7 @@ FontAtlas* FontCharMap::newFontAtlas()
|
||||||
|
|
||||||
tempAtlas->setLineHeight((float)_itemHeight);
|
tempAtlas->setLineHeight((float)_itemHeight);
|
||||||
|
|
||||||
auto contentScaleFactor = AX_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -121,13 +121,13 @@ BMFontConfiguration::~BMFontConfiguration()
|
||||||
this->purgeFontDefDictionary();
|
this->purgeFontDefDictionary();
|
||||||
this->purgeKerningDictionary();
|
this->purgeKerningDictionary();
|
||||||
_atlasName.clear();
|
_atlasName.clear();
|
||||||
AX_SAFE_DELETE(_characterSet);
|
CC_SAFE_DELETE(_characterSet);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string BMFontConfiguration::description() const
|
std::string BMFontConfiguration::description() const
|
||||||
{
|
{
|
||||||
return StringUtils::format(
|
return StringUtils::format(
|
||||||
"<BMFontConfiguration = " AX_FORMAT_PRINTF_SIZE_T " | Glphys:%d Kernings:%d | Image = %s>", (size_t)this,
|
"<BMFontConfiguration = " CC_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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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(AX_RECT_PIXELS_TO_POINTS(imageRect)), _imageRotated(imageRotated)
|
: _configuration(theContfig), _imageRectInPoints(CC_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();
|
||||||
AX_SAFE_DELETE(s_configurations);
|
CC_SAFE_DELETE(s_configurations);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -709,7 +709,7 @@ FontAtlas* FontFNT::newFontAtlas()
|
||||||
|
|
||||||
FontLetterDefinition tempDefinition;
|
FontLetterDefinition tempDefinition;
|
||||||
|
|
||||||
const auto tempRect = AX_RECT_PIXELS_TO_POINTS(fontDef.rect);
|
const auto tempRect = CC_RECT_PIXELS_TO_POINTS(fontDef.rect);
|
||||||
|
|
||||||
tempDefinition.offsetX = fontDef.xOffset;
|
tempDefinition.offsetX = fontDef.xOffset;
|
||||||
tempDefinition.offsetY = fontDef.yOffset;
|
tempDefinition.offsetY = fontDef.yOffset;
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(tempAtlas);
|
CC_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 AX_DLL BMFontConfiguration : public Ref
|
class CC_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 AX_DLL FontFNT : public Font
|
class CC_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);
|
||||||
|
|
||||||
AX_DEPRECATED_ATTRIBUTE static FontFNT* create(std::string_view fntFilePath, const Vec2& imageOffset = Vec2::ZERO);
|
CC_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 * AX_CONTENT_SCALE_FACTOR();
|
_outlineSize = outline * CC_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 * AX_CONTENT_SCALE_FACTOR());
|
int fontSizePoints = (int)(64.f * fontSize * CC_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;
|
||||||
|
|
||||||
|
|
|
@ -42,7 +42,7 @@ typedef struct FT_BBox_ FT_BBox;
|
||||||
|
|
||||||
NS_AX_BEGIN
|
NS_AX_BEGIN
|
||||||
|
|
||||||
class AX_DLL FontFreeType : public Font
|
class CC_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;
|
||||||
AX_SAFE_RETAIN(_texture);
|
CC_SAFE_RETAIN(_texture);
|
||||||
_isTextureFlipped = flipped;
|
_isTextureFlipped = flipped;
|
||||||
|
|
||||||
#ifdef AX_USE_METAL
|
#ifdef CC_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();
|
||||||
AX_SAFE_RELEASE(_programState);
|
CC_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;
|
||||||
|
@ -151,12 +151,12 @@ GridBase::~GridBase()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing GridBase: %p", this);
|
CCLOGINFO("deallocing GridBase: %p", this);
|
||||||
|
|
||||||
AX_SAFE_RELEASE(_renderTarget);
|
CC_SAFE_RELEASE(_renderTarget);
|
||||||
|
|
||||||
// TODO: ? why 2.0 comments this line: setActive(false);
|
// TODO: ? why 2.0 comments this line: setActive(false);
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
|
|
||||||
AX_SAFE_RELEASE(_programState);
|
CC_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();
|
||||||
AX_SAFE_RELEASE(_renderTarget);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_texCoordinates);
|
CC_SAFE_FREE(_texCoordinates);
|
||||||
AX_SAFE_FREE(_vertices);
|
CC_SAFE_FREE(_vertices);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_SAFE_FREE(_indices);
|
||||||
AX_SAFE_FREE(_originalVertices);
|
CC_SAFE_FREE(_originalVertices);
|
||||||
AX_SAFE_FREE(_vertexBuffer);
|
CC_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;
|
||||||
|
|
||||||
AX_SAFE_FREE(_vertices);
|
CC_SAFE_FREE(_vertices);
|
||||||
AX_SAFE_FREE(_originalVertices);
|
CC_SAFE_FREE(_originalVertices);
|
||||||
AX_SAFE_FREE(_texCoordinates);
|
CC_SAFE_FREE(_texCoordinates);
|
||||||
AX_SAFE_FREE(_vertexBuffer);
|
CC_SAFE_FREE(_vertexBuffer);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_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));
|
||||||
|
|
||||||
|
@ -552,10 +552,10 @@ void Grid3D::updateVertexAndTexCoordinate()
|
||||||
|
|
||||||
TiledGrid3D::~TiledGrid3D()
|
TiledGrid3D::~TiledGrid3D()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_texCoordinates);
|
CC_SAFE_FREE(_texCoordinates);
|
||||||
AX_SAFE_FREE(_vertices);
|
CC_SAFE_FREE(_vertices);
|
||||||
AX_SAFE_FREE(_originalVertices);
|
CC_SAFE_FREE(_originalVertices);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_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);
|
||||||
AX_SAFE_FREE(_vertices);
|
CC_SAFE_FREE(_vertices);
|
||||||
AX_SAFE_FREE(_originalVertices);
|
CC_SAFE_FREE(_originalVertices);
|
||||||
AX_SAFE_FREE(_texCoordinates);
|
CC_SAFE_FREE(_texCoordinates);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_SAFE_FREE(_indices);
|
||||||
AX_SAFE_FREE(_vertexBuffer);
|
CC_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));
|
||||||
|
|
|
@ -53,7 +53,7 @@ class RenderTarget;
|
||||||
|
|
||||||
/** Base class for Other grid.
|
/** Base class for Other grid.
|
||||||
*/
|
*/
|
||||||
class AX_DLL GridBase : public Ref
|
class CC_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 AX_DLL Grid3D : public GridBase
|
class CC_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 AX_DLL TiledGrid3D : public GridBase
|
class CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(letter);
|
CC_SAFE_DELETE(letter);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -206,9 +206,9 @@ Label::BatchCommand::BatchCommand()
|
||||||
|
|
||||||
Label::BatchCommand::~BatchCommand()
|
Label::BatchCommand::~BatchCommand()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(textCommand.getPipelineDescriptor().programState);
|
CC_SAFE_RELEASE(textCommand.getPipelineDescriptor().programState);
|
||||||
AX_SAFE_RELEASE(shadowCommand.getPipelineDescriptor().programState);
|
CC_SAFE_RELEASE(shadowCommand.getPipelineDescriptor().programState);
|
||||||
AX_SAFE_RELEASE(outLineCommand.getPipelineDescriptor().programState);
|
CC_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;
|
||||||
AX_SAFE_RELEASE(programStateText);
|
CC_SAFE_RELEASE(programStateText);
|
||||||
programStateText = programState->clone();
|
programStateText = programState->clone();
|
||||||
|
|
||||||
auto& programStateShadow = shadowCommand.getPipelineDescriptor().programState;
|
auto& programStateShadow = shadowCommand.getPipelineDescriptor().programState;
|
||||||
AX_SAFE_RELEASE(programStateShadow);
|
CC_SAFE_RELEASE(programStateShadow);
|
||||||
programStateShadow = programState->clone();
|
programStateShadow = programState->clone();
|
||||||
|
|
||||||
auto& programStateOutline = outLineCommand.getPipelineDescriptor().programState;
|
auto& programStateOutline = outLineCommand.getPipelineDescriptor().programState;
|
||||||
AX_SAFE_RELEASE(programStateOutline);
|
CC_SAFE_RELEASE(programStateOutline);
|
||||||
programStateOutline = programState->clone();
|
programStateOutline = programState->clone();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -274,7 +274,7 @@ Label* Label::createWithTTF(std::string_view text,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ Label* Label::createWithTTF(const TTFConfig& ttfConfig,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 AX_LABEL_DEBUG_DRAW
|
#if CC_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);
|
||||||
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
CC_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);
|
||||||
|
|
||||||
AX_SAFE_RELEASE_NULL(_textSprite);
|
CC_SAFE_RELEASE_NULL(_textSprite);
|
||||||
AX_SAFE_RELEASE_NULL(_shadowNode);
|
CC_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Label::reset()
|
void Label::reset()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(_textSprite);
|
CC_SAFE_RELEASE_NULL(_textSprite);
|
||||||
AX_SAFE_RELEASE_NULL(_shadowNode);
|
CC_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
Node::removeAllChildrenWithCleanup(true);
|
Node::removeAllChildrenWithCleanup(true);
|
||||||
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
CC_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 = AX_DEFAULT_FONT_LABEL_SIZE;
|
_systemFontSize = CC_DEFAULT_FONT_LABEL_SIZE;
|
||||||
|
|
||||||
if (_horizontalKernings)
|
if (_horizontalKernings)
|
||||||
{
|
{
|
||||||
|
@ -803,7 +803,7 @@ void Label::setFontAtlas(FontAtlas* atlas, bool distanceFieldEnabled /* = false
|
||||||
if (atlas == _fontAtlas)
|
if (atlas == _fontAtlas)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AX_SAFE_RETAIN(atlas);
|
CC_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 / AX_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / CC_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 / AX_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / CC_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 / AX_CONTENT_SCALE_FACTOR();
|
_bmFontSize = originalFontSize / CC_CONTENT_SCALE_FACTOR();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1157,7 +1157,7 @@ bool Label::alignText()
|
||||||
|
|
||||||
if (fontSize > 0 && isVerticalClamp())
|
if (fontSize > 0 && isVerticalClamp())
|
||||||
{
|
{
|
||||||
this->shrinkLabelToContentSize(AX_CALLBACK_0(Label::isVerticalClamp, this));
|
this->shrinkLabelToContentSize(CC_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(AX_CALLBACK_0(Label::isHorizontalClamp, this));
|
this->shrinkLabelToContentSize(CC_CALLBACK_0(Label::isHorizontalClamp, this));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -1543,7 +1543,7 @@ void Label::disableEffect(LabelEffect effect)
|
||||||
if (_shadowEnabled)
|
if (_shadowEnabled)
|
||||||
{
|
{
|
||||||
_shadowEnabled = false;
|
_shadowEnabled = false;
|
||||||
AX_SAFE_RELEASE_NULL(_shadowNode);
|
CC_SAFE_RELEASE_NULL(_shadowNode);
|
||||||
updateShaderProgram();
|
updateShaderProgram();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -1680,7 +1680,7 @@ void Label::updateContent()
|
||||||
{
|
{
|
||||||
_batchNodes.clear();
|
_batchNodes.clear();
|
||||||
_batchCommands.clear();
|
_batchCommands.clear();
|
||||||
AX_SAFE_RELEASE_NULL(_reusedLetter);
|
CC_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_RELEASE_NULL(_textSprite);
|
CC_SAFE_RELEASE_NULL(_textSprite);
|
||||||
AX_SAFE_RELEASE_NULL(_shadowNode);
|
CC_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 AX_LABEL_DEBUG_DRAW
|
#if CC_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 AX_USE_CULLING
|
#if CC_USE_CULLING
|
||||||
auto visitingCamera = Camera::getVisitingCamera();
|
auto visitingCamera = Camera::getVisitingCamera();
|
||||||
auto defaultCamera = Camera::getDefaultCamera();
|
auto defaultCamera = Camera::getDefaultCamera();
|
||||||
if (visitingCamera == defaultCamera)
|
if (visitingCamera == defaultCamera)
|
||||||
|
@ -2502,7 +2502,7 @@ FontDefinition Label::_getFontDefinition() const
|
||||||
systemFontDef._stroke._strokeEnabled = false;
|
systemFontDef._stroke._strokeEnabled = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID) && (AX_TARGET_PLATFORM != AX_PLATFORM_IOS)
|
#if (CC_TARGET_PLATFORM != CC_PLATFORM_ANDROID) && (CC_TARGET_PLATFORM != CC_PLATFORM_IOS)
|
||||||
if (systemFontDef._stroke._strokeEnabled)
|
if (systemFontDef._stroke._strokeEnabled)
|
||||||
{
|
{
|
||||||
CCLOGERROR("Stroke Currently only supported on iOS and Android!");
|
CCLOGERROR("Stroke Currently only supported on iOS and Android!");
|
||||||
|
@ -2530,7 +2530,7 @@ void Label::setGlobalZOrder(float globalZOrder)
|
||||||
_underlineNode->setGlobalZOrder(globalZOrder);
|
_underlineNode->setGlobalZOrder(globalZOrder);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AX_LABEL_DEBUG_DRAW
|
#if CC_LABEL_DEBUG_DRAW
|
||||||
_debugDrawNode->setGlobalZOrder(globalZOrder);
|
_debugDrawNode->setGlobalZOrder(globalZOrder);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,7 +41,7 @@ NS_AX_BEGIN
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#define AX_DEFAULT_FONT_LABEL_SIZE 12
|
#define CC_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 = AX_DEFAULT_FONT_LABEL_SIZE,
|
float size = CC_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 AX_DLL Label : public Node, public LabelProtocol, public BlendProtocol
|
class CC_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
|
||||||
*/
|
*/
|
||||||
AX_DEPRECATED_ATTRIBUTE static Label* createWithBMFont(std::string_view bmfontPath,
|
CC_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 */
|
||||||
AX_DEPRECATED_ATTRIBUTE virtual bool setBMFontFilePath(std::string_view bmfontFilePath,
|
CC_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 AX_LABEL_DEBUG_DRAW
|
#if CC_LABEL_DEBUG_DRAW
|
||||||
DrawNode* _debugDrawNode;
|
DrawNode* _debugDrawNode;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -920,7 +920,7 @@ protected:
|
||||||
backend::UniformLocation _effectTypeLocation;
|
backend::UniformLocation _effectTypeLocation;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Label);
|
CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +91,7 @@ LabelAtlas* LabelAtlas::create(std::string_view string, std::string_view fntFile
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -111,7 +111,7 @@ LabelAtlas* LabelAtlas::create(std::string_view string,
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -128,8 +128,8 @@ bool LabelAtlas::initWithString(std::string_view theString, std::string_view fnt
|
||||||
|
|
||||||
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
std::string textureFilename = relPathStr + dict["textureFilename"].asString();
|
||||||
|
|
||||||
unsigned int width = static_cast<unsigned int>(dict["itemWidth"].asInt() / AX_CONTENT_SCALE_FACTOR());
|
unsigned int width = static_cast<unsigned int>(dict["itemWidth"].asInt() / CC_CONTENT_SCALE_FACTOR());
|
||||||
unsigned int height = static_cast<unsigned int>(dict["itemHeight"].asInt() / AX_CONTENT_SCALE_FACTOR());
|
unsigned int height = static_cast<unsigned int>(dict["itemHeight"].asInt() / CC_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,8 +152,8 @@ 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 * AX_CONTENT_SCALE_FACTOR();
|
float itemWidthInPixels = _itemWidth * CC_CONTENT_SCALE_FACTOR();
|
||||||
float itemHeightInPixels = _itemHeight * AX_CONTENT_SCALE_FACTOR();
|
float itemHeightInPixels = _itemHeight * CC_CONTENT_SCALE_FACTOR();
|
||||||
if (_ignoreContentScaleFactor)
|
if (_ignoreContentScaleFactor)
|
||||||
{
|
{
|
||||||
itemWidthInPixels = static_cast<float>(_itemWidth);
|
itemWidthInPixels = static_cast<float>(_itemWidth);
|
||||||
|
@ -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 AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#if CC_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 // ! AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#endif // ! CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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 AX_DLL LabelAtlas : public AtlasNode, public LabelProtocol
|
class CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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 AX_LABELATLAS_DEBUG_DRAW
|
#if CC_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 = AX_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = CC_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 * AX_CONTENT_SCALE_FACTOR() / originalFontSize;
|
_bmfontScale = _bmFontSize * CC_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 = AX_CONTENT_SCALE_FACTOR();
|
auto contentScaleFactor = CC_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;
|
||||||
|
@ -318,12 +318,12 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
|
||||||
|
|
||||||
bool Label::multilineTextWrapByWord()
|
bool Label::multilineTextWrapByWord()
|
||||||
{
|
{
|
||||||
return multilineTextWrap(AX_CALLBACK_3(Label::getFirstWordLen, this));
|
return multilineTextWrap(CC_CALLBACK_3(Label::getFirstWordLen, this));
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Label::multilineTextWrapByChar()
|
bool Label::multilineTextWrapByChar()
|
||||||
{
|
{
|
||||||
return multilineTextWrap(AX_CALLBACK_3(Label::getFirstCharLen, this));
|
return multilineTextWrap(CC_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 (AX_TARGET_PLATFORM == AX_PLATFORM_MAC)
|
#if (CC_TARGET_PLATFORM == CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(layer);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(layer);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(layer);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(layer);
|
CC_SAFE_DELETE(layer);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -187,7 +187,7 @@ LayerGradient* LayerGradient::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -406,7 +406,7 @@ LayerRadialGradient::LayerRadialGradient()
|
||||||
|
|
||||||
LayerRadialGradient::~LayerRadialGradient()
|
LayerRadialGradient::~LayerRadialGradient()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE_NULL(_customCommand.getPipelineDescriptor().programState);
|
CC_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);
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -621,7 +621,7 @@ LayerMultiplex* LayerMultiplex::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -635,20 +635,20 @@ LayerMultiplex* LayerMultiplex::createWithArray(const Vector<Node*>& arrayOfLaye
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LayerMultiplex::addLayer(Node* layer)
|
void LayerMultiplex::addLayer(Node* layer)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, l);
|
sEngine->retainScriptObject(this, l);
|
||||||
}
|
}
|
||||||
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_layers.reserve(arrayOfLayers.size());
|
_layers.reserve(arrayOfLayers.size());
|
||||||
_layers.pushBack(arrayOfLayers);
|
_layers.pushBack(arrayOfLayers);
|
||||||
|
|
||||||
|
@ -746,13 +746,13 @@ void LayerMultiplex::switchToAndReleaseMe(int n)
|
||||||
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
|
||||||
|
|
||||||
this->removeChild(_layers.at(_enabledLayer), true);
|
this->removeChild(_layers.at(_enabledLayer), true);
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_DLL Layer : public Node
|
class CC_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 AX_DLL LayerColor : public Sprite
|
class CC_DLL LayerColor : public Sprite
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ public:
|
||||||
bool initWithColor(const Color4B& color);
|
bool initWithColor(const Color4B& color);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(LayerColor);
|
CC_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 AX_DLL LayerGradient : public LayerColor
|
class CC_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 AX_DLL LayerRadialGradient : public Node, BlendProtocol
|
class CC_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 AX_DLL LayerMultiplex : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(LayerMultiplex);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_ASSERT(intensity >= 0);
|
CC_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 = AX_RADIANS_TO_DEGREES(atan2f(-direction.x, -direction.z));
|
float rotY = CC_RADIANS_TO_DEGREES(atan2f(-direction.x, -direction.z));
|
||||||
float rotX = -AX_RADIANS_TO_DEGREES(atan2f(-direction.y, projLen));
|
float rotX = -CC_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 AX_DLL BaseLight : public Node
|
class CC_DLL BaseLight : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -103,7 +103,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL DirectionLight : public BaseLight
|
class CC_DLL DirectionLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -142,7 +142,7 @@ public:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL PointLight : public BaseLight
|
class CC_DLL PointLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -172,7 +172,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL SpotLight : public BaseLight
|
class CC_DLL SpotLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -270,7 +270,7 @@ protected:
|
||||||
/**
|
/**
|
||||||
@js NA
|
@js NA
|
||||||
*/
|
*/
|
||||||
class AX_DLL AmbientLight : public BaseLight
|
class CC_DLL AmbientLight : public BaseLight
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -79,7 +79,7 @@ Menu* Menu::createWithArray(const Vector<MenuItem*>& arrayOfItems)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 = AX_CALLBACK_2(Menu::onTouchBegan, this);
|
touchListener->onTouchBegan = CC_CALLBACK_2(Menu::onTouchBegan, this);
|
||||||
touchListener->onTouchMoved = AX_CALLBACK_2(Menu::onTouchMoved, this);
|
touchListener->onTouchMoved = CC_CALLBACK_2(Menu::onTouchMoved, this);
|
||||||
touchListener->onTouchEnded = AX_CALLBACK_2(Menu::onTouchEnded, this);
|
touchListener->onTouchEnded = CC_CALLBACK_2(Menu::onTouchEnded, this);
|
||||||
touchListener->onTouchCancelled = AX_CALLBACK_2(Menu::onTouchCancelled, this);
|
touchListener->onTouchCancelled = CC_CALLBACK_2(Menu::onTouchCancelled, this);
|
||||||
|
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(touchListener, this);
|
||||||
|
|
||||||
|
|
|
@ -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 AX_DLL Menu : public Node
|
class CC_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, ...) AX_REQUIRES_NULL_TERMINATION;
|
static Menu* create(MenuItem* item, ...) CC_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, ...) AX_REQUIRES_NULL_TERMINATION;
|
void alignItemsInColumns(int columns, ...) CC_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, ...) AX_REQUIRES_NULL_TERMINATION;
|
void alignItemsInRows(int rows, ...) CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Menu);
|
CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
BasicScriptData data(this);
|
BasicScriptData data(this);
|
||||||
ScriptEvent scriptEvent(kMenuClickedEvent, &data);
|
ScriptEvent scriptEvent(kMenuClickedEvent, &data);
|
||||||
ScriptEngineManager::sendEventToLua(scriptEvent);
|
ScriptEngineManager::sendEventToLua(scriptEvent);
|
||||||
|
@ -591,7 +591,7 @@ MenuItemImage* MenuItemImage::create()
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
|
|
||||||
while (i)
|
while (i)
|
||||||
{
|
{
|
||||||
z++;
|
z++;
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->retainScriptObject(this, i);
|
sEngine->retainScriptObject(this, i);
|
||||||
}
|
}
|
||||||
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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(AX_NATIVE_CONTROL_SCRIPT) && !AX_NATIVE_CONTROL_SCRIPT
|
#if defined(CC_NATIVE_CONTROL_SCRIPT) && !CC_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 AX_DLL MenuItem : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItem);
|
CC_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 AX_DLL MenuItemLabel : public MenuItem
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemLabel);
|
CC_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 AX_DLL MenuItemAtlasFont : public MenuItemLabel
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemAtlasFont);
|
CC_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 AX_DLL MenuItemFont : public MenuItemLabel
|
class CC_DLL MenuItemFont : public MenuItemLabel
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Creates a menu item from a string without target/selector. To be used with MenuItemToggle. */
|
/** Creates a menu item from a string without target/selector. To be used with MenuItemToggle. */
|
||||||
|
@ -292,7 +292,7 @@ protected:
|
||||||
std::string _fontName;
|
std::string _fontName;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemFont);
|
CC_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 AX_DLL MenuItemSprite : public MenuItem
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemSprite);
|
CC_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 AX_DLL MenuItemImage : public MenuItemSprite
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemImage);
|
CC_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 AX_DLL MenuItemToggle : public MenuItem
|
class CC_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,
|
||||||
...) AX_REQUIRES_NULL_TERMINATION;
|
...) CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
CC_DISALLOW_COPY_AND_ASSIGN(MenuItemToggle);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of 2d group
|
// end of 2d group
|
||||||
|
|
|
@ -44,12 +44,12 @@ MotionStreak::MotionStreak()
|
||||||
|
|
||||||
MotionStreak::~MotionStreak()
|
MotionStreak::~MotionStreak()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
AX_SAFE_FREE(_pointState);
|
CC_SAFE_FREE(_pointState);
|
||||||
AX_SAFE_FREE(_pointVertexes);
|
CC_SAFE_FREE(_pointVertexes);
|
||||||
AX_SAFE_FREE(_vertices);
|
CC_SAFE_FREE(_vertices);
|
||||||
AX_SAFE_FREE(_colorPointer);
|
CC_SAFE_FREE(_colorPointer);
|
||||||
AX_SAFE_FREE(_texCoords);
|
CC_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;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -215,8 +215,8 @@ void MotionStreak::setTexture(Texture2D* texture)
|
||||||
{
|
{
|
||||||
if (_texture != texture)
|
if (_texture != texture)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(texture);
|
CC_SAFE_RETAIN(texture);
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
_texture = texture;
|
_texture = texture;
|
||||||
|
|
||||||
setProgramStateWithRegistry(backend::ProgramType::POSITION_TEXTURE_COLOR, _texture);
|
setProgramStateWithRegistry(backend::ProgramType::POSITION_TEXTURE_COLOR, _texture);
|
||||||
|
|
|
@ -42,7 +42,7 @@ class Texture2D;
|
||||||
/** @class MotionStreak.
|
/** @class MotionStreak.
|
||||||
* @brief Creates a trailing path.
|
* @brief Creates a trailing path.
|
||||||
*/
|
*/
|
||||||
class AX_DLL MotionStreak : public Node, public TextureProtocol
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(MotionStreak);
|
CC_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 AX_NODE_RENDER_SUBPIXEL
|
#if CC_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 AX_HASH_NODE_NAME(name) (!name.empty() ? XXH3_64bits(name.data(), name.length()) : 0)
|
#define CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 AX_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
, _physicsBody(nullptr)
|
, _physicsBody(nullptr)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
@ -148,7 +148,7 @@ Node* Node::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -157,9 +157,9 @@ Node::~Node()
|
||||||
{
|
{
|
||||||
CCLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
|
CCLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
|
||||||
|
|
||||||
AX_SAFE_DELETE(_childrenIndexer);
|
CC_SAFE_DELETE(_childrenIndexer);
|
||||||
|
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_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
|
||||||
// `AX_SAFE_RELEASE_NULL(_actionManager)`.
|
// `CC_SAFE_RELEASE_NULL(_actionManager)`.
|
||||||
AX_SAFE_RELEASE_NULL(_userObject);
|
CC_SAFE_RELEASE_NULL(_userObject);
|
||||||
|
|
||||||
for (auto& child : _children)
|
for (auto& child : _children)
|
||||||
{
|
{
|
||||||
|
@ -178,26 +178,26 @@ Node::~Node()
|
||||||
|
|
||||||
removeAllComponents();
|
removeAllComponents();
|
||||||
|
|
||||||
AX_SAFE_DELETE(_componentContainer);
|
CC_SAFE_DELETE(_componentContainer);
|
||||||
|
|
||||||
stopAllActions();
|
stopAllActions();
|
||||||
unscheduleAllCallbacks();
|
unscheduleAllCallbacks();
|
||||||
AX_SAFE_RELEASE_NULL(_actionManager);
|
CC_SAFE_RELEASE_NULL(_actionManager);
|
||||||
AX_SAFE_RELEASE_NULL(_scheduler);
|
CC_SAFE_RELEASE_NULL(_scheduler);
|
||||||
|
|
||||||
_eventDispatcher->removeEventListenersForTarget(this);
|
_eventDispatcher->removeEventListenersForTarget(this);
|
||||||
|
|
||||||
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0
|
#if CC_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0
|
||||||
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
|
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
CCASSERT(!_running,
|
CCASSERT(!_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?");
|
||||||
AX_SAFE_RELEASE(_eventDispatcher);
|
CC_SAFE_RELEASE(_eventDispatcher);
|
||||||
|
|
||||||
delete[] _additionalTransform;
|
delete[] _additionalTransform;
|
||||||
AX_SAFE_RELEASE(_programState);
|
CC_SAFE_RELEASE(_programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Node::init()
|
bool Node::init()
|
||||||
|
@ -214,9 +214,9 @@ bool Node::initLayer() {
|
||||||
|
|
||||||
void Node::cleanup()
|
void Node::cleanup()
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnCleanup);
|
ScriptEngineManager::sendNodeEventToLua(this, kNodeOnCleanup);
|
||||||
#endif // #if AX_ENABLE_SCRIPT_BINDING
|
#endif // #if CC_ENABLE_SCRIPT_BINDING
|
||||||
|
|
||||||
// actions
|
// actions
|
||||||
this->stopAllActions();
|
this->stopAllActions();
|
||||||
|
@ -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 = AX_DEGREES_TO_RADIANS(_rotationX / 2.f), halfRady = AX_DEGREES_TO_RADIANS(_rotationY / 2.f),
|
float halfRadx = CC_DEGREES_TO_RADIANS(_rotationX / 2.f), halfRady = CC_DEGREES_TO_RADIANS(_rotationY / 2.f),
|
||||||
halfRadz = _rotationZ_X == _rotationZ_Y ? -AX_DEGREES_TO_RADIANS(_rotationZ_X / 2.f) : 0;
|
halfRadz = _rotationZ_X == _rotationZ_Y ? -CC_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 = AX_RADIANS_TO_DEGREES(_rotationX);
|
_rotationX = CC_RADIANS_TO_DEGREES(_rotationX);
|
||||||
_rotationY = AX_RADIANS_TO_DEGREES(_rotationY);
|
_rotationY = CC_RADIANS_TO_DEGREES(_rotationY);
|
||||||
_rotationZ_X = _rotationZ_Y = -AX_RADIANS_TO_DEGREES(_rotationZ_X);
|
_rotationZ_X = _rotationZ_Y = -CC_RADIANS_TO_DEGREES(_rotationZ_X);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::setRotationQuat(const Quaternion& quat)
|
void Node::setRotationQuat(const Quaternion& quat)
|
||||||
|
@ -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 = AX_HASH_NODE_NAME(name);
|
uint64_t newHash = CC_HASH_NODE_NAME(name);
|
||||||
auto parentChildrenIndexer = getParentChildrenIndexer();
|
auto parentChildrenIndexer = getParentChildrenIndexer();
|
||||||
if (parentChildrenIndexer)
|
if (parentChildrenIndexer)
|
||||||
{
|
{
|
||||||
auto oldHash = AX_HASH_NODE_NAME(_name);
|
auto oldHash = CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
AX_SAFE_RETAIN(userObject);
|
CC_SAFE_RETAIN(userObject);
|
||||||
AX_SAFE_RELEASE(_userObject);
|
CC_SAFE_RELEASE(_userObject);
|
||||||
_userObject = userObject;
|
_userObject = userObject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,7 +828,7 @@ 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");
|
// CCASSERT(!name.empty(), "Invalid name");
|
||||||
auto hash = AX_HASH_NODE_NAME(name);
|
auto hash = CC_HASH_NODE_NAME(name);
|
||||||
if (_childrenIndexer)
|
if (_childrenIndexer)
|
||||||
{
|
{
|
||||||
auto it = _childrenIndexer->find(hash);
|
auto it = _childrenIndexer->find(hash);
|
||||||
|
@ -1082,7 +1082,7 @@ void Node::removeChild(Node* child, bool cleanup /* = true */)
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize_t index = _children.getIndex(child);
|
ssize_t index = _children.getIndex(child);
|
||||||
if (index != AX_INVALID_INDEX)
|
if (index != CC_INVALID_INDEX)
|
||||||
this->detachChild(child, index, cleanup);
|
this->detachChild(child, index, cleanup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1132,7 +1132,7 @@ void Node::removeAllChildrenWithCleanup(bool cleanup)
|
||||||
}
|
}
|
||||||
|
|
||||||
_children.clear();
|
_children.clear();
|
||||||
AX_SAFE_DELETE(_childrenIndexer);
|
CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_transformUpdated = true;
|
_transformUpdated = true;
|
||||||
_reorderChildDirty = true;
|
_reorderChildDirty = true;
|
||||||
_children.pushBack(child);
|
_children.pushBack(child);
|
||||||
|
@ -1350,7 +1350,7 @@ void Node::onEnter()
|
||||||
|
|
||||||
_running = true;
|
_running = true;
|
||||||
|
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_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);
|
||||||
AX_SAFE_RETAIN(dispatcher);
|
CC_SAFE_RETAIN(dispatcher);
|
||||||
AX_SAFE_RELEASE(_eventDispatcher);
|
CC_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();
|
||||||
AX_SAFE_RETAIN(actionManager);
|
CC_SAFE_RETAIN(actionManager);
|
||||||
AX_SAFE_RELEASE(_actionManager);
|
CC_SAFE_RELEASE(_actionManager);
|
||||||
_actionManager = actionManager;
|
_actionManager = actionManager;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1493,8 +1493,8 @@ void Node::setScheduler(Scheduler* scheduler)
|
||||||
if (scheduler != _scheduler)
|
if (scheduler != _scheduler)
|
||||||
{
|
{
|
||||||
this->unscheduleAllCallbacks();
|
this->unscheduleAllCallbacks();
|
||||||
AX_SAFE_RETAIN(scheduler);
|
CC_SAFE_RETAIN(scheduler);
|
||||||
AX_SAFE_RELEASE(_scheduler);
|
CC_SAFE_RELEASE(_scheduler);
|
||||||
_scheduler = scheduler;
|
_scheduler = scheduler;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1523,7 +1523,7 @@ void Node::scheduleUpdateWithPriorityLua(int nHandler, int priority)
|
||||||
{
|
{
|
||||||
unscheduleUpdate();
|
unscheduleUpdate();
|
||||||
|
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
_updateScriptHandler = nHandler;
|
_updateScriptHandler = nHandler;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -1534,7 +1534,7 @@ void Node::unscheduleUpdate()
|
||||||
{
|
{
|
||||||
_scheduler->unscheduleUpdate(this);
|
_scheduler->unscheduleUpdate(this);
|
||||||
|
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_ENABLE_SCRIPT_BINDING
|
||||||
if (_updateScriptHandler)
|
if (_updateScriptHandler)
|
||||||
{
|
{
|
||||||
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptHandler(_updateScriptHandler);
|
||||||
|
@ -1545,12 +1545,12 @@ void Node::unscheduleUpdate()
|
||||||
|
|
||||||
void Node::schedule(SEL_SCHEDULE selector)
|
void Node::schedule(SEL_SCHEDULE selector)
|
||||||
{
|
{
|
||||||
this->schedule(selector, 0.0f, AX_REPEAT_FOREVER, 0.0f);
|
this->schedule(selector, 0.0f, CC_REPEAT_FOREVER, 0.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Node::schedule(SEL_SCHEDULE selector, float interval)
|
void Node::schedule(SEL_SCHEDULE selector, float interval)
|
||||||
{
|
{
|
||||||
this->schedule(selector, interval, AX_REPEAT_FOREVER, 0.0f);
|
this->schedule(selector, interval, CC_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)
|
||||||
|
@ -1626,7 +1626,7 @@ void Node::pause()
|
||||||
// override me
|
// override me
|
||||||
void Node::update(float fDelta)
|
void Node::update(float fDelta)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 = -AX_DEGREES_TO_RADIANS(_rotationZ_X);
|
float radiansX = -CC_DEGREES_TO_RADIANS(_rotationZ_X);
|
||||||
float radiansY = -AX_DEGREES_TO_RADIANS(_rotationZ_Y);
|
float radiansY = -CC_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(AX_DEGREES_TO_RADIANS(_skewY)),
|
(float)tanf(CC_DEGREES_TO_RADIANS(_skewY)),
|
||||||
0,
|
0,
|
||||||
0,
|
0,
|
||||||
(float)tanf(AX_DEGREES_TO_RADIANS(_skewX)),
|
(float)tanf(CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_programState);
|
CC_SAFE_RELEASE(_programState);
|
||||||
_programState = programState;
|
_programState = programState;
|
||||||
if (needsRetain)
|
if (needsRetain)
|
||||||
AX_SAFE_RETAIN(_programState);
|
CC_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 AX_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
# include "physics/CCPhysicsBody.h"
|
# include "physics/CCPhysicsBody.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -114,7 +114,7 @@ Node and override `draw`.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
class AX_DLL Node : public Ref
|
class CC_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 AX_64BITS
|
#if CC_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(AX_SCHEDULE_SELECTOR(MyNode::TickMe), 0, 0, 0);
|
this->schedule(CC_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 AX_REPEAT_FOREVER for tick
|
* @param repeat The selector will be executed (repeat + 1) times, you can use CC_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 AX_REPEAT_FOREVER for tick
|
* @param repeat The selector will be executed (repeat + 1) times, you can use CC_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 AX_LITTLE_ENDIAN
|
#if CC_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 AX_ENABLE_SCRIPT_BINDING
|
#if CC_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 AX_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
PhysicsBody* _physicsBody;
|
PhysicsBody* _physicsBody;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
@ -2025,7 +2025,7 @@ public:
|
||||||
static int __attachedNodeCount;
|
static int __attachedNodeCount;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(Node);
|
CC_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 AX_DLL isScreenPointInRect(const Vec2& pt, const Camera* camera, const Mat4& w2l, const Rect& rect, Vec3* p);
|
bool CC_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
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -56,7 +56,7 @@ NodeGrid::NodeGrid() {}
|
||||||
|
|
||||||
void NodeGrid::setTarget(Node* target)
|
void NodeGrid::setTarget(Node* target)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
AX_SAFE_RELEASE(_gridTarget);
|
CC_SAFE_RELEASE(_gridTarget);
|
||||||
AX_SAFE_RETAIN(target);
|
CC_SAFE_RETAIN(target);
|
||||||
_gridTarget = target;
|
_gridTarget = target;
|
||||||
}
|
}
|
||||||
|
|
||||||
NodeGrid::~NodeGrid()
|
NodeGrid::~NodeGrid()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_nodeGrid);
|
CC_SAFE_RELEASE(_nodeGrid);
|
||||||
AX_SAFE_RELEASE(_gridTarget);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_nodeGrid);
|
CC_SAFE_RELEASE(_nodeGrid);
|
||||||
AX_SAFE_RETAIN(grid);
|
CC_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 AX_DLL NodeGrid : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(NodeGrid);
|
CC_DISALLOW_COPY_AND_ASSIGN(NodeGrid);
|
||||||
};
|
};
|
||||||
/** @} */
|
/** @} */
|
||||||
NS_AX_END
|
NS_AX_END
|
||||||
|
|
|
@ -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 AX_DLL ParallaxNode : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParallaxNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -85,8 +85,8 @@ ParticleBatchNode::ParticleBatchNode()
|
||||||
|
|
||||||
ParticleBatchNode::~ParticleBatchNode()
|
ParticleBatchNode::~ParticleBatchNode()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_textureAtlas);
|
CC_SAFE_RELEASE(_textureAtlas);
|
||||||
AX_SAFE_RELEASE(_customCommand.getPipelineDescriptor().programState);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(p);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(p);
|
CC_SAFE_DELETE(p);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -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)
|
||||||
{
|
{
|
||||||
AX_PROFILER_START("CCParticleBatchNode - draw");
|
CC_PROFILER_START("CCParticleBatchNode - draw");
|
||||||
|
|
||||||
if (_textureAtlas->getTotalQuads() == 0)
|
if (_textureAtlas->getTotalQuads() == 0)
|
||||||
return;
|
return;
|
||||||
|
@ -476,7 +476,7 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t
|
||||||
|
|
||||||
renderer->addCommand(&_customCommand);
|
renderer->addCommand(&_customCommand);
|
||||||
|
|
||||||
AX_PROFILER_STOP("CCParticleBatchNode - draw");
|
CC_PROFILER_STOP("CCParticleBatchNode - draw");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity)
|
void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity)
|
||||||
|
@ -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 == AX_BLEND_SRC && _blendFunc.dst == AX_BLEND_DST))
|
if (!texture->hasPremultipliedAlpha() && (_blendFunc.src == CC_BLEND_SRC && _blendFunc.dst == CC_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 AX_DLL ParticleBatchNode : public Node, public TextureProtocol
|
class CC_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);
|
||||||
AX_BREAK_IF(texture != nullptr);
|
CC_BREAK_IF(texture != nullptr);
|
||||||
|
|
||||||
image = new Image();
|
image = new Image();
|
||||||
bool ret = image->initWithImageData(__firePngData, sizeof(__firePngData));
|
bool ret = image->initWithImageData(__firePngData, sizeof(__firePngData));
|
||||||
AX_BREAK_IF(!ret);
|
CC_BREAK_IF(!ret);
|
||||||
|
|
||||||
texture = Director::getInstance()->getTextureCache()->addImage(image, key);
|
texture = Director::getInstance()->getTextureCache()->addImage(image, key);
|
||||||
} while (0);
|
} while (0);
|
||||||
|
|
||||||
AX_SAFE_RELEASE(image);
|
CC_SAFE_RELEASE(image);
|
||||||
|
|
||||||
return texture;
|
return texture;
|
||||||
}
|
}
|
||||||
|
@ -67,7 +67,7 @@ ParticleFire* ParticleFire::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -81,7 +81,7 @@ ParticleFire* ParticleFire::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -171,7 +171,7 @@ ParticleFireworks* ParticleFireworks::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -185,7 +185,7 @@ ParticleFireworks* ParticleFireworks::createWithTotalParticles(int numberOfParti
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ ParticleSun* ParticleSun::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -286,7 +286,7 @@ ParticleSun* ParticleSun::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -378,7 +378,7 @@ ParticleGalaxy* ParticleGalaxy::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -392,7 +392,7 @@ ParticleGalaxy* ParticleGalaxy::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -487,7 +487,7 @@ ParticleFlower* ParticleFlower::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -501,7 +501,7 @@ ParticleFlower* ParticleFlower::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -595,7 +595,7 @@ ParticleMeteor* ParticleMeteor::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -609,7 +609,7 @@ ParticleMeteor* ParticleMeteor::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -704,7 +704,7 @@ ParticleSpiral* ParticleSpiral::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -718,7 +718,7 @@ ParticleSpiral* ParticleSpiral::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -813,7 +813,7 @@ ParticleExplosion* ParticleExplosion::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -827,7 +827,7 @@ ParticleExplosion* ParticleExplosion::createWithTotalParticles(int numberOfParti
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -921,7 +921,7 @@ ParticleSmoke* ParticleSmoke::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -935,7 +935,7 @@ ParticleSmoke* ParticleSmoke::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1026,7 +1026,7 @@ ParticleSnow* ParticleSnow::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1040,7 +1040,7 @@ ParticleSnow* ParticleSnow::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1134,7 +1134,7 @@ ParticleRain* ParticleRain::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -1148,7 +1148,7 @@ ParticleRain* ParticleRain::createWithTotalParticles(int numberOfParticles)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_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 AX_DLL ParticleFire : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFire);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleFireworks
|
/** @class ParticleFireworks
|
||||||
* @brief A fireworks particle system.
|
* @brief A fireworks particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleFireworks : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFireworks);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSun
|
/** @class ParticleSun
|
||||||
* @brief A sun particle system.
|
* @brief A sun particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleSun : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSun);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleGalaxy
|
/** @class ParticleGalaxy
|
||||||
* @brief A galaxy particle system.
|
* @brief A galaxy particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleGalaxy : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleGalaxy);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleFlower
|
/** @class ParticleFlower
|
||||||
* @brief A flower particle system.
|
* @brief A flower particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleFlower : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleFlower);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleMeteor
|
/** @class ParticleMeteor
|
||||||
* @brief A meteor particle system.
|
* @brief A meteor particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleMeteor : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleMeteor);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSpiral
|
/** @class ParticleSpiral
|
||||||
* @brief An spiral particle system.
|
* @brief An spiral particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleSpiral : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSpiral);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleExplosion
|
/** @class ParticleExplosion
|
||||||
* @brief An explosion particle system.
|
* @brief An explosion particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleExplosion : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleExplosion);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSmoke
|
/** @class ParticleSmoke
|
||||||
* @brief An smoke particle system.
|
* @brief An smoke particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleSmoke : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSmoke);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleSnow
|
/** @class ParticleSnow
|
||||||
* @brief An snow particle system.
|
* @brief An snow particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleSnow : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSnow);
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @class ParticleRain
|
/** @class ParticleRain
|
||||||
* @brief A rain particle system.
|
* @brief A rain particle system.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleRain : public ParticleSystemQuad
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleRain);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(posx);
|
CC_SAFE_FREE(posx);
|
||||||
AX_SAFE_FREE(posy);
|
CC_SAFE_FREE(posy);
|
||||||
AX_SAFE_FREE(startPosX);
|
CC_SAFE_FREE(startPosX);
|
||||||
AX_SAFE_FREE(startPosY);
|
CC_SAFE_FREE(startPosY);
|
||||||
AX_SAFE_FREE(colorR);
|
CC_SAFE_FREE(colorR);
|
||||||
AX_SAFE_FREE(colorG);
|
CC_SAFE_FREE(colorG);
|
||||||
AX_SAFE_FREE(colorB);
|
CC_SAFE_FREE(colorB);
|
||||||
AX_SAFE_FREE(colorA);
|
CC_SAFE_FREE(colorA);
|
||||||
AX_SAFE_FREE(deltaColorR);
|
CC_SAFE_FREE(deltaColorR);
|
||||||
AX_SAFE_FREE(deltaColorG);
|
CC_SAFE_FREE(deltaColorG);
|
||||||
AX_SAFE_FREE(deltaColorB);
|
CC_SAFE_FREE(deltaColorB);
|
||||||
AX_SAFE_FREE(deltaColorA);
|
CC_SAFE_FREE(deltaColorA);
|
||||||
AX_SAFE_FREE(hue);
|
CC_SAFE_FREE(hue);
|
||||||
AX_SAFE_FREE(sat);
|
CC_SAFE_FREE(sat);
|
||||||
AX_SAFE_FREE(val);
|
CC_SAFE_FREE(val);
|
||||||
AX_SAFE_FREE(opacityFadeInDelta);
|
CC_SAFE_FREE(opacityFadeInDelta);
|
||||||
AX_SAFE_FREE(opacityFadeInLength);
|
CC_SAFE_FREE(opacityFadeInLength);
|
||||||
AX_SAFE_FREE(scaleInDelta);
|
CC_SAFE_FREE(scaleInDelta);
|
||||||
AX_SAFE_FREE(scaleInLength);
|
CC_SAFE_FREE(scaleInLength);
|
||||||
AX_SAFE_FREE(size);
|
CC_SAFE_FREE(size);
|
||||||
AX_SAFE_FREE(deltaSize);
|
CC_SAFE_FREE(deltaSize);
|
||||||
AX_SAFE_FREE(rotation);
|
CC_SAFE_FREE(rotation);
|
||||||
AX_SAFE_FREE(staticRotation);
|
CC_SAFE_FREE(staticRotation);
|
||||||
AX_SAFE_FREE(deltaRotation);
|
CC_SAFE_FREE(deltaRotation);
|
||||||
AX_SAFE_FREE(totalTimeToLive);
|
CC_SAFE_FREE(totalTimeToLive);
|
||||||
AX_SAFE_FREE(timeToLive);
|
CC_SAFE_FREE(timeToLive);
|
||||||
AX_SAFE_FREE(animTimeLength);
|
CC_SAFE_FREE(animTimeLength);
|
||||||
AX_SAFE_FREE(animTimeDelta);
|
CC_SAFE_FREE(animTimeDelta);
|
||||||
AX_SAFE_FREE(animIndex);
|
CC_SAFE_FREE(animIndex);
|
||||||
AX_SAFE_FREE(animCellIndex);
|
CC_SAFE_FREE(animCellIndex);
|
||||||
AX_SAFE_FREE(atlasIndex);
|
CC_SAFE_FREE(atlasIndex);
|
||||||
|
|
||||||
AX_SAFE_FREE(modeA.dirX);
|
CC_SAFE_FREE(modeA.dirX);
|
||||||
AX_SAFE_FREE(modeA.dirY);
|
CC_SAFE_FREE(modeA.dirY);
|
||||||
AX_SAFE_FREE(modeA.radialAccel);
|
CC_SAFE_FREE(modeA.radialAccel);
|
||||||
AX_SAFE_FREE(modeA.tangentialAccel);
|
CC_SAFE_FREE(modeA.tangentialAccel);
|
||||||
|
|
||||||
AX_SAFE_FREE(modeB.angle);
|
CC_SAFE_FREE(modeB.angle);
|
||||||
AX_SAFE_FREE(modeB.degreesPerSecond);
|
CC_SAFE_FREE(modeB.degreesPerSecond);
|
||||||
AX_SAFE_FREE(modeB.deltaRadius);
|
CC_SAFE_FREE(modeB.deltaRadius);
|
||||||
AX_SAFE_FREE(modeB.radius);
|
CC_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;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -291,7 +291,7 @@ ParticleSystem* ParticleSystem::createWithTotalParticles(int numberOfParticles)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -321,10 +321,10 @@ bool ParticleSystem::allocAnimationMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocAnimationMem()
|
void ParticleSystem::deallocAnimationMem()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_particleData.animTimeLength);
|
CC_SAFE_FREE(_particleData.animTimeLength);
|
||||||
AX_SAFE_FREE(_particleData.animTimeDelta);
|
CC_SAFE_FREE(_particleData.animTimeDelta);
|
||||||
AX_SAFE_FREE(_particleData.animIndex);
|
CC_SAFE_FREE(_particleData.animIndex);
|
||||||
AX_SAFE_FREE(_particleData.animCellIndex);
|
CC_SAFE_FREE(_particleData.animCellIndex);
|
||||||
_isAnimAllocated = false;
|
_isAnimAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,9 +346,9 @@ bool ParticleSystem::allocHSVMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocHSVMem()
|
void ParticleSystem::deallocHSVMem()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_particleData.hue);
|
CC_SAFE_FREE(_particleData.hue);
|
||||||
AX_SAFE_FREE(_particleData.sat);
|
CC_SAFE_FREE(_particleData.sat);
|
||||||
AX_SAFE_FREE(_particleData.val);
|
CC_SAFE_FREE(_particleData.val);
|
||||||
_isHSVAllocated = false;
|
_isHSVAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,8 +369,8 @@ bool ParticleSystem::allocOpacityFadeInMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocOpacityFadeInMem()
|
void ParticleSystem::deallocOpacityFadeInMem()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_particleData.opacityFadeInDelta);
|
CC_SAFE_FREE(_particleData.opacityFadeInDelta);
|
||||||
AX_SAFE_FREE(_particleData.opacityFadeInLength);
|
CC_SAFE_FREE(_particleData.opacityFadeInLength);
|
||||||
_isOpacityFadeInAllocated = false;
|
_isOpacityFadeInAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,8 +391,8 @@ bool ParticleSystem::allocScaleInMem()
|
||||||
|
|
||||||
void ParticleSystem::deallocScaleInMem()
|
void ParticleSystem::deallocScaleInMem()
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_particleData.scaleInDelta);
|
CC_SAFE_FREE(_particleData.scaleInDelta);
|
||||||
AX_SAFE_FREE(_particleData.scaleInLength);
|
CC_SAFE_FREE(_particleData.scaleInLength);
|
||||||
_isScaleInAllocated = false;
|
_isScaleInAllocated = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -574,7 +574,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CCASSERT(false, "Invalid emitterType in config file");
|
CCASSERT(false, "Invalid emitterType in config file");
|
||||||
AX_BREAK_IF(true);
|
CC_BREAK_IF(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
// life span
|
// life span
|
||||||
|
@ -639,19 +639,19 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
|
||||||
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");
|
CCASSERT(buffer != nullptr, "CCParticleSystem: error decoding textureImageData");
|
||||||
AX_BREAK_IF(!buffer);
|
CC_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");
|
CCASSERT(deflated != nullptr, "CCParticleSystem: error ungzipping textureImageData");
|
||||||
AX_BREAK_IF(!deflated);
|
CC_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");
|
CCASSERT(isOK, "CCParticleSystem: error init image with Data");
|
||||||
AX_BREAK_IF(!isOK);
|
CC_BREAK_IF(!isOK);
|
||||||
|
|
||||||
setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName));
|
setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName));
|
||||||
|
|
||||||
|
@ -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 = (AX_UPDATE_PARTICLE_IMP) [self methodForSelector:updateParticleSel];
|
// updateParticleImp = (CC_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();
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_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, -AX_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
point = point.rotateByAngle(Vec2::ZERO, -CC_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, -AX_DEGREES_TO_RADIANS(shape.coneOffset + shape.coneAngle / 2 * _rng.rangef()));
|
point = point.rotateByAngle(Vec2::ZERO, -CC_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, -AX_DEGREES_TO_RADIANS(angle));
|
point = point.rotateByAngle(Vec2::ZERO, -CC_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 = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
float a = CC_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] = -AX_RADIANS_TO_DEGREES(dir.getAngle());
|
_particleData.rotation[i] = -CC_RADIANS_TO_DEGREES(dir.getAngle());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
for (int i = start; i < _particleCount; ++i)
|
for (int i = start; i < _particleCount; ++i)
|
||||||
{
|
{
|
||||||
float a = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
float a = CC_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] = AX_DEGREES_TO_RADIANS(_angle + _angleVar * _rng.rangef());
|
_particleData.modeB.angle[i] = CC_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] =
|
||||||
AX_DEGREES_TO_RADIANS(modeB.rotatePerSecond + modeB.rotatePerSecondVar * _rng.rangef());
|
CC_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)
|
||||||
|
@ -1558,7 +1558,7 @@ void ParticleSystem::update(float dt)
|
||||||
if (!_visible)
|
if (!_visible)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
AX_PROFILER_START_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
CC_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;
|
||||||
AX_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
CC_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dt = _fixedFPSDelta;
|
dt = _fixedFPSDelta;
|
||||||
|
@ -1838,7 +1838,7 @@ void ParticleSystem::update(float dt)
|
||||||
postStep();
|
postStep();
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_PROFILER_STOP_CATEGORY(kProfilerCategoryParticles, "CCParticleSystem - update");
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(var);
|
CC_SAFE_RETAIN(var);
|
||||||
AX_SAFE_RELEASE(_texture);
|
CC_SAFE_RELEASE(_texture);
|
||||||
_texture = var;
|
_texture = var;
|
||||||
updateBlendFunc();
|
updateBlendFunc();
|
||||||
}
|
}
|
||||||
|
@ -1878,7 +1878,7 @@ void ParticleSystem::updateBlendFunc()
|
||||||
|
|
||||||
_opacityModifyRGB = false;
|
_opacityModifyRGB = false;
|
||||||
|
|
||||||
if (_texture && (_blendFunc.src == AX_BLEND_SRC && _blendFunc.dst == AX_BLEND_DST))
|
if (_texture && (_blendFunc.src == CC_BLEND_SRC && _blendFunc.dst == CC_BLEND_DST))
|
||||||
{
|
{
|
||||||
if (premultiplied)
|
if (premultiplied)
|
||||||
{
|
{
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct ParticleFrameDescriptor
|
||||||
bool isRotated;
|
bool isRotated;
|
||||||
};
|
};
|
||||||
|
|
||||||
class AX_DLL ParticleData
|
class CC_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 AX_DLL ParticleEmissionMaskCache : public axis::Ref
|
class CC_DLL ParticleEmissionMaskCache : public axis::Ref
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
static ParticleEmissionMaskCache* getInstance();
|
static ParticleEmissionMaskCache* getInstance();
|
||||||
|
@ -306,7 +306,7 @@ private:
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// typedef void (*AX_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Vec2);
|
// typedef void (*CC_UPDATE_PARTICLE_IMP)(id, SEL, tParticle*, Vec2);
|
||||||
|
|
||||||
class Texture2D;
|
class Texture2D;
|
||||||
|
|
||||||
|
@ -354,7 +354,7 @@ emitter.startSpin = 0;
|
||||||
@endcode
|
@endcode
|
||||||
|
|
||||||
*/
|
*/
|
||||||
class AX_DLL ParticleSystem : public Node, public TextureProtocol, public PlayableProtocol
|
class CC_DLL ParticleSystem : public Node, public TextureProtocol, public PlayableProtocol
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/** Mode
|
/** Mode
|
||||||
|
@ -1535,7 +1535,7 @@ protected:
|
||||||
float _emitCounter;
|
float _emitCounter;
|
||||||
|
|
||||||
// Optimization
|
// Optimization
|
||||||
// AX_UPDATE_PARTICLE_IMP updateParticleImp;
|
// CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSystem);
|
CC_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)
|
||||||
{
|
{
|
||||||
AX_SAFE_FREE(_quads);
|
CC_SAFE_FREE(_quads);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_SAFE_FREE(_indices);
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_RELEASE_NULL(_quadCommand.getPipelineDescriptor().programState);
|
CC_SAFE_RELEASE_NULL(_quadCommand.getPipelineDescriptor().programState);
|
||||||
}
|
}
|
||||||
|
|
||||||
// implementation ParticleSystemQuad
|
// implementation ParticleSystemQuad
|
||||||
|
@ -100,7 +100,7 @@ ParticleSystemQuad* ParticleSystemQuad::create(std::string_view filename)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -116,7 +116,7 @@ ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfPar
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ ParticleSystemQuad* ParticleSystemQuad::create(ValueMap& dictionary)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -149,10 +149,10 @@ bool ParticleSystemQuad::initWithTotalParticles(int numberOfParticles)
|
||||||
initIndices();
|
initIndices();
|
||||||
// setupVBO();
|
// setupVBO();
|
||||||
|
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_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,
|
||||||
AX_CALLBACK_1(ParticleSystemQuad::listenRendererRecreated, this));
|
CC_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 * AX_CONTENT_SCALE_FACTOR(), pointRect.origin.y * AX_CONTENT_SCALE_FACTOR(),
|
Rect(pointRect.origin.x * CC_CONTENT_SCALE_FACTOR(), pointRect.origin.y * CC_CONTENT_SCALE_FACTOR(),
|
||||||
pointRect.size.width * AX_CONTENT_SCALE_FACTOR(), pointRect.size.height * AX_CONTENT_SCALE_FACTOR());
|
pointRect.size.width * CC_CONTENT_SCALE_FACTOR(), pointRect.size.height * CC_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 AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#if CC_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 // ! AX_FIX_ARTIFACTS_BY_STRECHING_TEXEL
|
#endif // ! CC_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);
|
||||||
|
@ -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)-AX_DEGREES_TO_RADIANS(rotation + staticRotation);
|
float r = (float)-CC_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;
|
||||||
|
@ -811,8 +811,8 @@ bool ParticleSystemQuad::allocMemory()
|
||||||
{
|
{
|
||||||
CCASSERT(!_batchNode, "Memory should not be alloced when not using batchNode");
|
CCASSERT(!_batchNode, "Memory should not be alloced when not using batchNode");
|
||||||
|
|
||||||
AX_SAFE_FREE(_quads);
|
CC_SAFE_FREE(_quads);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_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));
|
||||||
|
@ -820,8 +820,8 @@ bool ParticleSystemQuad::allocMemory()
|
||||||
if (!_quads || !_indices)
|
if (!_quads || !_indices)
|
||||||
{
|
{
|
||||||
CCLOG("cocos2d: Particle system: not enough memory");
|
CCLOG("cocos2d: Particle system: not enough memory");
|
||||||
AX_SAFE_FREE(_quads);
|
CC_SAFE_FREE(_quads);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_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]));
|
||||||
|
|
||||||
AX_SAFE_FREE(_quads);
|
CC_SAFE_FREE(_quads);
|
||||||
AX_SAFE_FREE(_indices);
|
CC_SAFE_FREE(_indices);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -870,7 +870,7 @@ ParticleSystemQuad* ParticleSystemQuad::create()
|
||||||
particleSystemQuad->autorelease();
|
particleSystemQuad->autorelease();
|
||||||
return particleSystemQuad;
|
return particleSystemQuad;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(particleSystemQuad);
|
CC_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 AX_DLL ParticleSystemQuad : public ParticleSystem
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
CC_DISALLOW_COPY_AND_ASSIGN(ParticleSystemQuad);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of _2d group
|
// end of _2d group
|
||||||
|
|
|
@ -317,7 +317,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
|
||||||
|
|
||||||
spriteSheet->full = true;
|
spriteSheet->full = true;
|
||||||
|
|
||||||
AX_SAFE_DELETE(image);
|
CC_SAFE_DELETE(image);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
|
void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
|
||||||
|
|
|
@ -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);
|
||||||
AX_SAFE_RELEASE(pipelieDescriptor.programState);
|
CC_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
|
||||||
AX_SAFE_RELEASE(_programState2);
|
CC_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()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_sprite);
|
CC_SAFE_RELEASE(_sprite);
|
||||||
AX_SAFE_RELEASE(_programState2);
|
CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
AX_SAFE_RETAIN(sprite);
|
CC_SAFE_RETAIN(sprite);
|
||||||
AX_SAFE_RELEASE(_sprite);
|
CC_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 AX_DLL ProgressTimer : public Node
|
class CC_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:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
CC_DISALLOW_COPY_AND_ASSIGN(ProgressTimer);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of misc_nodes group
|
// end of misc_nodes group
|
||||||
|
|
|
@ -51,7 +51,7 @@ ProtectedNode* ProtectedNode::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
@ -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 != AX_INVALID_INDEX)
|
if (index != CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
// set parent nil at the end
|
// set parent nil at the end
|
||||||
child->setParent(nullptr);
|
child->setParent(nullptr);
|
||||||
}
|
}
|
||||||
|
@ -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 AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_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 // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
_reorderProtectedChildDirty = true;
|
_reorderProtectedChildDirty = true;
|
||||||
_protectedChildren.pushBack(child);
|
_protectedChildren.pushBack(child);
|
||||||
child->setLocalZOrder(z);
|
child->setLocalZOrder(z);
|
||||||
|
|
|
@ -43,7 +43,7 @@ NS_AX_BEGIN
|
||||||
*@brief A inner node type mainly used for UI module.
|
*@brief A inner node type mainly used for UI module.
|
||||||
* It is useful for composing complex node type and it's children are protected.
|
* It is useful for composing complex node type and it's children are protected.
|
||||||
*/
|
*/
|
||||||
class AX_DLL ProtectedNode : public Node
|
class CC_DLL ProtectedNode : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
|
@ -199,7 +199,7 @@ protected:
|
||||||
bool _reorderProtectedChildDirty;
|
bool _reorderProtectedChildDirty;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(ProtectedNode);
|
CC_DISALLOW_COPY_AND_ASSIGN(ProtectedNode);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of 2d group
|
// end of 2d group
|
||||||
|
|
|
@ -45,39 +45,39 @@ NS_AX_BEGIN
|
||||||
// implementation RenderTexture
|
// implementation RenderTexture
|
||||||
RenderTexture::RenderTexture()
|
RenderTexture::RenderTexture()
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
// Listen this event to save render texture before come to background.
|
// Listen this event to save render texture before come to background.
|
||||||
// Then it can be restored after coming to foreground on Android.
|
// Then it can be restored after coming to foreground on Android.
|
||||||
auto toBackgroundListener =
|
auto toBackgroundListener =
|
||||||
EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, AX_CALLBACK_1(RenderTexture::listenToBackground, this));
|
EventListenerCustom::create(EVENT_COME_TO_BACKGROUND, CC_CALLBACK_1(RenderTexture::listenToBackground, this));
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(toBackgroundListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(toBackgroundListener, this);
|
||||||
|
|
||||||
auto toForegroundListener =
|
auto toForegroundListener =
|
||||||
EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, AX_CALLBACK_1(RenderTexture::listenToForeground, this));
|
EventListenerCustom::create(EVENT_COME_TO_FOREGROUND, CC_CALLBACK_1(RenderTexture::listenToForeground, this));
|
||||||
_eventDispatcher->addEventListenerWithSceneGraphPriority(toForegroundListener, this);
|
_eventDispatcher->addEventListenerWithSceneGraphPriority(toForegroundListener, this);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
RenderTexture::~RenderTexture()
|
RenderTexture::~RenderTexture()
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_renderTarget);
|
CC_SAFE_RELEASE(_renderTarget);
|
||||||
AX_SAFE_RELEASE(_sprite);
|
CC_SAFE_RELEASE(_sprite);
|
||||||
AX_SAFE_RELEASE(_depthStencilTexture);
|
CC_SAFE_RELEASE(_depthStencilTexture);
|
||||||
AX_SAFE_RELEASE(_UITextureImage);
|
CC_SAFE_RELEASE(_UITextureImage);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RenderTexture::listenToBackground(EventCustom* /*event*/)
|
void RenderTexture::listenToBackground(EventCustom* /*event*/)
|
||||||
{
|
{
|
||||||
// We have not found a way to dispatch the enter background message before the texture data are destroyed.
|
// We have not found a way to dispatch the enter background message before the texture data are destroyed.
|
||||||
// So we disable this pair of message handler at present.
|
// So we disable this pair of message handler at present.
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
// to get the rendered texture data
|
// to get the rendered texture data
|
||||||
auto func = [&](Image* uiTextureImage) {
|
auto func = [&](Image* uiTextureImage) {
|
||||||
if (uiTextureImage)
|
if (uiTextureImage)
|
||||||
{
|
{
|
||||||
AX_SAFE_RELEASE(_UITextureImage);
|
CC_SAFE_RELEASE(_UITextureImage);
|
||||||
_UITextureImage = uiTextureImage;
|
_UITextureImage = uiTextureImage;
|
||||||
AX_SAFE_RETAIN(_UITextureImage);
|
CC_SAFE_RETAIN(_UITextureImage);
|
||||||
const Vec2& s = _texture2D->getContentSizeInPixels();
|
const Vec2& s = _texture2D->getContentSizeInPixels();
|
||||||
VolatileTextureMgr::addDataTexture(_texture2D, uiTextureImage->getData(), s.width * s.height * 4,
|
VolatileTextureMgr::addDataTexture(_texture2D, uiTextureImage->getData(), s.width * s.height * 4,
|
||||||
backend::PixelFormat::RGBA8, s);
|
backend::PixelFormat::RGBA8, s);
|
||||||
|
@ -86,7 +86,7 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
|
||||||
{
|
{
|
||||||
CCLOG("Cache rendertexture failed!");
|
CCLOG("Cache rendertexture failed!");
|
||||||
}
|
}
|
||||||
AX_SAFE_RELEASE(uiTextureImage);
|
CC_SAFE_RELEASE(uiTextureImage);
|
||||||
};
|
};
|
||||||
auto callback = std::bind(func, std::placeholders::_1);
|
auto callback = std::bind(func, std::placeholders::_1);
|
||||||
newImage(callback, false);
|
newImage(callback, false);
|
||||||
|
@ -96,7 +96,7 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
|
||||||
|
|
||||||
void RenderTexture::listenToForeground(EventCustom* /*event*/)
|
void RenderTexture::listenToForeground(EventCustom* /*event*/)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_CACHE_TEXTURE_DATA
|
#if CC_ENABLE_CACHE_TEXTURE_DATA
|
||||||
const Vec2& s = _texture2D->getContentSizeInPixels();
|
const Vec2& s = _texture2D->getContentSizeInPixels();
|
||||||
// TODO new-renderer: field _depthAndStencilFormat removal
|
// TODO new-renderer: field _depthAndStencilFormat removal
|
||||||
// if (_depthAndStencilFormat != 0)
|
// if (_depthAndStencilFormat != 0)
|
||||||
|
@ -117,7 +117,7 @@ RenderTexture* RenderTexture::create(int w, int h, backend::PixelFormat eFormat,
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -130,7 +130,7 @@ RenderTexture* RenderTexture::create(int w, int h, backend::PixelFormat eFormat,
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -143,7 +143,7 @@ RenderTexture* RenderTexture::create(int w, int h, bool sharedRenderTarget)
|
||||||
ret->autorelease();
|
ret->autorelease();
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -164,8 +164,8 @@ bool RenderTexture::initWithWidthAndHeight(int w,
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
_fullRect = _rtTextureRect = Rect(0, 0, w, h);
|
_fullRect = _rtTextureRect = Rect(0, 0, w, h);
|
||||||
w = (int)(w * AX_CONTENT_SCALE_FACTOR());
|
w = (int)(w * CC_CONTENT_SCALE_FACTOR());
|
||||||
h = (int)(h * AX_CONTENT_SCALE_FACTOR());
|
h = (int)(h * CC_CONTENT_SCALE_FACTOR());
|
||||||
_fullviewPort = Rect(0, 0, w, h);
|
_fullviewPort = Rect(0, 0, w, h);
|
||||||
|
|
||||||
// textures must be power of two squared
|
// textures must be power of two squared
|
||||||
|
@ -189,7 +189,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
|
||||||
descriptor.textureUsage = TextureUsage::RENDER_TARGET;
|
descriptor.textureUsage = TextureUsage::RENDER_TARGET;
|
||||||
descriptor.textureFormat = PixelFormat::RGBA8;
|
descriptor.textureFormat = PixelFormat::RGBA8;
|
||||||
_texture2D = new Texture2D();
|
_texture2D = new Texture2D();
|
||||||
_texture2D->updateTextureDescriptor(descriptor, !!AX_ENABLE_PREMULTIPLIED_ALPHA);
|
_texture2D->updateTextureDescriptor(descriptor, !!CC_ENABLE_PREMULTIPLIED_ALPHA);
|
||||||
_renderTargetFlags = RenderTargetFlag::COLOR;
|
_renderTargetFlags = RenderTargetFlag::COLOR;
|
||||||
|
|
||||||
if (PixelFormat::D24S8 == depthStencilFormat)
|
if (PixelFormat::D24S8 == depthStencilFormat)
|
||||||
|
@ -201,7 +201,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
|
||||||
_depthStencilTexture->updateTextureDescriptor(descriptor);
|
_depthStencilTexture->updateTextureDescriptor(descriptor);
|
||||||
}
|
}
|
||||||
|
|
||||||
AX_SAFE_RELEASE(_renderTarget);
|
CC_SAFE_RELEASE(_renderTarget);
|
||||||
|
|
||||||
if (sharedRenderTarget)
|
if (sharedRenderTarget)
|
||||||
{
|
{
|
||||||
|
@ -229,7 +229,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
|
||||||
// retained
|
// retained
|
||||||
setSprite(Sprite::createWithTexture(_texture2D));
|
setSprite(Sprite::createWithTexture(_texture2D));
|
||||||
|
|
||||||
#if defined(AX_USE_GL) || defined(AX_USE_GLES)
|
#if defined(CC_USE_GL) || defined(CC_USE_GLES)
|
||||||
_sprite->setFlippedY(true);
|
_sprite->setFlippedY(true);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -260,7 +260,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
|
||||||
|
|
||||||
void RenderTexture::setSprite(Sprite* sprite)
|
void RenderTexture::setSprite(Sprite* sprite)
|
||||||
{
|
{
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
|
@ -269,9 +269,9 @@ void RenderTexture::setSprite(Sprite* sprite)
|
||||||
if (_sprite)
|
if (_sprite)
|
||||||
sEngine->releaseScriptObject(this, _sprite);
|
sEngine->releaseScriptObject(this, _sprite);
|
||||||
}
|
}
|
||||||
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
AX_SAFE_RETAIN(sprite);
|
CC_SAFE_RETAIN(sprite);
|
||||||
AX_SAFE_RELEASE(_sprite);
|
CC_SAFE_RELEASE(_sprite);
|
||||||
_sprite = sprite;
|
_sprite = sprite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -430,7 +430,7 @@ bool RenderTexture::saveToFileAsNonPMA(std::string_view fileName,
|
||||||
auto renderer = _director->getRenderer();
|
auto renderer = _director->getRenderer();
|
||||||
auto saveToFileCommand = renderer->nextCallbackCommand();
|
auto saveToFileCommand = renderer->nextCallbackCommand();
|
||||||
saveToFileCommand->init(_globalZOrder);
|
saveToFileCommand->init(_globalZOrder);
|
||||||
saveToFileCommand->func = AX_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, true);
|
saveToFileCommand->func = CC_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, true);
|
||||||
|
|
||||||
renderer->addCommand(saveToFileCommand);
|
renderer->addCommand(saveToFileCommand);
|
||||||
return true;
|
return true;
|
||||||
|
@ -453,7 +453,7 @@ bool RenderTexture::saveToFile(std::string_view fileName,
|
||||||
auto renderer = _director->getRenderer();
|
auto renderer = _director->getRenderer();
|
||||||
auto saveToFileCommand = renderer->nextCallbackCommand();
|
auto saveToFileCommand = renderer->nextCallbackCommand();
|
||||||
saveToFileCommand->init(_globalZOrder);
|
saveToFileCommand->init(_globalZOrder);
|
||||||
saveToFileCommand->func = AX_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, false);
|
saveToFileCommand->func = CC_CALLBACK_0(RenderTexture::onSaveToFile, this, fullpath, isRGBA, false);
|
||||||
|
|
||||||
_director->getRenderer()->addCommand(saveToFileCommand);
|
_director->getRenderer()->addCommand(saveToFileCommand);
|
||||||
return true;
|
return true;
|
||||||
|
@ -619,7 +619,7 @@ void RenderTexture::begin()
|
||||||
|
|
||||||
auto beginCommand = renderer->nextCallbackCommand();
|
auto beginCommand = renderer->nextCallbackCommand();
|
||||||
beginCommand->init(_globalZOrder);
|
beginCommand->init(_globalZOrder);
|
||||||
beginCommand->func = AX_CALLBACK_0(RenderTexture::onBegin, this);
|
beginCommand->func = CC_CALLBACK_0(RenderTexture::onBegin, this);
|
||||||
renderer->addCommand(beginCommand);
|
renderer->addCommand(beginCommand);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -629,7 +629,7 @@ void RenderTexture::end()
|
||||||
|
|
||||||
auto endCommand = renderer->nextCallbackCommand();
|
auto endCommand = renderer->nextCallbackCommand();
|
||||||
endCommand->init(_globalZOrder);
|
endCommand->init(_globalZOrder);
|
||||||
endCommand->func = AX_CALLBACK_0(RenderTexture::onEnd, this);
|
endCommand->func = CC_CALLBACK_0(RenderTexture::onEnd, this);
|
||||||
|
|
||||||
renderer->addCommand(endCommand);
|
renderer->addCommand(endCommand);
|
||||||
renderer->popGroup();
|
renderer->popGroup();
|
||||||
|
|
|
@ -58,7 +58,7 @@ class EventCustom;
|
||||||
* There are also functions for saving the render texture to disk in PNG or JPG format.
|
* There are also functions for saving the render texture to disk in PNG or JPG format.
|
||||||
* @since v0.8.1
|
* @since v0.8.1
|
||||||
*/
|
*/
|
||||||
class AX_DLL RenderTexture : public Node
|
class CC_DLL RenderTexture : public Node
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
using SaveFileCallbackType = std::function<void(RenderTexture*, std::string_view)>;
|
using SaveFileCallbackType = std::function<void(RenderTexture*, std::string_view)>;
|
||||||
|
@ -430,7 +430,7 @@ protected:
|
||||||
Mat4 _transformMatrix, _projectionMatrix;
|
Mat4 _transformMatrix, _projectionMatrix;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
AX_DISALLOW_COPY_AND_ASSIGN(RenderTexture);
|
CC_DISALLOW_COPY_AND_ASSIGN(RenderTexture);
|
||||||
};
|
};
|
||||||
|
|
||||||
// end of textures group
|
// end of textures group
|
||||||
|
|
|
@ -34,16 +34,16 @@ THE SOFTWARE.
|
||||||
#include "base/ccUTF8.h"
|
#include "base/ccUTF8.h"
|
||||||
#include "renderer/CCRenderer.h"
|
#include "renderer/CCRenderer.h"
|
||||||
|
|
||||||
#if AX_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
# include "physics/CCPhysicsWorld.h"
|
# include "physics/CCPhysicsWorld.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
# include "physics3d/CCPhysics3DWorld.h"
|
# include "physics3d/CCPhysics3DWorld.h"
|
||||||
# include "physics3d/CCPhysics3DComponent.h"
|
# include "physics3d/CCPhysics3DComponent.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AX_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
# include "navmesh/CCNavMesh.h"
|
# include "navmesh/CCNavMesh.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -64,36 +64,36 @@ Scene::Scene()
|
||||||
|
|
||||||
Scene::~Scene()
|
Scene::~Scene()
|
||||||
{
|
{
|
||||||
#if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
AX_SAFE_RELEASE(_physics3DWorld);
|
CC_SAFE_RELEASE(_physics3DWorld);
|
||||||
AX_SAFE_RELEASE(_physics3dDebugCamera);
|
CC_SAFE_RELEASE(_physics3dDebugCamera);
|
||||||
#endif
|
#endif
|
||||||
#if AX_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
AX_SAFE_RELEASE(_navMesh);
|
CC_SAFE_RELEASE(_navMesh);
|
||||||
#endif
|
#endif
|
||||||
_director->getEventDispatcher()->removeEventListener(_event);
|
_director->getEventDispatcher()->removeEventListener(_event);
|
||||||
AX_SAFE_RELEASE(_event);
|
CC_SAFE_RELEASE(_event);
|
||||||
|
|
||||||
#if AX_USE_PHYSICS
|
#if CC_USE_PHYSICS
|
||||||
delete _physicsWorld;
|
delete _physicsWorld;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#if CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
|
||||||
if (sEngine)
|
if (sEngine)
|
||||||
{
|
{
|
||||||
sEngine->releaseAllChildrenRecursive(this);
|
sEngine->releaseAllChildrenRecursive(this);
|
||||||
}
|
}
|
||||||
#endif // AX_ENABLE_GC_FOR_NATIVE_OBJECTS
|
#endif // CC_ENABLE_GC_FOR_NATIVE_OBJECTS
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AX_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
void Scene::setNavMesh(NavMesh* navMesh)
|
void Scene::setNavMesh(NavMesh* navMesh)
|
||||||
{
|
{
|
||||||
if (_navMesh != navMesh)
|
if (_navMesh != navMesh)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(navMesh);
|
CC_SAFE_RETAIN(navMesh);
|
||||||
AX_SAFE_RELEASE(_navMesh);
|
CC_SAFE_RELEASE(_navMesh);
|
||||||
_navMesh = navMesh;
|
_navMesh = navMesh;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -131,7 +131,7 @@ Scene* Scene::create()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -146,7 +146,7 @@ Scene* Scene::createWithSize(const Vec2& size)
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -215,7 +215,7 @@ void Scene::render(Renderer* renderer, const Mat4& eyeTransform, const Mat4* eye
|
||||||
camera->clearBackground();
|
camera->clearBackground();
|
||||||
// visit the scene
|
// visit the scene
|
||||||
visit(renderer, transform, 0);
|
visit(renderer, transform, 0);
|
||||||
#if AX_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
if (_navMesh && _navMeshDebugCamera == camera)
|
if (_navMesh && _navMeshDebugCamera == camera)
|
||||||
{
|
{
|
||||||
_navMesh->debugDraw(renderer);
|
_navMesh->debugDraw(renderer);
|
||||||
|
@ -231,7 +231,7 @@ void Scene::render(Renderer* renderer, const Mat4& eyeTransform, const Mat4* eye
|
||||||
// camera->setNodeToParentTransform(eyeCopy);
|
// camera->setNodeToParentTransform(eyeCopy);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
if (_physics3DWorld && _physics3DWorld->isDebugDrawEnabled())
|
if (_physics3DWorld && _physics3DWorld->isDebugDrawEnabled())
|
||||||
{
|
{
|
||||||
Camera* physics3dDebugCamera = _physics3dDebugCamera != nullptr ? _physics3dDebugCamera : defaultCamera;
|
Camera* physics3dDebugCamera = _physics3dDebugCamera != nullptr ? _physics3dDebugCamera : defaultCamera;
|
||||||
|
@ -272,26 +272,26 @@ void Scene::removeAllChildren()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
#if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
void Scene::setPhysics3DDebugCamera(Camera* camera)
|
void Scene::setPhysics3DDebugCamera(Camera* camera)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(camera);
|
CC_SAFE_RETAIN(camera);
|
||||||
AX_SAFE_RELEASE(_physics3dDebugCamera);
|
CC_SAFE_RELEASE(_physics3dDebugCamera);
|
||||||
_physics3dDebugCamera = camera;
|
_physics3dDebugCamera = camera;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if AX_USE_NAVMESH
|
#if CC_USE_NAVMESH
|
||||||
void Scene::setNavMeshDebugCamera(Camera* camera)
|
void Scene::setNavMeshDebugCamera(Camera* camera)
|
||||||
{
|
{
|
||||||
AX_SAFE_RETAIN(camera);
|
CC_SAFE_RETAIN(camera);
|
||||||
AX_SAFE_RELEASE(_navMeshDebugCamera);
|
CC_SAFE_RELEASE(_navMeshDebugCamera);
|
||||||
_navMeshDebugCamera = camera;
|
_navMeshDebugCamera = camera;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (AX_USE_PHYSICS || (AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION))
|
#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION))
|
||||||
|
|
||||||
Scene* Scene::createWithPhysics()
|
Scene* Scene::createWithPhysics()
|
||||||
{
|
{
|
||||||
|
@ -303,7 +303,7 @@ Scene* Scene::createWithPhysics()
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
AX_SAFE_DELETE(ret);
|
CC_SAFE_DELETE(ret);
|
||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,7 @@ bool Scene::initWithPhysics()
|
||||||
|
|
||||||
bool Scene::initPhysicsWorld()
|
bool Scene::initPhysicsWorld()
|
||||||
{
|
{
|
||||||
# if AX_USE_PHYSICS
|
# if CC_USE_PHYSICS
|
||||||
_physicsWorld = PhysicsWorld::construct(this);
|
_physicsWorld = PhysicsWorld::construct(this);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -325,9 +325,9 @@ bool Scene::initPhysicsWorld()
|
||||||
{
|
{
|
||||||
this->setContentSize(_director->getWinSize());
|
this->setContentSize(_director->getWinSize());
|
||||||
|
|
||||||
# if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
# if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
Physics3DWorldDes info;
|
Physics3DWorldDes info;
|
||||||
AX_BREAK_IF(!(_physics3DWorld = Physics3DWorld::create(&info)));
|
CC_BREAK_IF(!(_physics3DWorld = Physics3DWorld::create(&info)));
|
||||||
_physics3DWorld->retain();
|
_physics3DWorld->retain();
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
|
@ -339,21 +339,21 @@ bool Scene::initPhysicsWorld()
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if (AX_USE_PHYSICS || (AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION) || AX_USE_NAVMESH)
|
#if (CC_USE_PHYSICS || (CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION) || CC_USE_NAVMESH)
|
||||||
void Scene::stepPhysicsAndNavigation(float deltaTime)
|
void Scene::stepPhysicsAndNavigation(float deltaTime)
|
||||||
{
|
{
|
||||||
# if AX_USE_PHYSICS
|
# if CC_USE_PHYSICS
|
||||||
if (_physicsWorld && _physicsWorld->isAutoStep())
|
if (_physicsWorld && _physicsWorld->isAutoStep())
|
||||||
_physicsWorld->update(deltaTime);
|
_physicsWorld->update(deltaTime);
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if AX_USE_3D_PHYSICS && AX_ENABLE_BULLET_INTEGRATION
|
# if CC_USE_3D_PHYSICS && CC_ENABLE_BULLET_INTEGRATION
|
||||||
if (_physics3DWorld)
|
if (_physics3DWorld)
|
||||||
{
|
{
|
||||||
_physics3DWorld->stepSimulate(deltaTime);
|
_physics3DWorld->stepSimulate(deltaTime);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
# if AX_USE_NAVMESH
|
# if CC_USE_NAVMESH
|
||||||
if (_navMesh)
|
if (_navMesh)
|
||||||
{
|
{
|
||||||
_navMesh->update(deltaTime);
|
_navMesh->update(deltaTime);
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue