Migrate more macors

This commit is contained in:
halx99 2022-07-16 10:43:05 +08:00
parent f3ac6ea871
commit c0a4371879
335 changed files with 2169 additions and 2169 deletions

View File

@ -16,7 +16,7 @@
- **Outdated/Abandom/Cocos2d-x**: - **Outdated/Abandom/Cocos2d-x**:
- class PhysicsSprite: Be only part of the axis for backwards compatibility with Cocos2d-x. - class PhysicsSprite: Be only part of the axis for backwards compatibility with Cocos2d-x.
Use CC_ENABLE_BOX2D_INTEGRATION 1 (using Box2D) or CC_ENABLE_CHIPMUNK_INTEGRATION 1 (using Chipmunk2D) Use AX_ENABLE_BOX2D_INTEGRATION 1 (using Box2D) or AX_ENABLE_CHIPMUNK_INTEGRATION 1 (using Chipmunk2D)
## Chipmunk2D-/Box2D - Testbeds: ## Chipmunk2D-/Box2D - Testbeds:
The goals where: The goals where:

View File

@ -41,7 +41,7 @@ Action::Action() : _originalTarget(nullptr), _target(nullptr), _tag(Action::INVA
Action::~Action() Action::~Action()
{ {
CCLOGINFO("deallocing Action: %p - tag: %i", this, _tag); AXLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
} }
std::string Action::description() const std::string Action::description() const
@ -66,12 +66,12 @@ bool Action::isDone() const
void Action::step(float /*dt*/) void Action::step(float /*dt*/)
{ {
CCLOG("[Action step]. override me"); AXLOG("[Action step]. override me");
} }
void Action::update(float /*time*/) void Action::update(float /*time*/)
{ {
CCLOG("[Action update]. override me"); AXLOG("[Action update]. override me");
} }
// //
@ -98,7 +98,7 @@ Speed* Speed::create(ActionInterval* action, float speed)
bool Speed::initWithAction(ActionInterval* action, float speed) bool Speed::initWithAction(ActionInterval* action, float speed)
{ {
CCASSERT(action != nullptr, "action must not be NULL"); AXASSERT(action != nullptr, "action must not be NULL");
if (action == nullptr) if (action == nullptr)
{ {
log("Speed::initWithAction error: action is nullptr!"); log("Speed::initWithAction error: action is nullptr!");
@ -209,7 +209,7 @@ Follow* Follow::reverse() const
bool Follow::initWithTargetAndOffset(Node* followedNode, float xOffset, float yOffset, const Rect& rect) bool Follow::initWithTargetAndOffset(Node* followedNode, float xOffset, float yOffset, const Rect& rect)
{ {
CCASSERT(followedNode != nullptr, "FollowedNode can't be NULL"); AXASSERT(followedNode != nullptr, "FollowedNode can't be NULL");
if (followedNode == nullptr) if (followedNode == nullptr)
{ {
log("Follow::initWithTarget error: followedNode is nullptr!"); log("Follow::initWithTarget error: followedNode is nullptr!");

View File

@ -79,7 +79,7 @@ PointArray* PointArray::clone() const
PointArray::~PointArray() PointArray::~PointArray()
{ {
CCLOGINFO("deallocing PointArray: %p", this); AXLOGINFO("deallocing PointArray: %p", this);
} }
PointArray::PointArray() {} PointArray::PointArray() {}
@ -205,7 +205,7 @@ CardinalSplineTo* CardinalSplineTo::create(float duration, PointArray* points, f
bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, float tension) bool CardinalSplineTo::initWithDuration(float duration, PointArray* points, float tension)
{ {
CCASSERT(points->count() > 0, "Invalid configuration. It must at least have one control point"); AXASSERT(points->count() > 0, "Invalid configuration. It must at least have one control point");
if (ActionInterval::initWithDuration(duration)) if (ActionInterval::initWithDuration(duration))
{ {

View File

@ -47,7 +47,7 @@ NS_AX_BEGIN
bool ActionEase::initWithAction(ActionInterval* action) bool ActionEase::initWithAction(ActionInterval* action)
{ {
CCASSERT(action != nullptr, "action couldn't be nullptr!"); AXASSERT(action != nullptr, "action couldn't be nullptr!");
if (action == nullptr) if (action == nullptr)
{ {
return false; return false;
@ -106,7 +106,7 @@ ActionInterval* ActionEase::getInnerAction()
EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate) EaseRateAction* EaseRateAction::create(ActionInterval* action, float rate)
{ {
CCASSERT(action != nullptr, "action cannot be nullptr!"); AXASSERT(action != nullptr, "action cannot be nullptr!");
EaseRateAction* easeRateAction = new EaseRateAction(); EaseRateAction* easeRateAction = new EaseRateAction();
if (easeRateAction->initWithAction(action, rate)) if (easeRateAction->initWithAction(action, rate))

View File

@ -62,7 +62,7 @@ void GridAction::startWithTarget(Node* target)
} }
else else
{ {
CCASSERT(0, "Invalid grid parameters!"); AXASSERT(0, "Invalid grid parameters!");
} }
} }
else else
@ -81,7 +81,7 @@ void GridAction::startWithTarget(Node* target)
void GridAction::cacheTargetAsGridNode() void GridAction::cacheTargetAsGridNode()
{ {
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target); _gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
} }
GridAction* GridAction::reverse() const GridAction* GridAction::reverse() const
@ -93,7 +93,7 @@ GridAction* GridAction::reverse() const
GridBase* GridAction::getGrid() GridBase* GridAction::getGrid()
{ {
// Abstract class needs implementation // Abstract class needs implementation
CCASSERT(0, "Subclass should implement this method!"); AXASSERT(0, "Subclass should implement this method!");
return nullptr; return nullptr;
} }
@ -375,7 +375,7 @@ void StopGrid::startWithTarget(Node* target)
void StopGrid::cacheTargetAsGridNode() void StopGrid::cacheTargetAsGridNode()
{ {
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target); _gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
} }
StopGrid* StopGrid::create() StopGrid* StopGrid::create()
@ -432,7 +432,7 @@ void ReuseGrid::startWithTarget(Node* target)
void ReuseGrid::cacheTargetAsGridNode() void ReuseGrid::cacheTargetAsGridNode()
{ {
_gridNodeTarget = dynamic_cast<NodeGrid*>(_target); _gridNodeTarget = dynamic_cast<NodeGrid*>(_target);
CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid");
} }
ReuseGrid* ReuseGrid::clone() const ReuseGrid* ReuseGrid::clone() const

View File

@ -74,7 +74,7 @@ void Waves3D::update(float time)
Vec2 pos((float)i, (float)j); Vec2 pos((float)i, (float)j);
Vec3 v = getOriginalVertex(pos); Vec3 v = getOriginalVertex(pos);
v.z += (sinf((float)M_PI * time * _waves * 2 + (v.y + v.x) * 0.01f) * _amplitude * _amplitudeRate); v.z += (sinf((float)M_PI * time * _waves * 2 + (v.y + v.x) * 0.01f) * _amplitude * _amplitudeRate);
// CCLOG("v.z offset is %f\n", (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * .01f) * _amplitude * // AXLOG("v.z offset is %f\n", (sinf((float)M_PI * time * _waves * 2 + (v.y+v.x) * .01f) * _amplitude *
// _amplitudeRate)); // _amplitudeRate));
setVertex(pos, v); setVertex(pos, v);
} }
@ -107,7 +107,7 @@ bool FlipX3D::initWithSize(const Vec2& gridSize, float duration)
if (gridSize.width != 1 || gridSize.height != 1) if (gridSize.width != 1 || gridSize.height != 1)
{ {
// Grid size must be (1,1) // Grid size must be (1,1)
CCASSERT(0, "Grid size must be (1,1)"); AXASSERT(0, "Grid size must be (1,1)");
return false; return false;
} }

View File

@ -126,13 +126,13 @@ void ActionInterval::step(float dt)
void ActionInterval::setAmplitudeRate(float /*amp*/) void ActionInterval::setAmplitudeRate(float /*amp*/)
{ {
// Abstract class needs implementation // Abstract class needs implementation
CCASSERT(0, "Subclass should implement this method!"); AXASSERT(0, "Subclass should implement this method!");
} }
float ActionInterval::getAmplitudeRate() float ActionInterval::getAmplitudeRate()
{ {
// Abstract class needs implementation // Abstract class needs implementation
CCASSERT(0, "Subclass should implement this method!"); AXASSERT(0, "Subclass should implement this method!");
return 0; return 0;
} }
@ -237,8 +237,8 @@ bool Sequence::init(const Vector<FiniteTimeAction*>& arrayOfActions)
bool Sequence::initWithTwoActions(FiniteTimeAction* actionOne, FiniteTimeAction* actionTwo) bool Sequence::initWithTwoActions(FiniteTimeAction* actionOne, FiniteTimeAction* actionTwo)
{ {
CCASSERT(actionOne != nullptr, "actionOne can't be nullptr!"); AXASSERT(actionOne != nullptr, "actionOne can't be nullptr!");
CCASSERT(actionTwo != nullptr, "actionTwo can't be nullptr!"); AXASSERT(actionTwo != nullptr, "actionTwo can't be nullptr!");
if (actionOne == nullptr || actionTwo == nullptr) if (actionOne == nullptr || actionTwo == nullptr)
{ {
log("Sequence::initWithTwoActions error: action is nullptr!!"); log("Sequence::initWithTwoActions error: action is nullptr!!");
@ -549,7 +549,7 @@ RepeatForever* RepeatForever::create(ActionInterval* action)
bool RepeatForever::initWithAction(ActionInterval* action) bool RepeatForever::initWithAction(ActionInterval* action)
{ {
CCASSERT(action != nullptr, "action can't be nullptr!"); AXASSERT(action != nullptr, "action can't be nullptr!");
if (action == nullptr) if (action == nullptr)
{ {
log("RepeatForever::initWithAction error:action is nullptr!"); log("RepeatForever::initWithAction error:action is nullptr!");
@ -693,8 +693,8 @@ bool Spawn::init(const Vector<FiniteTimeAction*>& arrayOfActions)
bool Spawn::initWithTwoActions(FiniteTimeAction* action1, FiniteTimeAction* action2) bool Spawn::initWithTwoActions(FiniteTimeAction* action1, FiniteTimeAction* action2)
{ {
CCASSERT(action1 != nullptr, "action1 can't be nullptr!"); AXASSERT(action1 != nullptr, "action1 can't be nullptr!");
CCASSERT(action2 != nullptr, "action2 can't be nullptr!"); AXASSERT(action2 != nullptr, "action2 can't be nullptr!");
if (action1 == nullptr || action2 == nullptr) if (action1 == nullptr || action2 == nullptr)
{ {
log("Spawn::initWithTwoActions error: action is nullptr!"); log("Spawn::initWithTwoActions error: action is nullptr!");
@ -952,7 +952,7 @@ void RotateTo::update(float time)
RotateTo* RotateTo::reverse() const RotateTo* RotateTo::reverse() const
{ {
CCASSERT(false, "RotateTo doesn't support the 'reverse' method"); AXASSERT(false, "RotateTo doesn't support the 'reverse' method");
return nullptr; return nullptr;
} }
@ -1242,7 +1242,7 @@ void MoveTo::startWithTarget(Node* target)
MoveTo* MoveTo::reverse() const MoveTo* MoveTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in MoveTo"); AXASSERT(false, "reverse() not supported in MoveTo");
return nullptr; return nullptr;
} }
@ -1285,7 +1285,7 @@ SkewTo* SkewTo::clone() const
SkewTo* SkewTo::reverse() const SkewTo* SkewTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in SkewTo"); AXASSERT(false, "reverse() not supported in SkewTo");
return nullptr; return nullptr;
} }
@ -1542,7 +1542,7 @@ JumpBy* JumpBy::create(float duration, const Vec2& position, float height, int j
bool JumpBy::initWithDuration(float duration, const Vec2& position, float height, int jumps) bool JumpBy::initWithDuration(float duration, const Vec2& position, float height, int jumps)
{ {
CCASSERT(jumps >= 0, "Number of jumps must be >= 0"); AXASSERT(jumps >= 0, "Number of jumps must be >= 0");
if (jumps < 0) if (jumps < 0)
{ {
log("JumpBy::initWithDuration error: Number of jumps must be >= 0"); log("JumpBy::initWithDuration error: Number of jumps must be >= 0");
@ -1623,7 +1623,7 @@ JumpTo* JumpTo::create(float duration, const Vec2& position, float height, int j
bool JumpTo::initWithDuration(float duration, const Vec2& position, float height, int jumps) bool JumpTo::initWithDuration(float duration, const Vec2& position, float height, int jumps)
{ {
CCASSERT(jumps >= 0, "Number of jumps must be >= 0"); AXASSERT(jumps >= 0, "Number of jumps must be >= 0");
if (jumps < 0) if (jumps < 0)
{ {
log("JumpTo::initWithDuration error:Number of jumps must be >= 0"); log("JumpTo::initWithDuration error:Number of jumps must be >= 0");
@ -1650,7 +1650,7 @@ JumpTo* JumpTo::clone() const
JumpTo* JumpTo::reverse() const JumpTo* JumpTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in JumpTo"); AXASSERT(false, "reverse() not supported in JumpTo");
return nullptr; return nullptr;
} }
@ -1797,7 +1797,7 @@ void BezierTo::startWithTarget(Node* target)
BezierTo* BezierTo::reverse() const BezierTo* BezierTo::reverse() const
{ {
CCASSERT(false, "CCBezierTo doesn't support the 'reverse' method"); AXASSERT(false, "CCBezierTo doesn't support the 'reverse' method");
return nullptr; return nullptr;
} }
@ -1893,7 +1893,7 @@ ScaleTo* ScaleTo::clone() const
ScaleTo* ScaleTo::reverse() const ScaleTo* ScaleTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in ScaleTo"); AXASSERT(false, "reverse() not supported in ScaleTo");
return nullptr; return nullptr;
} }
@ -1999,7 +1999,7 @@ Blink* Blink::create(float duration, int blinks)
bool Blink::initWithDuration(float duration, int blinks) bool Blink::initWithDuration(float duration, int blinks)
{ {
CCASSERT(blinks >= 0, "blinks should be >= 0"); AXASSERT(blinks >= 0, "blinks should be >= 0");
if (blinks < 0) if (blinks < 0)
{ {
log("Blink::initWithDuration error:blinks should be >= 0"); log("Blink::initWithDuration error:blinks should be >= 0");
@ -2181,7 +2181,7 @@ FadeTo* FadeTo::clone() const
FadeTo* FadeTo::reverse() const FadeTo* FadeTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in FadeTo"); AXASSERT(false, "reverse() not supported in FadeTo");
return nullptr; return nullptr;
} }
@ -2243,7 +2243,7 @@ TintTo* TintTo::clone() const
TintTo* TintTo::reverse() const TintTo* TintTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in TintTo"); AXASSERT(false, "reverse() not supported in TintTo");
return nullptr; return nullptr;
} }
@ -2382,8 +2382,8 @@ ReverseTime* ReverseTime::create(FiniteTimeAction* action)
bool ReverseTime::initWithAction(FiniteTimeAction* action) bool ReverseTime::initWithAction(FiniteTimeAction* action)
{ {
CCASSERT(action != nullptr, "action can't be nullptr!"); AXASSERT(action != nullptr, "action can't be nullptr!");
CCASSERT(action != _other, "action doesn't equal to _other!"); AXASSERT(action != _other, "action doesn't equal to _other!");
if (action == nullptr || action == _other) if (action == nullptr || action == _other)
{ {
log("ReverseTime::initWithAction error: action is null or action equal to _other"); log("ReverseTime::initWithAction error: action is null or action equal to _other");
@ -2472,7 +2472,7 @@ Animate::~Animate()
bool Animate::initWithAnimation(Animation* animation) bool Animate::initWithAnimation(Animation* animation)
{ {
CCASSERT(animation != nullptr, "Animate: argument Animation must be non-nullptr"); AXASSERT(animation != nullptr, "Animate: argument Animation must be non-nullptr");
if (animation == nullptr) if (animation == nullptr)
{ {
log("Animate::initWithAnimation: argument Animation must be non-nullptr"); log("Animate::initWithAnimation: argument Animation must be non-nullptr");

View File

@ -54,7 +54,7 @@ ActionManager::ActionManager() : _targets(nullptr), _currentTarget(nullptr), _cu
ActionManager::~ActionManager() ActionManager::~ActionManager()
{ {
CCLOGINFO("deallocing ActionManager: %p", this); AXLOGINFO("deallocing ActionManager: %p", this);
removeAllActions(); removeAllActions();
} }
@ -163,8 +163,8 @@ void ActionManager::resumeTargets(const Vector<Node*>& targetsToResume)
void ActionManager::addAction(Action* action, Node* target, bool paused) void ActionManager::addAction(Action* action, Node* target, bool paused)
{ {
CCASSERT(action != nullptr, "action can't be nullptr!"); AXASSERT(action != nullptr, "action can't be nullptr!");
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
if (action == nullptr || target == nullptr) if (action == nullptr || target == nullptr)
return; return;
@ -183,7 +183,7 @@ void ActionManager::addAction(Action* action, Node* target, bool paused)
actionAllocWithHashElement(element); actionAllocWithHashElement(element);
CCASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!"); AXASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!");
ccArrayAppendObject(element->actions, action); ccArrayAppendObject(element->actions, action);
action->startWithTarget(target); action->startWithTarget(target);
@ -254,8 +254,8 @@ void ActionManager::removeAction(Action* action)
void ActionManager::removeActionByTag(int tag, Node* target) void ActionManager::removeActionByTag(int tag, Node* target)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr) if (target == nullptr)
{ {
return; return;
@ -282,8 +282,8 @@ void ActionManager::removeActionByTag(int tag, Node* target)
void ActionManager::removeAllActionsByTag(int tag, Node* target) void ActionManager::removeAllActionsByTag(int tag, Node* target)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr) if (target == nullptr)
{ {
return; return;
@ -318,7 +318,7 @@ void ActionManager::removeActionsByFlags(unsigned int flags, Node* target)
{ {
return; return;
} }
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr) if (target == nullptr)
{ {
return; return;
@ -353,7 +353,7 @@ void ActionManager::removeActionsByFlags(unsigned int flags, Node* target)
// and, it is not possible to get the address of a reference // and, it is not possible to get the address of a reference
Action* ActionManager::getActionByTag(int tag, const Node* target) const Action* ActionManager::getActionByTag(int tag, const Node* target) const
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
tHashElement* element = nullptr; tHashElement* element = nullptr;
HASH_FIND_PTR(_targets, &target, element); HASH_FIND_PTR(_targets, &target, element);
@ -396,7 +396,7 @@ ssize_t ActionManager::getNumberOfRunningActionsInTarget(const Node* target) con
// and, it is not possible to get the address of a reference // and, it is not possible to get the address of a reference
size_t ActionManager::getNumberOfRunningActionsInTargetByTag(const Node* target, int tag) size_t ActionManager::getNumberOfRunningActionsInTargetByTag(const Node* target, int tag)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
tHashElement* element = nullptr; tHashElement* element = nullptr;
HASH_FIND_PTR(_targets, &target, element); HASH_FIND_PTR(_targets, &target, element);

View File

@ -66,7 +66,7 @@ ProgressTo* ProgressTo::clone() const
ProgressTo* ProgressTo::reverse() const ProgressTo* ProgressTo::reverse() const
{ {
CCASSERT(false, "reverse() not supported in ProgressTo"); AXASSERT(false, "reverse() not supported in ProgressTo");
return nullptr; return nullptr;
} }

View File

@ -62,7 +62,7 @@ ActionTween* ActionTween::clone() const
void ActionTween::startWithTarget(Node* target) void ActionTween::startWithTarget(Node* target)
{ {
CCASSERT(dynamic_cast<ActionTweenDelegate*>(target), "target must implement ActionTweenDelegate"); AXASSERT(dynamic_cast<ActionTweenDelegate*>(target), "target must implement ActionTweenDelegate");
ActionInterval::startWithTarget(target); ActionInterval::startWithTarget(target);
_delta = _to - _from; _delta = _to - _from;
} }

View File

@ -59,7 +59,7 @@ bool AnimationFrame::initWithSpriteFrame(SpriteFrame* spriteFrame, float delayUn
AnimationFrame::~AnimationFrame() AnimationFrame::~AnimationFrame()
{ {
CCLOGINFO("deallocing AnimationFrame: %p", this); AXLOGINFO("deallocing AnimationFrame: %p", this);
AX_SAFE_RELEASE(_spriteFrame); AX_SAFE_RELEASE(_spriteFrame);
} }
@ -153,7 +153,7 @@ Animation::Animation()
Animation::~Animation() Animation::~Animation()
{ {
CCLOGINFO("deallocing Animation: %p", this); AXLOGINFO("deallocing Animation: %p", this);
} }
void Animation::addSpriteFrame(SpriteFrame* spriteFrame) void Animation::addSpriteFrame(SpriteFrame* spriteFrame)

View File

@ -60,7 +60,7 @@ AnimationCache::AnimationCache() {}
AnimationCache::~AnimationCache() AnimationCache::~AnimationCache()
{ {
CCLOGINFO("deallocing AnimationCache: %p", this); AXLOGINFO("deallocing AnimationCache: %p", this);
} }
void AnimationCache::addAnimation(Animation* animation, std::string_view name) void AnimationCache::addAnimation(Animation* animation, std::string_view name)
@ -94,7 +94,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (frameNames.empty()) if (frameNames.empty())
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to " "cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
"animation cache.", "animation cache.",
anim.first.c_str()); anim.first.c_str());
@ -110,7 +110,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (!spriteFrame) if (!spriteFrame)
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the " "cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
"SpriteFrameCache. This frame will not be added to the animation.", "SpriteFrameCache. This frame will not be added to the animation.",
anim.first.c_str(), frameName.asString().c_str()); anim.first.c_str(), frameName.asString().c_str());
@ -124,7 +124,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (frames.empty()) if (frames.empty())
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: None of the frames for animation '%s' were found in the SpriteFrameCache. " "cocos2d: AnimationCache: None of the frames for animation '%s' were found in the SpriteFrameCache. "
"Animation is not being added to the Animation Cache.", "Animation is not being added to the Animation Cache.",
anim.first.c_str()); anim.first.c_str());
@ -132,7 +132,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
} }
else if (frames.size() != frameNameSize) else if (frames.size() != frameNameSize)
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: An animation in your dictionary refers to a frame which is not in the " "cocos2d: AnimationCache: An animation in your dictionary refers to a frame which is not in the "
"SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.", "SpriteFrameCache. Some or all of the frames for the animation '%s' may be missing.",
anim.first.c_str()); anim.first.c_str());
@ -160,7 +160,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
if (frameArray.empty()) if (frameArray.empty())
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to " "cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
"animation cache.", "animation cache.",
name.c_str()); name.c_str());
@ -178,7 +178,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
if (!spriteFrame) if (!spriteFrame)
{ {
CCLOG( AXLOG(
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the " "cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
"SpriteFrameCache. This frame will not be added to the animation.", "SpriteFrameCache. This frame will not be added to the animation.",
name.c_str(), spriteFrameName.c_str()); name.c_str(), spriteFrameName.c_str());
@ -210,7 +210,7 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
auto anisItr = dictionary.find("animations"); auto anisItr = dictionary.find("animations");
if (anisItr == dictionary.end()) if (anisItr == dictionary.end())
{ {
CCLOG("cocos2d: AnimationCache: No animations were found in provided dictionary."); AXLOG("cocos2d: AnimationCache: No animations were found in provided dictionary.");
return; return;
} }
@ -240,14 +240,14 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
parseVersion2(animations.asValueMap()); parseVersion2(animations.asValueMap());
break; break;
default: default:
CCASSERT(false, "Invalid animation format"); AXASSERT(false, "Invalid animation format");
} }
} }
/** Read an NSDictionary from a plist file and parse it automatically for animations */ /** Read an NSDictionary from a plist file and parse it automatically for animations */
void AnimationCache::addAnimationsWithFile(std::string_view plist) void AnimationCache::addAnimationsWithFile(std::string_view plist)
{ {
CCASSERT(!plist.empty(), "Invalid texture file name"); AXASSERT(!plist.empty(), "Invalid texture file name");
if (plist.empty()) if (plist.empty())
{ {
log("%s error:file name is empty!", __FUNCTION__); log("%s error:file name is empty!", __FUNCTION__);
@ -256,7 +256,7 @@ void AnimationCache::addAnimationsWithFile(std::string_view plist)
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(plist); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(plist);
CCASSERT(!dict.empty(), "CCAnimationCache: File could not be found"); AXASSERT(!dict.empty(), "CCAnimationCache: File could not be found");
if (dict.empty()) if (dict.empty())
{ {
log("AnimationCache::addAnimationsWithFile error:%s not exist!", plist.data()); log("AnimationCache::addAnimationsWithFile error:%s not exist!", plist.data());

View File

@ -61,7 +61,7 @@ AtlasNode* AtlasNode::create(std::string_view tile, int tileWidth, int tileHeigh
bool AtlasNode::initWithTileFile(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender) bool AtlasNode::initWithTileFile(std::string_view tile, int tileWidth, int tileHeight, int itemsToRender)
{ {
CCASSERT(!tile.empty(), "file size should not be empty"); AXASSERT(!tile.empty(), "file size should not be empty");
Texture2D* texture = _director->getTextureCache()->addImage(tile); Texture2D* texture = _director->getTextureCache()->addImage(tile);
return initWithTexture(texture, tileWidth, tileHeight, itemsToRender); return initWithTexture(texture, tileWidth, tileHeight, itemsToRender);
} }
@ -141,7 +141,7 @@ void AtlasNode::calculateMaxItems()
void AtlasNode::updateAtlasValues() void AtlasNode::updateAtlasValues()
{ {
CCASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden"); AXASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
} }
// AtlasNode - draw // AtlasNode - draw

View File

@ -62,7 +62,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles(), _isVertsOwner(
_rect = other._rect; _rect = other._rect;
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount]; triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
triangles.indices = new unsigned short[other.triangles.indexCount]; triangles.indices = new unsigned short[other.triangles.indexCount];
CCASSERT(triangles.verts && triangles.indices, "not enough memory"); AXASSERT(triangles.verts && triangles.indices, "not enough memory");
triangles.vertCount = other.triangles.vertCount; triangles.vertCount = other.triangles.vertCount;
triangles.indexCount = other.triangles.indexCount; triangles.indexCount = other.triangles.indexCount;
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0])); memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
@ -79,7 +79,7 @@ PolygonInfo& PolygonInfo::operator=(const PolygonInfo& other)
_rect = other._rect; _rect = other._rect;
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount]; triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
triangles.indices = new unsigned short[other.triangles.indexCount]; triangles.indices = new unsigned short[other.triangles.indexCount];
CCASSERT(triangles.verts && triangles.indices, "not enough memory"); AXASSERT(triangles.verts && triangles.indices, "not enough memory");
triangles.vertCount = other.triangles.vertCount; triangles.vertCount = other.triangles.vertCount;
triangles.indexCount = other.triangles.indexCount; triangles.indexCount = other.triangles.indexCount;
memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0])); memcpy(triangles.verts, other.triangles.verts, other.triangles.vertCount * sizeof(other.triangles.verts[0]));
@ -106,7 +106,7 @@ void PolygonInfo::setQuad(V3F_C4B_T2F_Quad* quad)
void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads) void PolygonInfo::setQuads(V3F_C4B_T2F_Quad* quad, int numberOfQuads)
{ {
CCASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads"); AXASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
releaseVertsAndIndices(); releaseVertsAndIndices();
_isVertsOwner = false; _isVertsOwner = false;
@ -174,7 +174,7 @@ AutoPolygon::AutoPolygon(std::string_view filename)
_filename = filename; _filename = filename;
_image = new Image(); _image = new Image();
_image->initWithImageFile(filename); _image->initWithImageFile(filename);
CCASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8, AXASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888"); "unsupported format, currently only supports rgba8888");
_data = _image->getData(); _data = _image->getData();
_width = _image->getWidth(); _width = _image->getWidth();
@ -211,7 +211,7 @@ Vec2 AutoPolygon::findFirstNoneTransparentPixel(const Rect& rect, float threshol
} }
} }
} }
CCASSERT(found, "image is all transparent!"); AXASSERT(found, "image is all transparent!");
return i; return i;
} }
@ -246,7 +246,7 @@ unsigned int AutoPolygon::getSquareValue(unsigned int x, unsigned int y, const R
sv += (fixedRect.containsPoint(bl) && getAlphaByPos(bl) > threshold) ? 4 : 0; sv += (fixedRect.containsPoint(bl) && getAlphaByPos(bl) > threshold) ? 4 : 0;
Vec2 br = Vec2(x - 0.0f, y - 0.0f); Vec2 br = Vec2(x - 0.0f, y - 0.0f);
sv += (fixedRect.containsPoint(br) && getAlphaByPos(br) > threshold) ? 8 : 0; sv += (fixedRect.containsPoint(br) && getAlphaByPos(br) > threshold) ? 8 : 0;
CCASSERT(sv != 0 && sv != 15, "square value should not be 0, or 15"); AXASSERT(sv != 0 && sv != 15, "square value should not be 0, or 15");
return sv; return sv;
} }
@ -386,7 +386,7 @@ std::vector<axis::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2& s
} }
break; break;
default: default:
CCLOG("this shouldn't happen."); AXLOG("this shouldn't happen.");
} }
// little optimization // little optimization
// if previous direction is same as current direction, // if previous direction is same as current direction,
@ -408,9 +408,9 @@ std::vector<axis::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2& s
prevx = stepx; prevx = stepx;
prevy = stepy; prevy = stepy;
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
const auto totalPixel = _width * _height; const auto totalPixel = _width * _height;
CCASSERT(count <= totalPixel, "oh no, marching square cannot find starting position"); AXASSERT(count <= totalPixel, "oh no, marching square cannot find starting position");
#endif #endif
} while (curx != startx || cury != starty); } while (curx != startx || cury != starty);
return _points; return _points;
@ -666,7 +666,7 @@ void AutoPolygon::calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t coun
0,1 1,1 0,1 1,1
*/ */
CCASSERT(_width && _height, "please specify width and height for this AutoPolygon instance"); AXASSERT(_width && _height, "please specify width and height for this AutoPolygon instance");
auto texWidth = _width; auto texWidth = _width;
auto texHeight = _height; auto texHeight = _height;
@ -688,7 +688,7 @@ Rect AutoPolygon::getRealRect(const Rect& rect)
if (realRect.equals(Rect::ZERO)) if (realRect.equals(Rect::ZERO))
{ {
// if the instance doesn't have width and height, then the whole operation is kaput // if the instance doesn't have width and height, then the whole operation is kaput
CCASSERT(_height && _width, "Please specify a width and height for this instance before using its functions"); AXASSERT(_height && _width, "Please specify a width and height for this instance before using its functions");
realRect = Rect(0, 0, (float)_width, (float)_height); realRect = Rect(0, 0, (float)_width, (float)_height);
} }
else else

View File

@ -81,7 +81,7 @@ Camera* Camera::getDefaultCamera()
auto scene = Director::getInstance()->getRunningScene(); auto scene = Director::getInstance()->getRunningScene();
CCASSERT(scene, "Scene is not done initializing, please use this->_defaultCamera instead."); AXASSERT(scene, "Scene is not done initializing, please use this->_defaultCamera instead.");
return scene->getDefaultCamera(); return scene->getDefaultCamera();
@ -233,7 +233,7 @@ bool Camera::initDefault()
break; break;
} }
default: default:
CCLOG("unrecognized projection"); AXLOG("unrecognized projection");
break; break;
} }
if (_zoomFactor != 1.0F) if (_zoomFactor != 1.0F)
@ -283,7 +283,7 @@ Vec2 Camera::project(const Vec3& src) const
Vec4 clipPos; Vec4 clipPos;
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos); getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
CCASSERT(clipPos.w != 0.0f, "clipPos.w can't be 0.0f!"); AXASSERT(clipPos.w != 0.0f, "clipPos.w can't be 0.0f!");
float ndcX = clipPos.x / clipPos.w; float ndcX = clipPos.x / clipPos.w;
float ndcY = clipPos.y / clipPos.w; float ndcY = clipPos.y / clipPos.w;
@ -301,7 +301,7 @@ Vec2 Camera::projectGL(const Vec3& src) const
getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos); getViewProjectionMatrix().transformVector(Vec4(src.x, src.y, src.z, 1.0f), &clipPos);
if (clipPos.w == 0.0f) if (clipPos.w == 0.0f)
CCLOG("WARNING: Camera's clip position w is 0.0! a black screen should be expected."); AXLOG("WARNING: Camera's clip position w is 0.0! a black screen should be expected.");
float ndcX = clipPos.x / clipPos.w; float ndcX = clipPos.x / clipPos.w;
float ndcY = clipPos.y / clipPos.w; float ndcY = clipPos.y / clipPos.w;
@ -327,7 +327,7 @@ Vec3 Camera::unprojectGL(const Vec3& src) const
void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const
{ {
CCASSERT(src && dst, "vec3 can not be null"); AXASSERT(src && dst, "vec3 can not be null");
Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f); Vec4 screen(src->x / viewport.width, ((viewport.height - src->y)) / viewport.height, src->z, 1.0f);
screen.x = screen.x * 2.0f - 1.0f; screen.x = screen.x * 2.0f - 1.0f;
@ -347,7 +347,7 @@ void Camera::unproject(const Vec2& viewport, const Vec3* src, Vec3* dst) const
void Camera::unprojectGL(const Vec2& viewport, const Vec3* src, Vec3* dst) const void Camera::unprojectGL(const Vec2& viewport, const Vec3* src, Vec3* dst) const
{ {
CCASSERT(src && dst, "vec3 can not be null"); AXASSERT(src && dst, "vec3 can not be null");
Vec4 screen(src->x / viewport.width, src->y / viewport.height, src->z, 1.0f); Vec4 screen(src->x / viewport.width, src->y / viewport.height, src->z, 1.0f);
screen.x = screen.x * 2.0f - 1.0f; screen.x = screen.x * 2.0f - 1.0f;

View File

@ -97,7 +97,7 @@ void ClippingNode::onEnter()
} }
else else
{ {
CCLOG("ClippingNode warning: _stencil is nil."); AXLOG("ClippingNode warning: _stencil is nil.");
} }
} }
@ -141,7 +141,7 @@ void ClippingNode::visit(Renderer* renderer, const Mat4& parentTransform, uint32
// IMPORTANT: // IMPORTANT:
// To ease the migration to v3.0, we still support the Mat4 stack, // To ease the migration to v3.0, we still support the Mat4 stack,
// but it is deprecated and your code should not rely on it // but it is deprecated and your code should not rely on it
CCASSERT(nullptr != _director, "Director is null when setting matrix stack"); AXASSERT(nullptr != _director, "Director is null when setting matrix stack");
_director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); _director->pushMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
_director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform); _director->loadMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW, _modelViewTransform);

View File

@ -49,15 +49,15 @@ Component* ComponentContainer::get(std::string_view name) const
bool ComponentContainer::add(Component* com) bool ComponentContainer::add(Component* com)
{ {
bool ret = false; bool ret = false;
CCASSERT(com != nullptr, "Component must be non-nil"); AXASSERT(com != nullptr, "Component must be non-nil");
CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again"); AXASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
do do
{ {
auto componentName = com->getName(); auto componentName = com->getName();
if (_componentMap.find(componentName) != _componentMap.end()) if (_componentMap.find(componentName) != _componentMap.end())
{ {
CCASSERT(false, "ComponentContainer already have this kind of component"); AXASSERT(false, "ComponentContainer already have this kind of component");
break; break;
} }
hlookup::set_item(_componentMap, componentName, com); //_componentMap[componentName] = com; hlookup::set_item(_componentMap, componentName, com); //_componentMap[componentName] = com;

View File

@ -90,7 +90,7 @@ DrawNode* DrawNode::create(float defaultLineWidth)
void DrawNode::ensureCapacity(int count) void DrawNode::ensureCapacity(int count)
{ {
CCASSERT(count >= 0, "capacity must be >= 0"); AXASSERT(count >= 0, "capacity must be >= 0");
if (_bufferCountTriangle + count > _bufferCapacityTriangle) if (_bufferCountTriangle + count > _bufferCapacityTriangle)
{ {
@ -105,7 +105,7 @@ void DrawNode::ensureCapacity(int count)
void DrawNode::ensureCapacityGLPoint(int count) void DrawNode::ensureCapacityGLPoint(int count)
{ {
CCASSERT(count >= 0, "capacity must be >= 0"); AXASSERT(count >= 0, "capacity must be >= 0");
if (_bufferCountPoint + count > _bufferCapacityPoint) if (_bufferCountPoint + count > _bufferCapacityPoint)
{ {
@ -120,7 +120,7 @@ void DrawNode::ensureCapacityGLPoint(int count)
void DrawNode::ensureCapacityGLLine(int count) void DrawNode::ensureCapacityGLLine(int count)
{ {
CCASSERT(count >= 0, "capacity must be >= 0"); AXASSERT(count >= 0, "capacity must be >= 0");
if (_bufferCountLine + count > _bufferCapacityLine) if (_bufferCountLine + count > _bufferCapacityLine)
{ {
@ -605,7 +605,7 @@ void DrawNode::drawPolygon(const Vec2* verts,
float borderWidth, float borderWidth,
const Color4B& borderColor) const Color4B& borderColor)
{ {
CCASSERT(count >= 0, "invalid count value"); AXASSERT(count >= 0, "invalid count value");
bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f); bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f);

View File

@ -211,7 +211,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
else else
{ {
// do nothing, do not support // do nothing, do not support
// CCASSERT(0, "TMX invalid value"); // AXASSERT(0, "TMX invalid value");
} }
_indicesVertexZNumber.clear(); _indicesVertexZNumber.clear();
@ -321,7 +321,7 @@ void FastTMXLayer::setupTiles()
break; break;
case FAST_TMX_ORIENTATION_HEX: case FAST_TMX_ORIENTATION_HEX:
default: default:
CCLOGERROR("FastTMX does not support type %d", _layerOrientation); AXLOGERROR("FastTMX does not support type %d", _layerOrientation);
break; break;
} }
@ -647,10 +647,10 @@ void FastTMXLayer::updateTotalQuads()
// removing / getting tiles // removing / getting tiles
Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate) Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 && AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
tileCoordinate.y >= 0, tileCoordinate.y >= 0,
"TMXLayer: invalid position"); "TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released"); AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
Sprite* tile = nullptr; Sprite* tile = nullptr;
int gid = this->getTileGIDAt(tileCoordinate); int gid = this->getTileGIDAt(tileCoordinate);
@ -690,10 +690,10 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags /* = nullptr*/) int FastTMXLayer::getTileGIDAt(const Vec2& tileCoordinate, TMXTileFlags* flags /* = nullptr*/)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 && AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
tileCoordinate.y >= 0, tileCoordinate.y >= 0,
"TMXLayer: invalid position"); "TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released"); AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
int idx = static_cast<int>(((int)tileCoordinate.x + (int)tileCoordinate.y * _layerSize.width)); int idx = static_cast<int>(((int)tileCoordinate.x + (int)tileCoordinate.y * _layerSize.width));
@ -737,10 +737,10 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
ret = static_cast<int>(-(_layerSize.height - pos.y)); ret = static_cast<int>(-(_layerSize.height - pos.y));
break; break;
case FAST_TMX_ORIENTATION_HEX: case FAST_TMX_ORIENTATION_HEX:
CCASSERT(0, "TMX Hexa vertexZ not supported"); AXASSERT(0, "TMX Hexa vertexZ not supported");
break; break;
default: default:
CCASSERT(0, "TMX invalid value"); AXASSERT(0, "TMX invalid value");
break; break;
} }
} }
@ -755,7 +755,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate) void FastTMXLayer::removeTileAt(const Vec2& tileCoordinate)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 && AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
tileCoordinate.y >= 0, tileCoordinate.y >= 0,
"TMXLayer: invalid position"); "TMXLayer: invalid position");
@ -842,7 +842,7 @@ Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
break; break;
case FAST_TMX_ORIENTATION_HEX: case FAST_TMX_ORIENTATION_HEX:
default: default:
CCASSERT(pos.isZero(), "offset for this map not implemented yet"); AXASSERT(pos.isZero(), "offset for this map not implemented yet");
break; break;
} }
return ret; return ret;
@ -856,11 +856,11 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags) void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate, TMXTileFlags flags)
{ {
CCASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 && AXASSERT(tileCoordinate.x < _layerSize.width && tileCoordinate.y < _layerSize.height && tileCoordinate.x >= 0 &&
tileCoordinate.y >= 0, tileCoordinate.y >= 0,
"TMXLayer: invalid position"); "TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released"); AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
CCASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid"); AXASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid");
TMXTileFlags currentFlags; TMXTileFlags currentFlags;
int currentGID = getTileGIDAt(tileCoordinate, &currentFlags); int currentGID = getTileGIDAt(tileCoordinate, &currentFlags);

View File

@ -59,7 +59,7 @@ FastTMXTiledMap* FastTMXTiledMap::createWithXML(std::string_view tmxString, std:
bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile) bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
{ {
CCASSERT(tmxFile.size() > 0, "FastTMXTiledMap: tmx file should not be empty"); AXASSERT(tmxFile.size() > 0, "FastTMXTiledMap: tmx file should not be empty");
setContentSize(Vec2::ZERO); setContentSize(Vec2::ZERO);
@ -69,7 +69,7 @@ bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
{ {
return false; return false;
} }
CCASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename."); AXASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
buildWithMapInfo(mapInfo); buildWithMapInfo(mapInfo);
_tmxFile = tmxFile; _tmxFile = tmxFile;
@ -83,7 +83,7 @@ bool FastTMXTiledMap::initWithXML(std::string_view tmxString, std::string_view r
TMXMapInfo* mapInfo = TMXMapInfo::createWithXML(tmxString, resourcePath); TMXMapInfo* mapInfo = TMXMapInfo::createWithXML(tmxString, resourcePath);
CCASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename."); AXASSERT(!mapInfo->getTilesets().empty(), "FastTMXTiledMap: Map not found. Please check the filename.");
buildWithMapInfo(mapInfo); buildWithMapInfo(mapInfo);
return true; return true;
@ -148,7 +148,7 @@ TMXTilesetInfo* FastTMXTiledMap::tilesetForLayer(TMXLayerInfo* layerInfo, TMXMap
} }
// If all the tiles are 0, return empty tileset // If all the tiles are 0, return empty tileset
CCLOG("cocos2d: Warning: TMX Layer '%s' has no tiles", layerInfo->_name.c_str()); AXLOG("cocos2d: Warning: TMX Layer '%s' has no tiles", layerInfo->_name.c_str());
return nullptr; return nullptr;
} }
@ -196,7 +196,7 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
// public // public
FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
{ {
CCASSERT(!layerName.empty(), "Invalid layer name!"); AXASSERT(!layerName.empty(), "Invalid layer name!");
for (auto& child : _children) for (auto& child : _children)
{ {
@ -216,7 +216,7 @@ FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
TMXObjectGroup* FastTMXTiledMap::getObjectGroup(std::string_view groupName) const TMXObjectGroup* FastTMXTiledMap::getObjectGroup(std::string_view groupName) const
{ {
CCASSERT(!groupName.empty(), "Invalid group name!"); AXASSERT(!groupName.empty(), "Invalid group name!");
if (_objectGroups.size() > 0) if (_objectGroups.size() > 0)
{ {

View File

@ -40,7 +40,7 @@ FontCharMap* FontCharMap::create(std::string_view plistFile)
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
CCASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version"); AXASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
std::string textureFilename = relPathStr + dict["textureFilename"].asString(); std::string textureFilename = relPathStr + dict["textureFilename"].asString();

View File

@ -117,7 +117,7 @@ BMFontConfiguration::BMFontConfiguration() : _commonHeight(0), _characterSet(nul
BMFontConfiguration::~BMFontConfiguration() BMFontConfiguration::~BMFontConfiguration()
{ {
CCLOGINFO("deallocing BMFontConfiguration: %p", this); AXLOGINFO("deallocing BMFontConfiguration: %p", this);
this->purgeFontDefDictionary(); this->purgeFontDefDictionary();
this->purgeKerningDictionary(); this->purgeKerningDictionary();
_atlasName.clear(); _atlasName.clear();
@ -156,7 +156,7 @@ std::set<unsigned int>* BMFontConfiguration::parseConfigFile(std::string_view co
} }
if (data[0] == 0) if (data[0] == 0)
{ {
CCLOG("cocos2d: Error parsing FNTfile %s", controlFile.data()); AXLOG("cocos2d: Error parsing FNTfile %s", controlFile.data());
return nullptr; return nullptr;
} }
auto contents = data.c_str(); auto contents = data.c_str();
@ -231,7 +231,7 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
uint32_t remains = size; uint32_t remains = size;
CCASSERT(pData[3] == 3, "Only version 3 is supported"); AXASSERT(pData[3] == 3, "Only version 3 is supported");
pData += 4; pData += 4;
remains -= 4; remains -= 4;
@ -293,13 +293,13 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
uint16_t scaleH = 0; uint16_t scaleH = 0;
memcpy(&scaleH, pData + 6, 2); memcpy(&scaleH, pData + 6, 2);
CCASSERT(scaleW <= Configuration::getInstance()->getMaxTextureSize() && AXASSERT(scaleW <= Configuration::getInstance()->getMaxTextureSize() &&
scaleH <= Configuration::getInstance()->getMaxTextureSize(), scaleH <= Configuration::getInstance()->getMaxTextureSize(),
"CCLabelBMFont: page can't be larger than supported"); "CCLabelBMFont: page can't be larger than supported");
uint16_t pages = 0; uint16_t pages = 0;
memcpy(&pages, pData + 8, 2); memcpy(&pages, pData + 8, 2);
CCASSERT(pages == 1, "CCBitfontAtlas: only supports 1 page"); AXASSERT(pages == 1, "CCBitfontAtlas: only supports 1 page");
} }
else if (blockId == 3) else if (blockId == 3)
{ {
@ -308,7 +308,7 @@ std::set<unsigned int>* BMFontConfiguration::parseBinaryConfigFile(unsigned char
*/ */
const char* value = (const char*)pData; const char* value = (const char*)pData;
CCASSERT(strlen(value) < blockSize, "Block size should be less then string"); AXASSERT(strlen(value) < blockSize, "Block size should be less then string");
_atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile); _atlasName = FileUtils::getInstance()->fullPathFromRelativeFile(value, controlFile);
} }
@ -409,7 +409,7 @@ void BMFontConfiguration::parseImageFileName(const char* line, std::string_view
// page ID. Sanity check // page ID. Sanity check
int pageId; int pageId;
sscanf(line, "page id=%d", &pageId); sscanf(line, "page id=%d", &pageId);
CCASSERT(pageId == 0, "LabelBMFont file could not be found"); AXASSERT(pageId == 0, "LabelBMFont file could not be found");
// file // file
char fileName[255]; char fileName[255];
@ -429,7 +429,7 @@ void BMFontConfiguration::parseInfoArguments(const char* line)
// padding // padding
sscanf(strstr(line, "padding=") + 8, "%d,%d,%d,%d", &_padding.top, &_padding.right, &_padding.bottom, sscanf(strstr(line, "padding=") + 8, "%d,%d,%d,%d", &_padding.top, &_padding.right, &_padding.bottom,
&_padding.left); &_padding.left);
// CCLOG("cocos2d: padding: %d,%d,%d,%d", _padding.left, _padding.top, _padding.right, _padding.bottom); // AXLOG("cocos2d: padding: %d,%d,%d,%d", _padding.left, _padding.top, _padding.right, _padding.bottom);
} }
void BMFontConfiguration::parseCommonArguments(const char* line) void BMFontConfiguration::parseCommonArguments(const char* line)
@ -443,24 +443,24 @@ void BMFontConfiguration::parseCommonArguments(const char* line)
auto tmp = strstr(line, "lineHeight=") + 11; auto tmp = strstr(line, "lineHeight=") + 11;
sscanf(tmp, "%d", &_commonHeight); sscanf(tmp, "%d", &_commonHeight);
#if COCOS2D_DEBUG > 0 #if AXIS_DEBUG > 0
// scaleW. sanity check // scaleW. sanity check
int value; int value;
tmp = strstr(tmp, "scaleW=") + 7; tmp = strstr(tmp, "scaleW=") + 7;
sscanf(tmp, "%d", &value); sscanf(tmp, "%d", &value);
int maxTextureSize = Configuration::getInstance()->getMaxTextureSize(); int maxTextureSize = Configuration::getInstance()->getMaxTextureSize();
CCASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported"); AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
// scaleH. sanity check // scaleH. sanity check
tmp = strstr(tmp, "scaleH=") + 7; tmp = strstr(tmp, "scaleH=") + 7;
sscanf(tmp, "%d", &value); sscanf(tmp, "%d", &value);
CCASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported"); AXASSERT(value <= maxTextureSize, "CCLabelBMFont: page can't be larger than supported");
// pages. sanity check // pages. sanity check
tmp = strstr(tmp, "pages=") + 6; tmp = strstr(tmp, "pages=") + 6;
sscanf(tmp, "%d", &value); sscanf(tmp, "%d", &value);
CCASSERT(value == 1, "CCBitfontAtlas: only supports 1 page"); AXASSERT(value == 1, "CCBitfontAtlas: only supports 1 page");
#endif #endif
// packed (ignore) What does this mean ?? // packed (ignore) What does this mean ??
} }
@ -738,7 +738,7 @@ FontAtlas* FontFNT::newFontAtlas()
// add the new definition // add the new definition
if (65535 < fontDef.charID) if (65535 < fontDef.charID)
{ {
CCLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID); AXLOGWARN("Warning: 65535 < fontDef.charID (%u), ignored", fontDef.charID);
} }
else else
{ {

View File

@ -388,7 +388,7 @@ unsigned char* FontFreeType::getGlyphBitmap(char32_t charCode,
// @remark: glyphIndex=0 means character is missing on current font face // @remark: glyphIndex=0 means character is missing on current font face
auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast<FT_ULong>(charCode)); auto glyphIndex = FT_Get_Char_Index(_fontFace, static_cast<FT_ULong>(charCode));
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 #if defined(AXIS_DEBUG) && AXIS_DEBUG > 0
if (glyphIndex == 0) if (glyphIndex == 0)
{ {
char32_t ntcs[2] = {charCode, (char32_t)0}; char32_t ntcs[2] = {charCode, (char32_t)0};

View File

@ -149,7 +149,7 @@ void GridBase::updateBlendState()
GridBase::~GridBase() GridBase::~GridBase()
{ {
CCLOGINFO("deallocing GridBase: %p", this); AXLOGINFO("deallocing GridBase: %p", this);
AX_SAFE_RELEASE(_renderTarget); AX_SAFE_RELEASE(_renderTarget);
@ -470,7 +470,7 @@ void Grid3D::calculateVertexPoints()
Vec3 Grid3D::getVertex(const Vec2& pos) const Vec3 Grid3D::getVertex(const Vec2& pos) const
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3; int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
float* vertArray = (float*)_vertices; float* vertArray = (float*)_vertices;
@ -482,7 +482,7 @@ Vec3 Grid3D::getVertex(const Vec2& pos) const
Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3; int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
float* vertArray = (float*)_originalVertices; float* vertArray = (float*)_originalVertices;
@ -494,7 +494,7 @@ Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
void Grid3D::setVertex(const Vec2& pos, const Vec3& vertex) void Grid3D::setVertex(const Vec2& pos, const Vec3& vertex)
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3; int index = (int)(pos.x * (_gridSize.height + 1) + pos.y) * 3;
float* vertArray = (float*)_vertices; float* vertArray = (float*)_vertices;
vertArray[index] = vertex.x; vertArray[index] = vertex.x;
@ -718,7 +718,7 @@ void TiledGrid3D::calculateVertexPoints()
void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords) void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords)
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3; int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
float* vertArray = (float*)_vertices; float* vertArray = (float*)_vertices;
memcpy(&vertArray[idx], &coords, sizeof(Quad3)); memcpy(&vertArray[idx], &coords, sizeof(Quad3));
@ -726,7 +726,7 @@ void TiledGrid3D::setTile(const Vec2& pos, const Quad3& coords)
Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3; int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
float* vertArray = (float*)_originalVertices; float* vertArray = (float*)_originalVertices;
@ -738,7 +738,7 @@ Quad3 TiledGrid3D::getOriginalTile(const Vec2& pos) const
Quad3 TiledGrid3D::getTile(const Vec2& pos) const Quad3 TiledGrid3D::getTile(const Vec2& pos) const
{ {
CCASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers"); AXASSERT(pos.x == (unsigned int)pos.x && pos.y == (unsigned int)pos.y, "Numbers must be integers");
int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3; int idx = (int)(_gridSize.height * pos.x + pos.y) * 4 * 3;
float* vertArray = (float*)_vertices; float* vertArray = (float*)_vertices;

View File

@ -780,7 +780,7 @@ void Label::updateShaderProgram()
void Label::updateBatchCommand(Label::BatchCommand& batch) void Label::updateBatchCommand(Label::BatchCommand& batch)
{ {
CCASSERT(_programState, "programState should be set!"); AXASSERT(_programState, "programState should be set!");
batch.setProgramState(_programState); batch.setProgramState(_programState);
} }
@ -1398,7 +1398,7 @@ void Label::enableGlow(const Color4B& glowColor)
void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 */) void Label::enableOutline(const Color4B& outlineColor, int outlineSize /* = -1 */)
{ {
CCASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF, AXASSERT(_currentLabelType == LabelType::STRING_TEXTURE || _currentLabelType == LabelType::TTF,
"Only supported system font and TTF!"); "Only supported system font and TTF!");
if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE) if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
@ -2197,7 +2197,7 @@ Sprite* Label::getLetter(int letterIndex)
void Label::setLineHeight(float height) void Label::setLineHeight(float height)
{ {
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
if (_lineHeight != height) if (_lineHeight != height)
{ {
@ -2208,7 +2208,7 @@ void Label::setLineHeight(float height)
float Label::getLineHeight() const float Label::getLineHeight() const
{ {
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
return _textSprite ? 0.0f : _lineHeight * _bmfontScale; return _textSprite ? 0.0f : _lineHeight * _bmfontScale;
} }
@ -2238,12 +2238,12 @@ void Label::setAdditionalKerning(float space)
} }
} }
else else
CCLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE"); AXLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
} }
float Label::getAdditionalKerning() const float Label::getAdditionalKerning() const
{ {
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!"); AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
return _additionalKerning; return _additionalKerning;
} }
@ -2356,7 +2356,7 @@ void Label::updateDisplayedOpacity(uint8_t parentOpacity)
// that's fine but it should be documented // that's fine but it should be documented
void Label::setTextColor(const Color4B& color) void Label::setTextColor(const Color4B& color)
{ {
CCASSERT(_currentLabelType == LabelType::TTF || _currentLabelType == LabelType::STRING_TEXTURE, AXASSERT(_currentLabelType == LabelType::TTF || _currentLabelType == LabelType::STRING_TEXTURE,
"Only supported system font and ttf!"); "Only supported system font and ttf!");
if (_currentLabelType == LabelType::STRING_TEXTURE && _textColor != color) if (_currentLabelType == LabelType::STRING_TEXTURE && _textColor != color)
@ -2505,7 +2505,7 @@ FontDefinition Label::_getFontDefinition() const
#if (AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID) && (AX_TARGET_PLATFORM != AX_PLATFORM_IOS) #if (AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID) && (AX_TARGET_PLATFORM != AX_PLATFORM_IOS)
if (systemFontDef._stroke._strokeEnabled) if (systemFontDef._stroke._strokeEnabled)
{ {
CCLOGERROR("Stroke Currently only supported on iOS and Android!"); AXLOGERROR("Stroke Currently only supported on iOS and Android!");
} }
systemFontDef._stroke._strokeEnabled = false; systemFontDef._stroke._strokeEnabled = false;
#endif #endif

View File

@ -124,7 +124,7 @@ bool LabelAtlas::initWithString(std::string_view theString, std::string_view fnt
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(pathStr);
CCASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version"); AXASSERT(dict["version"].asInt() == 1, "Unsupported version. Upgrade cocos2d version");
std::string textureFilename = relPathStr + dict["textureFilename"].asString(); std::string textureFilename = relPathStr + dict["textureFilename"].asString();
@ -160,7 +160,7 @@ void LabelAtlas::updateAtlasValues()
itemHeightInPixels = static_cast<float>(_itemHeight); itemHeightInPixels = static_cast<float>(_itemHeight);
} }
CCASSERT(n <= _textureAtlas->getCapacity(), "updateAtlasValues: Invalid String length"); AXASSERT(n <= _textureAtlas->getCapacity(), "updateAtlasValues: Invalid String length");
V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads(); V3F_C4B_T2F_Quad* quads = _textureAtlas->getQuads();
for (ssize_t i = 0; i < n; i++) for (ssize_t i = 0; i < n; i++)
{ {

View File

@ -212,7 +212,7 @@ bool Label::multilineTextWrap(const std::function<int(const std::u32string&, int
if (!getFontLetterDef(character, letterDef)) if (!getFontLetterDef(character, letterDef))
{ {
recordPlaceholderInfo(letterIndex, character); recordPlaceholderInfo(letterIndex, character);
CCLOG("LabelTextFormatter error: can't find letter definition in font file for letter: 0x%x", AXLOG("LabelTextFormatter error: can't find letter definition in font file for letter: 0x%x",
character); character);
continue; continue;
} }

View File

@ -732,7 +732,7 @@ void LayerMultiplex::switchTo(int n)
void LayerMultiplex::switchTo(int n, bool cleanup) void LayerMultiplex::switchTo(int n, bool cleanup)
{ {
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message"); AXASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
this->removeChild(_layers.at(_enabledLayer), cleanup); this->removeChild(_layers.at(_enabledLayer), cleanup);
@ -743,7 +743,7 @@ void LayerMultiplex::switchTo(int n, bool cleanup)
void LayerMultiplex::switchToAndReleaseMe(int n) void LayerMultiplex::switchToAndReleaseMe(int n)
{ {
CCASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message"); AXASSERT(n < _layers.size(), "Invalid index in MultiplexLayer switchTo message");
this->removeChild(_layers.at(_enabledLayer), true); this->removeChild(_layers.at(_enabledLayer), true);
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS #if AX_ENABLE_GC_FOR_NATIVE_OBJECTS

View File

@ -50,7 +50,7 @@ enum
Menu::~Menu() Menu::~Menu()
{ {
CCLOGINFO("In the destructor of Menu. %p", this); AXLOGINFO("In the destructor of Menu. %p", this);
} }
Menu* Menu::create() Menu* Menu::create()
@ -171,13 +171,13 @@ void Menu::addChild(Node* child, int zOrder)
void Menu::addChild(Node* child, int zOrder, int tag) void Menu::addChild(Node* child, int zOrder, int tag)
{ {
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children"); AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
Node::addChild(child, zOrder, tag); Node::addChild(child, zOrder, tag);
} }
void Menu::addChild(Node* child, int zOrder, std::string_view name) void Menu::addChild(Node* child, int zOrder, std::string_view name)
{ {
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children"); AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
Node::addChild(child, zOrder, name); Node::addChild(child, zOrder, name);
} }
@ -204,7 +204,7 @@ void Menu::onExit()
void Menu::removeChild(Node* child, bool cleanup) void Menu::removeChild(Node* child, bool cleanup)
{ {
CCASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children"); AXASSERT(dynamic_cast<MenuItem*>(child) != nullptr, "Menu only supports MenuItem objects as children");
if (_selectedItem == child) if (_selectedItem == child)
{ {
@ -247,7 +247,7 @@ bool Menu::onTouchBegan(Touch* touch, Event* /*event*/)
void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/) void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/)
{ {
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchEnded] -- invalid state"); AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchEnded] -- invalid state");
this->retain(); this->retain();
if (_selectedItem) if (_selectedItem)
{ {
@ -261,7 +261,7 @@ void Menu::onTouchEnded(Touch* /*touch*/, Event* /*event*/)
void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/) void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/)
{ {
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchCancelled] -- invalid state"); AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchCancelled] -- invalid state");
this->retain(); this->retain();
if (_selectedItem) if (_selectedItem)
{ {
@ -273,7 +273,7 @@ void Menu::onTouchCancelled(Touch* /*touch*/, Event* /*event*/)
void Menu::onTouchMoved(Touch* touch, Event* /*event*/) void Menu::onTouchMoved(Touch* touch, Event* /*event*/)
{ {
CCASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchMoved] -- invalid state"); AXASSERT(_state == Menu::State::TRACKING_TOUCH, "[Menu ccTouchMoved] -- invalid state");
MenuItem* currentItem = this->getItemForTouch(touch, _selectedWithCamera); MenuItem* currentItem = this->getItemForTouch(touch, _selectedWithCamera);
if (currentItem != _selectedItem) if (currentItem != _selectedItem)
{ {
@ -343,7 +343,7 @@ void Menu::alignItemsInColumns(int columns, ...)
void Menu::alignItemsInColumns(int columns, va_list args) void Menu::alignItemsInColumns(int columns, va_list args)
{ {
CCASSERT(columns >= 0, "Columns must be >= 0"); AXASSERT(columns >= 0, "Columns must be >= 0");
ValueVector rows; ValueVector rows;
while (columns) while (columns)
{ {
@ -363,11 +363,11 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
for (const auto& child : _children) for (const auto& child : _children)
{ {
CCASSERT(row < rows.size(), "row should less than rows.size()!"); AXASSERT(row < rows.size(), "row should less than rows.size()!");
rowColumns = rows[row].asInt(); rowColumns = rows[row].asInt();
// can not have zero columns on a row // can not have zero columns on a row
CCASSERT(rowColumns, "rowColumns can't be 0."); AXASSERT(rowColumns, "rowColumns can't be 0.");
float tmp = child->getContentSize().height; float tmp = child->getContentSize().height;
rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp); rowHeight = (unsigned int)((rowHeight >= tmp || isnan(tmp)) ? rowHeight : tmp);
@ -384,7 +384,7 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
} }
// check if too many rows/columns for available menu items // check if too many rows/columns for available menu items
CCASSERT(!columnsOccupied, "columnsOccupied should be 0."); AXASSERT(!columnsOccupied, "columnsOccupied should be 0.");
Vec2 winSize = getContentSize(); Vec2 winSize = getContentSize();
@ -460,11 +460,11 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
for (const auto& child : _children) for (const auto& child : _children)
{ {
// check if too many menu items for the amount of rows/columns // check if too many menu items for the amount of rows/columns
CCASSERT(column < columns.size(), "column should be less than columns.size()."); AXASSERT(column < columns.size(), "column should be less than columns.size().");
columnRows = columns[column].asInt(); columnRows = columns[column].asInt();
// can't have zero rows on a column // can't have zero rows on a column
CCASSERT(columnRows, "columnRows can't be 0."); AXASSERT(columnRows, "columnRows can't be 0.");
// columnWidth = fmaxf(columnWidth, [item contentSize].width); // columnWidth = fmaxf(columnWidth, [item contentSize].width);
float tmp = child->getContentSize().width; float tmp = child->getContentSize().width;
@ -487,7 +487,7 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
} }
// check if too many rows/columns for available menu items. // check if too many rows/columns for available menu items.
CCASSERT(!rowsOccupied, "rowsOccupied should be 0."); AXASSERT(!rowsOccupied, "rowsOccupied should be 0.");
Vec2 winSize = getContentSize(); Vec2 winSize = getContentSize();

View File

@ -289,7 +289,7 @@ bool MenuItemAtlasFont::initWithString(std::string_view value,
char startCharMap, char startCharMap,
const ccMenuCallback& callback) const ccMenuCallback& callback)
{ {
CCASSERT(value.size() != 0, "value length must be greater than 0"); AXASSERT(value.size() != 0, "value length must be greater than 0");
LabelAtlas* label = LabelAtlas::create(value, charMapFile, itemWidth, itemHeight, startCharMap); LabelAtlas* label = LabelAtlas::create(value, charMapFile, itemWidth, itemHeight, startCharMap);
if (MenuItemLabel::initWithLabel(label, callback)) if (MenuItemLabel::initWithLabel(label, callback))
{ {
@ -347,12 +347,12 @@ MenuItemFont::MenuItemFont() : _fontSize(0), _fontName("") {}
MenuItemFont::~MenuItemFont() MenuItemFont::~MenuItemFont()
{ {
CCLOGINFO("In the destructor of MenuItemFont (%p).", this); AXLOGINFO("In the destructor of MenuItemFont (%p).", this);
} }
bool MenuItemFont::initWithString(std::string_view value, const ccMenuCallback& callback) bool MenuItemFont::initWithString(std::string_view value, const ccMenuCallback& callback)
{ {
CCASSERT(!value.empty(), "Value length must be greater than 0"); AXASSERT(!value.empty(), "Value length must be greater than 0");
_fontName = _globalFontName; _fontName = _globalFontName;
_fontSize = _globalFontSize; _fontSize = _globalFontSize;

View File

@ -80,7 +80,7 @@ MotionStreak* MotionStreak::create(float fade, float minSeg, float stroke, const
bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path) bool MotionStreak::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
{ {
CCASSERT(!path.empty(), "Invalid filename"); AXASSERT(!path.empty(), "Invalid filename");
Texture2D* texture = _director->getTextureCache()->addImage(path); Texture2D* texture = _director->getTextureCache()->addImage(path);
return initWithFade(fade, minSeg, stroke, color, texture); return initWithFade(fade, minSeg, stroke, color, texture);
@ -227,7 +227,7 @@ bool MotionStreak::setProgramState(backend::ProgramState* programState, bool nee
{ {
if (Node::setProgramState(programState, needsRetain)) if (Node::setProgramState(programState, needsRetain))
{ {
CCASSERT(programState, "argument should not be nullptr"); AXASSERT(programState, "argument should not be nullptr");
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor(); auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
pipelineDescriptor.programState = _programState; pipelineDescriptor.programState = _programState;
@ -273,12 +273,12 @@ const BlendFunc& MotionStreak::getBlendFunc() const
void MotionStreak::setOpacity(uint8_t /*opacity*/) void MotionStreak::setOpacity(uint8_t /*opacity*/)
{ {
CCASSERT(false, "Set opacity no supported"); AXASSERT(false, "Set opacity no supported");
} }
uint8_t MotionStreak::getOpacity() const uint8_t MotionStreak::getOpacity() const
{ {
CCASSERT(false, "Opacity no supported"); AXASSERT(false, "Opacity no supported");
return 0; return 0;
} }

View File

@ -155,7 +155,7 @@ Node* Node::create()
Node::~Node() Node::~Node()
{ {
CCLOGINFO("deallocing Node: %p - tag: %i", this, _tag); AXLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
AX_SAFE_DELETE(_childrenIndexer); AX_SAFE_DELETE(_childrenIndexer);
@ -187,11 +187,11 @@ Node::~Node()
_eventDispatcher->removeEventListenersForTarget(this); _eventDispatcher->removeEventListenersForTarget(this);
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && AXIS_DEBUG > 0
_eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this); _eventDispatcher->debugCheckNodeHasNoEventListenersOnDestruction(this);
#endif #endif
CCASSERT(!_running, AXASSERT(!_running,
"Node still marked as running on node destruction! Was base class onExit() called in derived class " "Node still marked as running on node destruction! Was base class onExit() called in derived class "
"onExit() implementations?"); "onExit() implementations?");
AX_SAFE_RELEASE(_eventDispatcher); AX_SAFE_RELEASE(_eventDispatcher);
@ -310,7 +310,7 @@ void Node::setGlobalZOrder(float globalZOrder)
/// rotation getter /// rotation getter
float Node::getRotation() const float Node::getRotation() const
{ {
CCASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return"); AXASSERT(_rotationZ_X == _rotationZ_Y, "CCNode#rotation. RotationX != RotationY. Don't know which one to return");
return _rotationZ_X; return _rotationZ_X;
} }
@ -350,7 +350,7 @@ void Node::setRotation3D(const Vec3& rotation)
Vec3 Node::getRotation3D() const Vec3 Node::getRotation3D() const
{ {
// rotation Z is decomposed in 2 to simulate Skew for Flash animations // rotation Z is decomposed in 2 to simulate Skew for Flash animations
CCASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y"); AXASSERT(_rotationZ_X == _rotationZ_Y, "_rotationZ_X != _rotationZ_Y");
return Vec3(_rotationX, _rotationY, _rotationZ_X); return Vec3(_rotationX, _rotationY, _rotationZ_X);
} }
@ -427,7 +427,7 @@ void Node::setRotationSkewY(float rotationY)
/// scale getter /// scale getter
float Node::getScale() const float Node::getScale() const
{ {
CCASSERT(_scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return"); AXASSERT(_scaleX == _scaleY, "CCNode#scale. ScaleX != ScaleY. Don't know which one to return");
return _scaleX; return _scaleX;
} }
@ -808,7 +808,7 @@ void Node::childrenAlloc()
Node* Node::getChildByTag(int tag) const Node* Node::getChildByTag(int tag) const
{ {
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
if (_childrenIndexer) if (_childrenIndexer)
{ {
@ -827,7 +827,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"); // AXASSERT(!name.empty(), "Invalid name");
auto hash = AX_HASH_NODE_NAME(name); auto hash = AX_HASH_NODE_NAME(name);
if (_childrenIndexer) if (_childrenIndexer)
{ {
@ -847,8 +847,8 @@ Node* Node::getChildByName(std::string_view name) const
void Node::enumerateChildren(std::string_view name, std::function<bool(Node*)> callback) const void Node::enumerateChildren(std::string_view name, std::function<bool(Node*)> callback) const
{ {
CCASSERT(!name.empty(), "Invalid name"); AXASSERT(!name.empty(), "Invalid name");
CCASSERT(callback != nullptr, "Invalid callback function"); AXASSERT(callback != nullptr, "Invalid callback function");
size_t length = name.length(); size_t length = name.length();
@ -968,16 +968,16 @@ bool Node::doEnumerate(std::string name, std::function<bool(Node*)> callback) co
*/ */
void Node::addChild(Node* child, int localZOrder, int tag) void Node::addChild(Node* child, int localZOrder, int tag)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again"); AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
addChildHelper(child, localZOrder, tag, "", true); addChildHelper(child, localZOrder, tag, "", true);
} }
void Node::addChild(Node* child, int localZOrder, std::string_view name) void Node::addChild(Node* child, int localZOrder, std::string_view name)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again"); AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
addChildHelper(child, localZOrder, INVALID_TAG, name, false); addChildHelper(child, localZOrder, INVALID_TAG, name, false);
} }
@ -993,7 +993,7 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, std::string_vie
}); });
(void)assertNotSelfChild; (void)assertNotSelfChild;
CCASSERT(assertNotSelfChild(), "A node cannot be the child of his own children"); AXASSERT(assertNotSelfChild(), "A node cannot be the child of his own children");
if (_children.empty()) if (_children.empty())
{ {
@ -1046,13 +1046,13 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, std::string_vie
void Node::addChild(Node* child, int zOrder) void Node::addChild(Node* child, int zOrder)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
this->addChild(child, zOrder, child->_name); this->addChild(child, zOrder, child->_name);
} }
void Node::addChild(Node* child) void Node::addChild(Node* child)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
this->addChild(child, child->getLocalZOrder(), child->_name); this->addChild(child, child->getLocalZOrder(), child->_name);
} }
@ -1088,13 +1088,13 @@ void Node::removeChild(Node* child, bool cleanup /* = true */)
void Node::removeChildByTag(int tag, bool cleanup /* = true */) void Node::removeChildByTag(int tag, bool cleanup /* = true */)
{ {
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
Node* child = this->getChildByTag(tag); Node* child = this->getChildByTag(tag);
if (child == nullptr) if (child == nullptr)
{ {
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag); AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
} }
else else
{ {
@ -1104,13 +1104,13 @@ void Node::removeChildByTag(int tag, bool cleanup /* = true */)
void Node::removeChildByName(std::string_view name, bool cleanup) void Node::removeChildByName(std::string_view name, bool cleanup)
{ {
CCASSERT(!name.empty(), "Invalid name"); AXASSERT(!name.empty(), "Invalid name");
Node* child = this->getChildByName(name); Node* child = this->getChildByName(name);
if (child == nullptr) if (child == nullptr)
{ {
CCLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data()); AXLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data());
} }
else else
{ {
@ -1193,7 +1193,7 @@ void Node::insertChild(Node* child, int z)
void Node::reorderChild(Node* child, int zOrder) void Node::reorderChild(Node* child, int zOrder)
{ {
CCASSERT(child != nullptr, "Child must be non-nil"); AXASSERT(child != nullptr, "Child must be non-nil");
_reorderChildDirty = true; _reorderChildDirty = true;
child->updateOrderOfArrival(); child->updateOrderOfArrival();
child->_setLocalZOrder(zOrder); child->_setLocalZOrder(zOrder);
@ -1230,7 +1230,7 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
{ {
if (_usingNormalizedPosition) if (_usingNormalizedPosition)
{ {
CCASSERT(_parent, "setPositionNormalized() doesn't work with orphan nodes"); AXASSERT(_parent, "setPositionNormalized() doesn't work with orphan nodes");
if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty) if ((parentFlags & FLAGS_CONTENT_SIZE_DIRTY) || _normalizedPositionDirty)
{ {
auto& s = _parent->getContentSize(); auto& s = _parent->getContentSize();
@ -1435,7 +1435,7 @@ void Node::setActionManager(ActionManager* actionManager)
Action* Node::runAction(Action* action) Action* Node::runAction(Action* action)
{ {
CCASSERT(action != nullptr, "Argument must be non-nil"); AXASSERT(action != nullptr, "Argument must be non-nil");
_actionManager->addAction(action, this, !_running); _actionManager->addAction(action, this, !_running);
return action; return action;
} }
@ -1452,13 +1452,13 @@ void Node::stopAction(Action* action)
void Node::stopActionByTag(int tag) void Node::stopActionByTag(int tag)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
_actionManager->removeActionByTag(tag, this); _actionManager->removeActionByTag(tag, this);
} }
void Node::stopAllActionsByTag(int tag) void Node::stopAllActionsByTag(int tag)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
_actionManager->removeAllActionsByTag(tag, this); _actionManager->removeAllActionsByTag(tag, this);
} }
@ -1472,7 +1472,7 @@ void Node::stopActionsByFlags(unsigned int flags)
Action* Node::getActionByTag(int tag) Action* Node::getActionByTag(int tag)
{ {
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
return _actionManager->getActionByTag(tag, this); return _actionManager->getActionByTag(tag, this);
} }
@ -1555,8 +1555,8 @@ void Node::schedule(SEL_SCHEDULE selector, float interval)
void Node::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay) void Node::schedule(SEL_SCHEDULE selector, float interval, unsigned int repeat, float delay)
{ {
CCASSERT(selector, "Argument must be non-nil"); AXASSERT(selector, "Argument must be non-nil");
CCASSERT(interval >= 0, "Argument must be positive"); AXASSERT(interval >= 0, "Argument must be positive");
_scheduler->schedule(selector, this, interval, repeat, delay, !_running); _scheduler->schedule(selector, this, interval, repeat, delay, !_running);
} }

View File

@ -88,17 +88,17 @@ ParallaxNode* ParallaxNode::create()
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, int /*tag*/) void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, int /*tag*/)
{ {
CCASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead"); AXASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
} }
void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, std::string_view /*name*/) void ParallaxNode::addChild(Node* /*child*/, int /*zOrder*/, std::string_view /*name*/)
{ {
CCASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead"); AXASSERT(0, "ParallaxNode: use addChild:z:parallaxRatio:positionOffset instead");
} }
void ParallaxNode::addChild(Node* child, int z, const Vec2& ratio, const Vec2& offset) void ParallaxNode::addChild(Node* child, int z, const Vec2& ratio, const Vec2& offset)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
PointObject* obj = PointObject::create(ratio, offset); PointObject* obj = PointObject::create(ratio, offset);
obj->setChild(child); obj->setChild(child);
ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj); ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);

View File

@ -183,11 +183,11 @@ void ParticleBatchNode::visit(Renderer* renderer, const Mat4& parentTransform, u
// override addChild: // override addChild:
void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag) void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
{ {
CCASSERT(aChild != nullptr, "Argument must be non-nullptr"); AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr, AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children"); "CCParticleBatchNode only supports QuadParticleSystems as children");
ParticleSystem* child = static_cast<ParticleSystem*>(aChild); ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
CCASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(), AXASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
"CCParticleSystem is not using the same texture id"); "CCParticleSystem is not using the same texture id");
addChildByTagOrName(child, zOrder, tag, "", true); addChildByTagOrName(child, zOrder, tag, "", true);
@ -195,11 +195,11 @@ void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
void ParticleBatchNode::addChild(Node* aChild, int zOrder, std::string_view name) void ParticleBatchNode::addChild(Node* aChild, int zOrder, std::string_view name)
{ {
CCASSERT(aChild != nullptr, "Argument must be non-nullptr"); AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr, AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children"); "CCParticleBatchNode only supports QuadParticleSystems as children");
ParticleSystem* child = static_cast<ParticleSystem*>(aChild); ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
CCASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(), AXASSERT(child->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
"CCParticleSystem is not using the same texture id"); "CCParticleSystem is not using the same texture id");
addChildByTagOrName(child, zOrder, 0, name, false); addChildByTagOrName(child, zOrder, 0, name, false);
@ -217,7 +217,7 @@ void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child,
setBlendFunc(child->getBlendFunc()); setBlendFunc(child->getBlendFunc());
} }
CCASSERT(_blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst, AXASSERT(_blendFunc.src == child->getBlendFunc().src && _blendFunc.dst == child->getBlendFunc().dst,
"Can't add a ParticleSystem that uses a different blending function"); "Can't add a ParticleSystem that uses a different blending function");
// no lazy sorting, so don't call super addChild, call helper instead // no lazy sorting, so don't call super addChild, call helper instead
@ -253,8 +253,8 @@ void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child,
// this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting // this helper is almost equivalent to Node's addChild, but doesn't make use of the lazy sorting
int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag) int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again"); AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
_children.reserve(4); _children.reserve(4);
@ -283,10 +283,10 @@ int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, st
// Reorder will be done in this function, no "lazy" reorder to particles // Reorder will be done in this function, no "lazy" reorder to particles
void ParticleBatchNode::reorderChild(Node* aChild, int zOrder) void ParticleBatchNode::reorderChild(Node* aChild, int zOrder)
{ {
CCASSERT(aChild != nullptr, "Child must be non-nullptr"); AXASSERT(aChild != nullptr, "Child must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr, AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children"); "CCParticleBatchNode only supports QuadParticleSystems as children");
CCASSERT(_children.contains(aChild), "Child doesn't belong to batch"); AXASSERT(_children.contains(aChild), "Child doesn't belong to batch");
ParticleSystem* child = static_cast<ParticleSystem*>(aChild); ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
@ -411,9 +411,9 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup)
if (aChild == nullptr) if (aChild == nullptr)
return; return;
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr, AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children"); "CCParticleBatchNode only supports QuadParticleSystems as children");
CCASSERT(_children.contains(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it"); AXASSERT(_children.contains(aChild), "CCParticleBatchNode doesn't contain the sprite. Can't remove it");
ParticleSystem* child = static_cast<ParticleSystem*>(aChild); ParticleSystem* child = static_cast<ParticleSystem*>(aChild);
@ -481,14 +481,14 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t
void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity) void ParticleBatchNode::increaseAtlasCapacityTo(ssize_t quantity)
{ {
CCLOG("cocos2d: ParticleBatchNode: resizing TextureAtlas capacity from [%d] to [%d].", AXLOG("cocos2d: ParticleBatchNode: resizing TextureAtlas capacity from [%d] to [%d].",
(int)_textureAtlas->getCapacity(), (int)quantity); (int)_textureAtlas->getCapacity(), (int)quantity);
if (!_textureAtlas->resizeCapacity(quantity)) if (!_textureAtlas->resizeCapacity(quantity))
{ {
// serious problems // serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas"); AXLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "XXX: ParticleBatchNode #increaseAtlasCapacity SHALL handle this assert"); AXASSERT(false, "XXX: ParticleBatchNode #increaseAtlasCapacity SHALL handle this assert");
} }
} }

View File

@ -412,7 +412,7 @@ bool ParticleSystem::initWithFile(std::string_view plistFile)
_plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile); _plistFile = FileUtils::getInstance()->fullPathForFilename(plistFile);
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(_plistFile);
CCASSERT(!dict.empty(), "Particles: file not found"); AXASSERT(!dict.empty(), "Particles: file not found");
// FIXME: compute path from a path, should define a function somewhere to do it // FIXME: compute path from a path, should define a function somewhere to do it
auto listFilePath = plistFile; auto listFilePath = plistFile;
@ -573,7 +573,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
} }
else else
{ {
CCASSERT(false, "Invalid emitterType in config file"); AXASSERT(false, "Invalid emitterType in config file");
AX_BREAK_IF(true); AX_BREAK_IF(true);
} }
@ -630,7 +630,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
else if (dictionary.find("textureImageData") != dictionary.end()) else if (dictionary.find("textureImageData") != dictionary.end())
{ {
std::string textureData = dictionary.at("textureImageData").asString(); std::string textureData = dictionary.at("textureImageData").asString();
CCASSERT(!textureData.empty(), "textureData can't be empty!"); AXASSERT(!textureData.empty(), "textureData can't be empty!");
auto dataLen = textureData.size(); auto dataLen = textureData.size();
if (dataLen != 0) if (dataLen != 0)
@ -638,19 +638,19 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
// if it fails, try to get it from the base64-gzipped data // if it fails, try to get it from the base64-gzipped data
int decodeLen = int decodeLen =
base64Decode((unsigned char*)textureData.c_str(), (unsigned int)dataLen, &buffer); base64Decode((unsigned char*)textureData.c_str(), (unsigned int)dataLen, &buffer);
CCASSERT(buffer != nullptr, "CCParticleSystem: error decoding textureImageData"); AXASSERT(buffer != nullptr, "CCParticleSystem: error decoding textureImageData");
AX_BREAK_IF(!buffer); AX_BREAK_IF(!buffer);
unsigned char* deflated = nullptr; unsigned char* deflated = nullptr;
ssize_t deflatedLen = ZipUtils::inflateMemory(buffer, decodeLen, &deflated); ssize_t deflatedLen = ZipUtils::inflateMemory(buffer, decodeLen, &deflated);
CCASSERT(deflated != nullptr, "CCParticleSystem: error ungzipping textureImageData"); AXASSERT(deflated != nullptr, "CCParticleSystem: error ungzipping textureImageData");
AX_BREAK_IF(!deflated); AX_BREAK_IF(!deflated);
// For android, we should retain it in VolatileTexture::addImage which invoked in // For android, we should retain it in VolatileTexture::addImage which invoked in
// Director::getInstance()->getTextureCache()->addUIImage() // Director::getInstance()->getTextureCache()->addUIImage()
image = new Image(); image = new Image();
bool isOK = image->initWithImageData(deflated, deflatedLen, true); bool isOK = image->initWithImageData(deflated, deflatedLen, true);
CCASSERT(isOK, "CCParticleSystem: error init image with Data"); AXASSERT(isOK, "CCParticleSystem: error init image with Data");
AX_BREAK_IF(!isOK); AX_BREAK_IF(!isOK);
setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName)); setTexture(_director->getTextureCache()->addImage(image, _plistFile + textureName));
@ -662,7 +662,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
_yCoordFlipped = optValue(dictionary, "yCoordFlipped").asInt(1); _yCoordFlipped = optValue(dictionary, "yCoordFlipped").asInt(1);
if (!this->_texture) if (!this->_texture)
CCLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture"); AXLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
} }
ret = true; ret = true;
} }
@ -679,7 +679,7 @@ bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
if (!_particleData.init(_totalParticles)) if (!_particleData.init(_totalParticles))
{ {
CCLOG("Particle system: not enough memory"); AXLOG("Particle system: not enough memory");
this->release(); this->release();
return false; return false;
} }
@ -1386,12 +1386,12 @@ void ParticleSystem::setAnimationIndicesAtlas()
return; return;
} }
CCASSERT(false, "Couldn't figure out the atlas size and direction."); AXASSERT(false, "Couldn't figure out the atlas size and direction.");
} }
void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction) void ParticleSystem::setAnimationIndicesAtlas(unsigned int unifiedCellSize, TexAnimDir direction)
{ {
CCASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero."); AXASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
resetAnimationIndices(); resetAnimationIndices();
@ -1870,7 +1870,7 @@ void ParticleSystem::setTexture(Texture2D* var)
void ParticleSystem::updateBlendFunc() void ParticleSystem::updateBlendFunc()
{ {
CCASSERT(!_batchNode, "Can't change blending functions when the particle is being batched"); AXASSERT(!_batchNode, "Can't change blending functions when the particle is being batched");
if (_texture) if (_texture)
{ {
@ -1921,170 +1921,170 @@ bool ParticleSystem::isBlendAdditive() const
// ParticleSystem - Properties of Gravity Mode // ParticleSystem - Properties of Gravity Mode
void ParticleSystem::setTangentialAccel(float t) void ParticleSystem::setTangentialAccel(float t)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.tangentialAccel = t; modeA.tangentialAccel = t;
} }
float ParticleSystem::getTangentialAccel() const float ParticleSystem::getTangentialAccel() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.tangentialAccel; return modeA.tangentialAccel;
} }
void ParticleSystem::setTangentialAccelVar(float t) void ParticleSystem::setTangentialAccelVar(float t)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.tangentialAccelVar = t; modeA.tangentialAccelVar = t;
} }
float ParticleSystem::getTangentialAccelVar() const float ParticleSystem::getTangentialAccelVar() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.tangentialAccelVar; return modeA.tangentialAccelVar;
} }
void ParticleSystem::setRadialAccel(float t) void ParticleSystem::setRadialAccel(float t)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.radialAccel = t; modeA.radialAccel = t;
} }
float ParticleSystem::getRadialAccel() const float ParticleSystem::getRadialAccel() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.radialAccel; return modeA.radialAccel;
} }
void ParticleSystem::setRadialAccelVar(float t) void ParticleSystem::setRadialAccelVar(float t)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.radialAccelVar = t; modeA.radialAccelVar = t;
} }
float ParticleSystem::getRadialAccelVar() const float ParticleSystem::getRadialAccelVar() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.radialAccelVar; return modeA.radialAccelVar;
} }
void ParticleSystem::setRotationIsDir(bool t) void ParticleSystem::setRotationIsDir(bool t)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.rotationIsDir = t; modeA.rotationIsDir = t;
} }
bool ParticleSystem::getRotationIsDir() const bool ParticleSystem::getRotationIsDir() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.rotationIsDir; return modeA.rotationIsDir;
} }
void ParticleSystem::setGravity(const Vec2& g) void ParticleSystem::setGravity(const Vec2& g)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.gravity = g; modeA.gravity = g;
} }
const Vec2& ParticleSystem::getGravity() const Vec2& ParticleSystem::getGravity()
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.gravity; return modeA.gravity;
} }
void ParticleSystem::setSpeed(float speed) void ParticleSystem::setSpeed(float speed)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.speed = speed; modeA.speed = speed;
} }
float ParticleSystem::getSpeed() const float ParticleSystem::getSpeed() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.speed; return modeA.speed;
} }
void ParticleSystem::setSpeedVar(float speedVar) void ParticleSystem::setSpeedVar(float speedVar)
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
modeA.speedVar = speedVar; modeA.speedVar = speedVar;
} }
float ParticleSystem::getSpeedVar() const float ParticleSystem::getSpeedVar() const
{ {
CCASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity"); AXASSERT(_emitterMode == Mode::GRAVITY, "Particle Mode should be Gravity");
return modeA.speedVar; return modeA.speedVar;
} }
// ParticleSystem - Properties of Radius Mode // ParticleSystem - Properties of Radius Mode
void ParticleSystem::setStartRadius(float startRadius) void ParticleSystem::setStartRadius(float startRadius)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.startRadius = startRadius; modeB.startRadius = startRadius;
} }
float ParticleSystem::getStartRadius() const float ParticleSystem::getStartRadius() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.startRadius; return modeB.startRadius;
} }
void ParticleSystem::setStartRadiusVar(float startRadiusVar) void ParticleSystem::setStartRadiusVar(float startRadiusVar)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.startRadiusVar = startRadiusVar; modeB.startRadiusVar = startRadiusVar;
} }
float ParticleSystem::getStartRadiusVar() const float ParticleSystem::getStartRadiusVar() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.startRadiusVar; return modeB.startRadiusVar;
} }
void ParticleSystem::setEndRadius(float endRadius) void ParticleSystem::setEndRadius(float endRadius)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.endRadius = endRadius; modeB.endRadius = endRadius;
} }
float ParticleSystem::getEndRadius() const float ParticleSystem::getEndRadius() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.endRadius; return modeB.endRadius;
} }
void ParticleSystem::setEndRadiusVar(float endRadiusVar) void ParticleSystem::setEndRadiusVar(float endRadiusVar)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.endRadiusVar = endRadiusVar; modeB.endRadiusVar = endRadiusVar;
} }
float ParticleSystem::getEndRadiusVar() const float ParticleSystem::getEndRadiusVar() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.endRadiusVar; return modeB.endRadiusVar;
} }
void ParticleSystem::setRotatePerSecond(float degrees) void ParticleSystem::setRotatePerSecond(float degrees)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.rotatePerSecond = degrees; modeB.rotatePerSecond = degrees;
} }
float ParticleSystem::getRotatePerSecond() const float ParticleSystem::getRotatePerSecond() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.rotatePerSecond; return modeB.rotatePerSecond;
} }
void ParticleSystem::setRotatePerSecondVar(float degrees) void ParticleSystem::setRotatePerSecondVar(float degrees)
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
modeB.rotatePerSecondVar = degrees; modeB.rotatePerSecondVar = degrees;
} }
float ParticleSystem::getRotatePerSecondVar() const float ParticleSystem::getRotatePerSecondVar() const
{ {
CCASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius"); AXASSERT(_emitterMode == Mode::RADIUS, "Particle Mode should be Radius");
return modeB.rotatePerSecondVar; return modeB.rotatePerSecondVar;
} }
@ -2141,7 +2141,7 @@ int ParticleSystem::getTotalParticles() const
void ParticleSystem::setTotalParticles(int var) void ParticleSystem::setTotalParticles(int var)
{ {
CCASSERT(var <= _allocatedParticles, "Particle: resizing particle array only supported for quads"); AXASSERT(var <= _allocatedParticles, "Particle: resizing particle array only supported for quads");
_totalParticles = var; _totalParticles = var;
} }
@ -2286,7 +2286,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
img->Image::initWithImageFile(texturePath); img->Image::initWithImageFile(texturePath);
img->autorelease(); img->autorelease();
CCASSERT(img, "image texture was nullptr."); AXASSERT(img, "image texture was nullptr.");
bakeEmissionMask(maskId, img, alphaThreshold, inverted, inbetweenSamples); bakeEmissionMask(maskId, img, alphaThreshold, inverted, inbetweenSamples);
} }
@ -2297,8 +2297,8 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
int inbetweenSamples) int inbetweenSamples)
{ {
auto img = imageTexture; auto img = imageTexture;
CCASSERT(img, "image texture was nullptr."); AXASSERT(img, "image texture was nullptr.");
CCASSERT(img->hasAlpha(), "image data should contain an alpha channel."); AXASSERT(img->hasAlpha(), "image data should contain an alpha channel.");
vector<Vec2> points; vector<Vec2> points;
@ -2341,7 +2341,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
iter->second = desc; iter->second = desc;
CCLOG("Particle emission mask '%u' baked (%dx%d), %zu samples generated taking %.2fmb of memory.", AXLOG("Particle emission mask '%u' baked (%dx%d), %zu samples generated taking %.2fmb of memory.",
(unsigned int)htonl(fourccId), w, h, desc.points.size(), desc.points.size() * 8 / 1e+6); (unsigned int)htonl(fourccId), w, h, desc.points.size(), desc.points.size() * 8 / 1e+6);
} }

View File

@ -106,7 +106,7 @@ ParticleSystemQuad* ParticleSystemQuad::create(std::string_view filename)
ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles) ParticleSystemQuad* ParticleSystemQuad::createWithTotalParticles(int numberOfParticles)
{ {
CCASSERT(numberOfParticles <= 10000, AXASSERT(numberOfParticles <= 10000,
"Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of " "Adding more than 10000 particles will crash the renderer, the mesh generated has an index format of "
"U_SHORT (uint16_t)"); "U_SHORT (uint16_t)");
@ -257,7 +257,7 @@ void ParticleSystemQuad::setTexture(Texture2D* texture)
void ParticleSystemQuad::setDisplayFrame(SpriteFrame* spriteFrame) void ParticleSystemQuad::setDisplayFrame(SpriteFrame* spriteFrame)
{ {
CCASSERT(spriteFrame->getOffsetInPixels().isZero(), "QuadParticle only supports SpriteFrames with no offsets"); AXASSERT(spriteFrame->getOffsetInPixels().isZero(), "QuadParticle only supports SpriteFrames with no offsets");
this->setTextureWithRect(spriteFrame->getTexture(), spriteFrame->getRect()); this->setTextureWithRect(spriteFrame->getTexture(), spriteFrame->getRect());
} }
@ -731,7 +731,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
_particleData.release(); _particleData.release();
if (!_particleData.init(tp)) if (!_particleData.init(tp))
{ {
CCLOG("Particle system: not enough memory"); AXLOG("Particle system: not enough memory");
return; return;
} }
V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize); V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize);
@ -757,7 +757,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
if (indicesNew) if (indicesNew)
_indices = indicesNew; _indices = indicesNew;
CCLOG("Particle system: out of memory"); AXLOG("Particle system: out of memory");
return; return;
} }
@ -809,7 +809,7 @@ void ParticleSystemQuad::listenRendererRecreated(EventCustom* /*event*/)
bool ParticleSystemQuad::allocMemory() bool ParticleSystemQuad::allocMemory()
{ {
CCASSERT(!_batchNode, "Memory should not be alloced when not using batchNode"); AXASSERT(!_batchNode, "Memory should not be alloced when not using batchNode");
AX_SAFE_FREE(_quads); AX_SAFE_FREE(_quads);
AX_SAFE_FREE(_indices); AX_SAFE_FREE(_indices);
@ -819,7 +819,7 @@ bool ParticleSystemQuad::allocMemory()
if (!_quads || !_indices) if (!_quads || !_indices)
{ {
CCLOG("cocos2d: Particle system: not enough memory"); AXLOG("cocos2d: Particle system: not enough memory");
AX_SAFE_FREE(_quads); AX_SAFE_FREE(_quads);
AX_SAFE_FREE(_indices); AX_SAFE_FREE(_indices);

View File

@ -20,13 +20,13 @@ NS_AX_BEGIN
void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& cache) void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& cache)
{ {
CCASSERT(!filePath.empty(), "plist filename should not be nullptr"); AXASSERT(!filePath.empty(), "plist filename should not be nullptr");
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath); const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
if (fullPath.empty()) if (fullPath.empty())
{ {
// return if plist file doesn't exist // return if plist file doesn't exist
CCLOG("cocos2d: SpriteFrameCache: can not find %s", filePath.data()); AXLOG("cocos2d: SpriteFrameCache: can not find %s", filePath.data());
return; return;
} }
@ -61,7 +61,7 @@ void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& c
// append .png // append .png
texturePath = texturePath.append(".png"); texturePath = texturePath.append(".png");
CCLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str()); AXLOG("cocos2d: SpriteFrameCache: Trying to use file %s as texture", texturePath.c_str());
} }
addSpriteFramesWithDictionary(dict, texturePath, filePath, cache); addSpriteFramesWithDictionary(dict, texturePath, filePath, cache);
} }
@ -76,7 +76,7 @@ void PlistSpriteSheetLoader::load(std::string_view filePath, Texture2D* texture,
void PlistSpriteSheetLoader::load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache) void PlistSpriteSheetLoader::load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache)
{ {
CCASSERT(!textureFileName.empty(), "texture name should not be null"); AXASSERT(!textureFileName.empty(), "texture name should not be null");
const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath); const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath);
auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
addSpriteFramesWithDictionary(dict, textureFileName, filePath, cache); addSpriteFramesWithDictionary(dict, textureFileName, filePath, cache);
@ -143,7 +143,7 @@ void PlistSpriteSheetLoader::reload(std::string_view filePath, SpriteFrameCache&
} }
else else
{ {
CCLOG("cocos2d: SpriteFrameCache: Couldn't load texture"); AXLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
} }
} }
@ -189,7 +189,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
} }
// check the format // check the format
CCASSERT(format >= 0 && format <= 3, AXASSERT(format >= 0 && format <= 3,
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:"); "format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
std::vector<std::string> frameAliases; std::vector<std::string> frameAliases;
@ -219,7 +219,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
// check ow/oh // check ow/oh
if (!ow || !oh) if (!ow || !oh)
{ {
CCLOGWARN( AXLOGWARN(
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as " "cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
"expected. Regenerate the .plist"); "expected. Regenerate the .plist");
} }
@ -268,7 +268,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
} }
else else
{ {
CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str()); AXLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
} }
} }
@ -367,7 +367,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dict,
} }
else else
{ {
CCLOG("cocos2d: SpriteFrameCache: Couldn't load texture"); AXLOG("cocos2d: SpriteFrameCache: Couldn't load texture");
} }
} }
@ -387,7 +387,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
} }
// check the format // check the format
CCASSERT(format >= 0 && format <= 3, AXASSERT(format >= 0 && format <= 3,
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:"); "format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
auto spriteSheet = std::make_shared<SpriteSheet>(); auto spriteSheet = std::make_shared<SpriteSheet>();
@ -417,7 +417,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
// check ow/oh // check ow/oh
if (!ow || !oh) if (!ow || !oh)
{ {
CCLOGWARN( AXLOGWARN(
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as " "cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
"expected. Regenerate the .plist"); "expected. Regenerate the .plist");
} }
@ -466,7 +466,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
} }
else else
{ {
CCLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str()); AXLOGWARN("cocos2d: WARNING: an alias with name %s already exists", oneAlias.c_str());
} }
} }

View File

@ -38,7 +38,7 @@ ProtectedNode::ProtectedNode() : _reorderProtectedChildDirty(false) {}
ProtectedNode::~ProtectedNode() ProtectedNode::~ProtectedNode()
{ {
CCLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag); AXLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag);
removeAllProtectedChildren(); removeAllProtectedChildren();
} }
@ -80,8 +80,8 @@ void ProtectedNode::addProtectedChild(axis::Node* child, int localZOrder)
*/ */
void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag) void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
{ {
CCASSERT(child != nullptr, "Argument must be non-nil"); AXASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again"); AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
if (_protectedChildren.empty()) if (_protectedChildren.empty())
{ {
@ -118,7 +118,7 @@ void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
Node* ProtectedNode::getProtectedChildByTag(int tag) Node* ProtectedNode::getProtectedChildByTag(int tag)
{ {
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
for (auto& child : _protectedChildren) for (auto& child : _protectedChildren)
{ {
@ -213,13 +213,13 @@ void ProtectedNode::removeAllProtectedChildrenWithCleanup(bool cleanup)
void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup) void ProtectedNode::removeProtectedChildByTag(int tag, bool cleanup)
{ {
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag"); AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
Node* child = this->getProtectedChildByTag(tag); Node* child = this->getProtectedChildByTag(tag);
if (child == nullptr) if (child == nullptr)
{ {
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag); AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
} }
else else
{ {
@ -253,7 +253,7 @@ void ProtectedNode::sortAllProtectedChildren()
void ProtectedNode::reorderProtectedChild(axis::Node* child, int localZOrder) void ProtectedNode::reorderProtectedChild(axis::Node* child, int localZOrder)
{ {
CCASSERT(child != nullptr, "Child must be non-nil"); AXASSERT(child != nullptr, "Child must be non-nil");
_reorderProtectedChildDirty = true; _reorderProtectedChildDirty = true;
child->updateOrderOfArrival(); child->updateOrderOfArrival();
child->setLocalZOrder(localZOrder); child->setLocalZOrder(localZOrder);

View File

@ -84,7 +84,7 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
} }
else else
{ {
CCLOG("Cache rendertexture failed!"); AXLOG("Cache rendertexture failed!");
} }
AX_SAFE_RELEASE(uiTextureImage); AX_SAFE_RELEASE(uiTextureImage);
}; };
@ -158,7 +158,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
PixelFormat depthStencilFormat, PixelFormat depthStencilFormat,
bool sharedRenderTarget) bool sharedRenderTarget)
{ {
CCASSERT(format != backend::PixelFormat::A8, "only RGB and RGBA formats are valid for a render texture"); AXASSERT(format != backend::PixelFormat::A8, "only RGB and RGBA formats are valid for a render texture");
bool ret = false; bool ret = false;
do do
@ -379,12 +379,12 @@ bool RenderTexture::saveToFileAsNonPMA(std::string_view filename, bool isRGBA, S
else if (basename.find(".jpg") != std::string::npos) else if (basename.find(".jpg") != std::string::npos)
{ {
if (isRGBA) if (isRGBA)
CCLOG("RGBA is not supported for JPG format."); AXLOG("RGBA is not supported for JPG format.");
return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback); return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback);
} }
else else
{ {
CCLOG("Only PNG and JPG format are supported now!"); AXLOG("Only PNG and JPG format are supported now!");
} }
return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback); return saveToFileAsNonPMA(filename, Image::Format::JPG, false, callback);
@ -402,12 +402,12 @@ bool RenderTexture::saveToFile(std::string_view filename, bool isRGBA, SaveFileC
else if (basename.find(".jpg") != std::string::npos) else if (basename.find(".jpg") != std::string::npos)
{ {
if (isRGBA) if (isRGBA)
CCLOG("RGBA is not supported for JPG format."); AXLOG("RGBA is not supported for JPG format.");
return saveToFile(filename, Image::Format::JPG, false, callback); return saveToFile(filename, Image::Format::JPG, false, callback);
} }
else else
{ {
CCLOG("Only PNG and JPG format are supported now!"); AXLOG("Only PNG and JPG format are supported now!");
} }
return saveToFile(filename, Image::Format::JPG, false, callback); return saveToFile(filename, Image::Format::JPG, false, callback);
@ -418,10 +418,10 @@ bool RenderTexture::saveToFileAsNonPMA(std::string_view fileName,
bool isRGBA, bool isRGBA,
SaveFileCallbackType callback) SaveFileCallbackType callback)
{ {
CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG, AXASSERT(format == Image::Format::JPG || format == Image::Format::PNG,
"the image can only be saved as JPG or PNG format"); "the image can only be saved as JPG or PNG format");
if (isRGBA && format == Image::Format::JPG) if (isRGBA && format == Image::Format::JPG)
CCLOG("RGBA is not supported for JPG format"); AXLOG("RGBA is not supported for JPG format");
_saveFileCallback = callback; _saveFileCallback = callback;
@ -441,10 +441,10 @@ bool RenderTexture::saveToFile(std::string_view fileName,
bool isRGBA, bool isRGBA,
SaveFileCallbackType callback) SaveFileCallbackType callback)
{ {
CCASSERT(format == Image::Format::JPG || format == Image::Format::PNG, AXASSERT(format == Image::Format::JPG || format == Image::Format::PNG,
"the image can only be saved as JPG or PNG format"); "the image can only be saved as JPG or PNG format");
if (isRGBA && format == Image::Format::JPG) if (isRGBA && format == Image::Format::JPG)
CCLOG("RGBA is not supported for JPG format"); AXLOG("RGBA is not supported for JPG format");
_saveFileCallback = callback; _saveFileCallback = callback;
@ -481,7 +481,7 @@ void RenderTexture::onSaveToFile(std::string_view filename, bool isRGBA, bool fo
/* get buffer as Image */ /* get buffer as Image */
void RenderTexture::newImage(std::function<void(RefPtr<Image>)> imageCallback, bool flipImage) void RenderTexture::newImage(std::function<void(RefPtr<Image>)> imageCallback, bool flipImage)
{ {
CCASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "only RGBA8888 can be saved as image"); AXASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "only RGBA8888 can be saved as image");
if ((nullptr == _texture2D)) if ((nullptr == _texture2D))
{ {

View File

@ -130,10 +130,10 @@ Sprite* Sprite::createWithSpriteFrameName(std::string_view spriteFrameName)
{ {
SpriteFrame* frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName); SpriteFrame* frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
#if COCOS2D_DEBUG > 0 #if AXIS_DEBUG > 0
char msg[256] = {0}; char msg[256] = {0};
sprintf(msg, "Invalid spriteFrameName: %s", spriteFrameName.data()); sprintf(msg, "Invalid spriteFrameName: %s", spriteFrameName.data());
CCASSERT(frame != nullptr, msg); AXASSERT(frame != nullptr, msg);
#endif #endif
return createWithSpriteFrame(frame); return createWithSpriteFrame(frame);
@ -159,7 +159,7 @@ bool Sprite::init()
bool Sprite::initWithTexture(Texture2D* texture) bool Sprite::initWithTexture(Texture2D* texture)
{ {
CCASSERT(texture != nullptr, "Invalid texture for sprite"); AXASSERT(texture != nullptr, "Invalid texture for sprite");
Rect rect = Rect::ZERO; Rect rect = Rect::ZERO;
if (texture) if (texture)
@ -182,7 +182,7 @@ bool Sprite::initWithFile(std::string_view filename, PixelFormat format)
{ {
if (filename.empty()) if (filename.empty())
{ {
CCLOG("Call Sprite::initWithFile with blank resource filename."); AXLOG("Call Sprite::initWithFile with blank resource filename.");
return false; return false;
} }
@ -204,7 +204,7 @@ bool Sprite::initWithFile(std::string_view filename, PixelFormat format)
bool Sprite::initWithFile(std::string_view filename, const Rect& rect) bool Sprite::initWithFile(std::string_view filename, const Rect& rect)
{ {
CCASSERT(!filename.empty(), "Invalid filename"); AXASSERT(!filename.empty(), "Invalid filename");
if (filename.empty()) if (filename.empty())
return false; return false;
@ -222,7 +222,7 @@ bool Sprite::initWithFile(std::string_view filename, const Rect& rect)
bool Sprite::initWithSpriteFrameName(std::string_view spriteFrameName) bool Sprite::initWithSpriteFrameName(std::string_view spriteFrameName)
{ {
CCASSERT(!spriteFrameName.empty(), "Invalid spriteFrameName"); AXASSERT(!spriteFrameName.empty(), "Invalid spriteFrameName");
if (spriteFrameName.empty()) if (spriteFrameName.empty())
return false; return false;
@ -235,7 +235,7 @@ bool Sprite::initWithSpriteFrameName(std::string_view spriteFrameName)
bool Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame) bool Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame)
{ {
CCASSERT(spriteFrame != nullptr, "spriteFrame can't be nullptr!"); AXASSERT(spriteFrame != nullptr, "spriteFrame can't be nullptr!");
if (spriteFrame == nullptr) if (spriteFrame == nullptr)
return false; return false;
@ -383,7 +383,7 @@ void Sprite::setProgramState(uint32_t type)
bool Sprite::setProgramState(backend::ProgramState* programState, bool needsRetain) bool Sprite::setProgramState(backend::ProgramState* programState, bool needsRetain)
{ {
CCASSERT(programState, "argument should not be nullptr"); AXASSERT(programState, "argument should not be nullptr");
if (Node::setProgramState(programState, needsRetain)) if (Node::setProgramState(programState, needsRetain))
{ {
auto& pipelineDescriptor = _trianglesCommand.getPipelineDescriptor(); auto& pipelineDescriptor = _trianglesCommand.getPipelineDescriptor();
@ -401,10 +401,10 @@ bool Sprite::setProgramState(backend::ProgramState* programState, bool needsReta
void Sprite::setTexture(Texture2D* texture) void Sprite::setTexture(Texture2D* texture)
{ {
CCASSERT(!_batchNode || (texture && texture == _batchNode->getTexture()), AXASSERT(!_batchNode || (texture && texture == _batchNode->getTexture()),
"CCSprite: Batched sprites should use the same texture as the batchnode"); "CCSprite: Batched sprites should use the same texture as the batchnode");
// accept texture==nil as argument // accept texture==nil as argument
CCASSERT(!texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument"); AXASSERT(!texture || dynamic_cast<Texture2D*>(texture), "setTexture expects a Texture2D. Invalid argument");
if (texture == nullptr) if (texture == nullptr)
{ {
@ -416,7 +416,7 @@ void Sprite::setTexture(Texture2D* texture)
{ {
Image* image = new Image(); Image* image = new Image();
bool AX_UNUSED isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8); bool AX_UNUSED isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully."); AXASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
texture = _director->getTextureCache()->addImage(image, AX_2x2_WHITE_IMAGE_KEY); texture = _director->getTextureCache()->addImage(image, AX_2x2_WHITE_IMAGE_KEY);
AX_SAFE_RELEASE(image); AX_SAFE_RELEASE(image);
@ -709,7 +709,7 @@ void Sprite::setCenterRectNormalized(const axis::Rect& rectTopLeft)
{ {
if (_renderMode != RenderMode::QUAD && _renderMode != RenderMode::SLICE9) if (_renderMode != RenderMode::QUAD && _renderMode != RenderMode::SLICE9)
{ {
CCLOGWARN("Warning: Sprite::setCenterRectNormalized() only works with QUAD and SLICE9 render modes"); AXLOGWARN("Warning: Sprite::setCenterRectNormalized() only works with QUAD and SLICE9 render modes");
return; return;
} }
@ -765,7 +765,7 @@ void Sprite::setCenterRect(const axis::Rect& rectInPoints)
{ {
if (_renderMode != RenderMode::QUAD && _renderMode != RenderMode::SLICE9) if (_renderMode != RenderMode::QUAD && _renderMode != RenderMode::SLICE9)
{ {
CCLOGWARN("Warning: Sprite::setCenterRect() only works with QUAD and SLICE9 render modes"); AXLOGWARN("Warning: Sprite::setCenterRect() only works with QUAD and SLICE9 render modes");
return; return;
} }
@ -928,7 +928,7 @@ void Sprite::setVertexCoords(const Rect& rect, V3F_C4B_T2F_Quad* outQuad)
void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad) void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad)
{ {
CCASSERT(quadIndex < 9, "Invalid quadIndex"); AXASSERT(quadIndex < 9, "Invalid quadIndex");
// convert Quad intro Triangle since it takes less memory // convert Quad intro Triangle since it takes less memory
// Triangles are ordered like the following: // Triangles are ordered like the following:
@ -986,7 +986,7 @@ void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad)
void Sprite::updateTransform() void Sprite::updateTransform()
{ {
CCASSERT(_renderMode == RenderMode::QUAD_BATCHNODE, AXASSERT(_renderMode == RenderMode::QUAD_BATCHNODE,
"updateTransform is only valid when Sprite is being rendered using an SpriteBatchNode"); "updateTransform is only valid when Sprite is being rendered using an SpriteBatchNode");
// recalculate matrix only if it is dirty // recalculate matrix only if it is dirty
@ -1009,7 +1009,7 @@ void Sprite::updateTransform()
_transformToBatch = getNodeToParentTransform(); _transformToBatch = getNodeToParentTransform();
else else
{ {
CCASSERT(dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite"); AXASSERT(dynamic_cast<Sprite*>(_parent), "Logic error in Sprite. Parent must be a Sprite");
const Mat4& nodeToParent = getNodeToParentTransform(); const Mat4& nodeToParent = getNodeToParentTransform();
Mat4& parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch; Mat4& parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch;
_transformToBatch = parentTransform * nodeToParent; _transformToBatch = parentTransform * nodeToParent;
@ -1121,15 +1121,15 @@ void Sprite::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
void Sprite::addChild(Node* child, int zOrder, int tag) void Sprite::addChild(Node* child, int zOrder, int tag)
{ {
CCASSERT(child != nullptr, "Argument must be non-nullptr"); AXASSERT(child != nullptr, "Argument must be non-nullptr");
if (child == nullptr) if (child == nullptr)
return; return;
if (_renderMode == RenderMode::QUAD_BATCHNODE) if (_renderMode == RenderMode::QUAD_BATCHNODE)
{ {
Sprite* childSprite = dynamic_cast<Sprite*>(child); Sprite* childSprite = dynamic_cast<Sprite*>(child);
CCASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode"); AXASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
CCASSERT(childSprite->getTexture() == _textureAtlas->getTexture(), AXASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
"childSprite's texture name should be equal to _textureAtlas's texture name!"); "childSprite's texture name should be equal to _textureAtlas's texture name!");
// put it in descendants array of batch node // put it in descendants array of batch node
_batchNode->appendChild(childSprite); _batchNode->appendChild(childSprite);
@ -1145,15 +1145,15 @@ void Sprite::addChild(Node* child, int zOrder, int tag)
void Sprite::addChild(Node* child, int zOrder, std::string_view name) void Sprite::addChild(Node* child, int zOrder, std::string_view name)
{ {
CCASSERT(child != nullptr, "Argument must be non-nullptr"); AXASSERT(child != nullptr, "Argument must be non-nullptr");
if (child == nullptr) if (child == nullptr)
return; return;
if (_renderMode == RenderMode::QUAD_BATCHNODE) if (_renderMode == RenderMode::QUAD_BATCHNODE)
{ {
Sprite* childSprite = dynamic_cast<Sprite*>(child); Sprite* childSprite = dynamic_cast<Sprite*>(child);
CCASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode"); AXASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
CCASSERT(childSprite->getTexture() == _textureAtlas->getTexture(), AXASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
"childSprite's texture name should be equal to _textureAtlas's texture name."); "childSprite's texture name should be equal to _textureAtlas's texture name.");
// put it in descendants array of batch node // put it in descendants array of batch node
_batchNode->appendChild(childSprite); _batchNode->appendChild(childSprite);
@ -1169,8 +1169,8 @@ void Sprite::addChild(Node* child, int zOrder, std::string_view name)
void Sprite::reorderChild(Node* child, int zOrder) void Sprite::reorderChild(Node* child, int zOrder)
{ {
CCASSERT(child != nullptr, "child must be non null"); AXASSERT(child != nullptr, "child must be non null");
CCASSERT(_children.contains(child), "child does not belong to this"); AXASSERT(_children.contains(child), "child does not belong to this");
if ((_renderMode == RenderMode::QUAD_BATCHNODE) && !_reorderChildDirty) if ((_renderMode == RenderMode::QUAD_BATCHNODE) && !_reorderChildDirty)
{ {
@ -1350,7 +1350,7 @@ void Sprite::setAnchorPoint(const Vec2& anchor)
void Sprite::setIgnoreAnchorPointForPosition(bool value) void Sprite::setIgnoreAnchorPointForPosition(bool value)
{ {
CCASSERT(_renderMode != RenderMode::QUAD_BATCHNODE, "setIgnoreAnchorPointForPosition is invalid in Sprite"); AXASSERT(_renderMode != RenderMode::QUAD_BATCHNODE, "setIgnoreAnchorPointForPosition is invalid in Sprite");
Node::setIgnoreAnchorPointForPosition(value); Node::setIgnoreAnchorPointForPosition(value);
} }
@ -1363,7 +1363,7 @@ void Sprite::setVisible(bool bVisible)
void Sprite::setContentSize(const Vec2& size) void Sprite::setContentSize(const Vec2& size)
{ {
if (_renderMode == RenderMode::QUAD_BATCHNODE || _renderMode == RenderMode::POLYGON) if (_renderMode == RenderMode::QUAD_BATCHNODE || _renderMode == RenderMode::POLYGON)
CCLOGWARN( AXLOGWARN(
"Sprite::setContentSize() doesn't stretch the sprite when using QUAD_BATCHNODE or POLYGON render modes"); "Sprite::setContentSize() doesn't stretch the sprite when using QUAD_BATCHNODE or POLYGON render modes");
Node::setContentSize(size); Node::setContentSize(size);
@ -1552,14 +1552,14 @@ bool Sprite::isOpacityModifyRGB() const
void Sprite::setSpriteFrame(std::string_view spriteFrameName) void Sprite::setSpriteFrame(std::string_view spriteFrameName)
{ {
CCASSERT(!spriteFrameName.empty(), "spriteFrameName must not be empty"); AXASSERT(!spriteFrameName.empty(), "spriteFrameName must not be empty");
if (spriteFrameName.empty()) if (spriteFrameName.empty())
return; return;
SpriteFrameCache* cache = SpriteFrameCache::getInstance(); SpriteFrameCache* cache = SpriteFrameCache::getInstance();
SpriteFrame* spriteFrame = cache->getSpriteFrameByName(spriteFrameName); SpriteFrame* spriteFrame = cache->getSpriteFrameByName(spriteFrameName);
CCASSERT(spriteFrame, std::string("Invalid spriteFrameName :").append(spriteFrameName).c_str()); AXASSERT(spriteFrame, std::string("Invalid spriteFrameName :").append(spriteFrameName).c_str());
setSpriteFrame(spriteFrame); setSpriteFrame(spriteFrame);
} }
@ -1603,17 +1603,17 @@ void Sprite::setSpriteFrame(SpriteFrame* spriteFrame)
void Sprite::setDisplayFrameWithAnimationName(std::string_view animationName, unsigned int frameIndex) void Sprite::setDisplayFrameWithAnimationName(std::string_view animationName, unsigned int frameIndex)
{ {
CCASSERT(!animationName.empty(), "CCSprite#setDisplayFrameWithAnimationName. animationName must not be nullptr"); AXASSERT(!animationName.empty(), "CCSprite#setDisplayFrameWithAnimationName. animationName must not be nullptr");
if (animationName.empty()) if (animationName.empty())
return; return;
Animation* a = AnimationCache::getInstance()->getAnimation(animationName); Animation* a = AnimationCache::getInstance()->getAnimation(animationName);
CCASSERT(a, "CCSprite#setDisplayFrameWithAnimationName: Frame not found"); AXASSERT(a, "CCSprite#setDisplayFrameWithAnimationName: Frame not found");
AnimationFrame* frame = a->getFrames().at(frameIndex); AnimationFrame* frame = a->getFrames().at(frameIndex);
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame"); AXASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
setSpriteFrame(frame->getSpriteFrame()); setSpriteFrame(frame->getSpriteFrame());
} }
@ -1677,7 +1677,7 @@ void Sprite::setBatchNode(SpriteBatchNode* spriteBatchNode)
// MARK: Texture protocol // MARK: Texture protocol
void Sprite::updateBlendFunc() void Sprite::updateBlendFunc()
{ {
CCASSERT(_renderMode != RenderMode::QUAD_BATCHNODE, AXASSERT(_renderMode != RenderMode::QUAD_BATCHNODE,
"CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a SpriteBatchNode"); "CCSprite: updateBlendFunc doesn't work when the sprite is rendered using a SpriteBatchNode");
// it is possible to have an untextured sprite // it is possible to have an untextured sprite

View File

@ -87,7 +87,7 @@ bool SpriteBatchNode::initWithTexture(Texture2D* tex, ssize_t capacity /* = DEFA
return false; return false;
} }
CCASSERT(capacity >= 0, "Capacity must be >= 0"); AXASSERT(capacity >= 0, "Capacity must be >= 0");
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED; _blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
if (!tex->hasPremultipliedAlpha()) if (!tex->hasPremultipliedAlpha())
@ -116,14 +116,14 @@ bool SpriteBatchNode::initWithTexture(Texture2D* tex, ssize_t capacity /* = DEFA
void SpriteBatchNode::setUniformLocation() void SpriteBatchNode::setUniformLocation()
{ {
CCASSERT(_programState, "programState should not be nullptr"); AXASSERT(_programState, "programState should not be nullptr");
_mvpMatrixLocaiton = _programState->getUniformLocation("u_MVPMatrix"); _mvpMatrixLocaiton = _programState->getUniformLocation("u_MVPMatrix");
_textureLocation = _programState->getUniformLocation("u_tex0"); _textureLocation = _programState->getUniformLocation("u_tex0");
} }
void SpriteBatchNode::setVertexLayout() void SpriteBatchNode::setVertexLayout()
{ {
CCASSERT(_programState, "programState should not be nullptr"); AXASSERT(_programState, "programState should not be nullptr");
// set vertexLayout according to V3F_C4B_T2F structure // set vertexLayout according to V3F_C4B_T2F structure
auto vertexLayout = _programState->getVertexLayout(); auto vertexLayout = _programState->getVertexLayout();
/// a_position /// a_position
@ -144,7 +144,7 @@ void SpriteBatchNode::setVertexLayout()
bool SpriteBatchNode::setProgramState(backend::ProgramState* programState, bool needsRetain) bool SpriteBatchNode::setProgramState(backend::ProgramState* programState, bool needsRetain)
{ {
CCASSERT(programState, "programState should not be nullptr"); AXASSERT(programState, "programState should not be nullptr");
if (Node::setProgramState(programState, needsRetain)) if (Node::setProgramState(programState, needsRetain))
{ {
auto& pipelineDescriptor = _quadCommand.getPipelineDescriptor(); auto& pipelineDescriptor = _quadCommand.getPipelineDescriptor();
@ -224,11 +224,11 @@ void SpriteBatchNode::visit(Renderer* renderer, const Mat4& parentTransform, uin
void SpriteBatchNode::addChild(Node* child, int zOrder, int tag) void SpriteBatchNode::addChild(Node* child, int zOrder, int tag)
{ {
CCASSERT(child != nullptr, "child should not be null"); AXASSERT(child != nullptr, "child should not be null");
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); AXASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
Sprite* sprite = static_cast<Sprite*>(child); Sprite* sprite = static_cast<Sprite*>(child);
// check Sprite is using the same texture id // check Sprite is using the same texture id
CCASSERT(sprite->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(), AXASSERT(sprite->getTexture()->getBackendTexture() == _textureAtlas->getTexture()->getBackendTexture(),
"CCSprite is not using the same texture id"); "CCSprite is not using the same texture id");
Node::addChild(child, zOrder, tag); Node::addChild(child, zOrder, tag);
@ -238,11 +238,11 @@ void SpriteBatchNode::addChild(Node* child, int zOrder, int tag)
void SpriteBatchNode::addChild(Node* child, int zOrder, std::string_view name) void SpriteBatchNode::addChild(Node* child, int zOrder, std::string_view name)
{ {
CCASSERT(child != nullptr, "child should not be null"); AXASSERT(child != nullptr, "child should not be null");
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); AXASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
Sprite* sprite = static_cast<Sprite*>(child); Sprite* sprite = static_cast<Sprite*>(child);
// check Sprite is using the same texture id // check Sprite is using the same texture id
CCASSERT(sprite->getTexture() == _textureAtlas->getTexture(), "CCSprite is not using the same texture id"); AXASSERT(sprite->getTexture() == _textureAtlas->getTexture(), "CCSprite is not using the same texture id");
Node::addChild(child, zOrder, name); Node::addChild(child, zOrder, name);
@ -252,8 +252,8 @@ void SpriteBatchNode::addChild(Node* child, int zOrder, std::string_view name)
// override reorderChild // override reorderChild
void SpriteBatchNode::reorderChild(Node* child, int zOrder) void SpriteBatchNode::reorderChild(Node* child, int zOrder)
{ {
CCASSERT(child != nullptr, "the child should not be null"); AXASSERT(child != nullptr, "the child should not be null");
CCASSERT(_children.contains(child), "Child doesn't belong to Sprite"); AXASSERT(_children.contains(child), "Child doesn't belong to Sprite");
if (zOrder == child->getLocalZOrder()) if (zOrder == child->getLocalZOrder())
{ {
@ -275,7 +275,7 @@ void SpriteBatchNode::removeChild(Node* child, bool cleanup)
return; return;
} }
CCASSERT(_children.contains(sprite), "sprite batch node should contain the child"); AXASSERT(_children.contains(sprite), "sprite batch node should contain the child");
// cleanup before removing // cleanup before removing
removeSpriteFromAtlas(sprite); removeSpriteFromAtlas(sprite);
@ -285,7 +285,7 @@ void SpriteBatchNode::removeChild(Node* child, bool cleanup)
void SpriteBatchNode::removeChildAtIndex(ssize_t index, bool doCleanup) void SpriteBatchNode::removeChildAtIndex(ssize_t index, bool doCleanup)
{ {
CCASSERT(index >= 0 && index < _children.size(), "Invalid index"); AXASSERT(index >= 0 && index < _children.size(), "Invalid index");
removeChild(_children.at(index), doCleanup); removeChild(_children.at(index), doCleanup);
} }
@ -407,7 +407,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, ssize_t* curIndex)
void SpriteBatchNode::swap(ssize_t oldIndex, ssize_t newIndex) void SpriteBatchNode::swap(ssize_t oldIndex, ssize_t newIndex)
{ {
CCASSERT( AXASSERT(
oldIndex >= 0 && oldIndex < (int)_descendants.size() && newIndex >= 0 && newIndex < (int)_descendants.size(), oldIndex >= 0 && oldIndex < (int)_descendants.size() && newIndex >= 0 && newIndex < (int)_descendants.size(),
"Invalid index"); "Invalid index");
@ -458,14 +458,14 @@ void SpriteBatchNode::increaseAtlasCapacity()
// this is likely computationally expensive // this is likely computationally expensive
ssize_t quantity = (_textureAtlas->getCapacity() + 1) * 4 / 3; ssize_t quantity = (_textureAtlas->getCapacity() + 1) * 4 / 3;
CCLOG("cocos2d: SpriteBatchNode: resizing TextureAtlas capacity from [%d] to [%d].", AXLOG("cocos2d: SpriteBatchNode: resizing TextureAtlas capacity from [%d] to [%d].",
static_cast<int>(_textureAtlas->getCapacity()), static_cast<int>(quantity)); static_cast<int>(_textureAtlas->getCapacity()), static_cast<int>(quantity));
if (!_textureAtlas->resizeCapacity(quantity)) if (!_textureAtlas->resizeCapacity(quantity))
{ {
// serious problems // serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas"); AXLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "Not enough memory to resize the atlas"); AXASSERT(false, "Not enough memory to resize the atlas");
} }
} }
@ -477,14 +477,14 @@ void SpriteBatchNode::reserveCapacity(ssize_t newCapacity)
if (!_textureAtlas->resizeCapacity(newCapacity)) if (!_textureAtlas->resizeCapacity(newCapacity))
{ {
// serious problems // serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas"); AXLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "Not enough memory to resize the atlas"); AXASSERT(false, "Not enough memory to resize the atlas");
} }
} }
ssize_t SpriteBatchNode::rebuildIndexInOrder(Sprite* parent, ssize_t index) ssize_t SpriteBatchNode::rebuildIndexInOrder(Sprite* parent, ssize_t index)
{ {
CCASSERT(index >= 0 && index < _children.size(), "Invalid index"); AXASSERT(index >= 0 && index < _children.size(), "Invalid index");
auto& children = parent->getChildren(); auto& children = parent->getChildren();
for (const auto& child : children) for (const auto& child : children)
@ -598,7 +598,7 @@ ssize_t SpriteBatchNode::atlasIndexForChild(Sprite* sprite, int nZ)
} }
// Should not happen. Error calculating Z on SpriteSheet // Should not happen. Error calculating Z on SpriteSheet
CCASSERT(0, "should not run here"); AXASSERT(0, "should not run here");
return 0; return 0;
} }
@ -640,7 +640,7 @@ void SpriteBatchNode::appendChild(Sprite* sprite)
continue; continue;
} }
#endif #endif
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr, AXASSERT(dynamic_cast<Sprite*>(child) != nullptr,
"You can only add Sprites (or subclass of Sprite) to SpriteBatchNode"); "You can only add Sprites (or subclass of Sprite) to SpriteBatchNode");
appendChild(static_cast<Sprite*>(child)); appendChild(static_cast<Sprite*>(child));
++iter; ++iter;
@ -724,8 +724,8 @@ void SpriteBatchNode::setTexture(Texture2D* texture)
void SpriteBatchNode::insertQuadFromSprite(Sprite* sprite, ssize_t index) void SpriteBatchNode::insertQuadFromSprite(Sprite* sprite, ssize_t index)
{ {
CCASSERT(sprite != nullptr, "Argument must be non-nullptr"); AXASSERT(sprite != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<Sprite*>(sprite), "CCSpriteBatchNode only supports Sprites as children"); AXASSERT(dynamic_cast<Sprite*>(sprite), "CCSpriteBatchNode only supports Sprites as children");
// make needed room // make needed room
while (index >= _textureAtlas->getCapacity() || _textureAtlas->getCapacity() == _textureAtlas->getTotalQuads()) while (index >= _textureAtlas->getCapacity() || _textureAtlas->getCapacity() == _textureAtlas->getTotalQuads())
@ -749,8 +749,8 @@ void SpriteBatchNode::insertQuadFromSprite(Sprite* sprite, ssize_t index)
void SpriteBatchNode::updateQuadFromSprite(Sprite* sprite, ssize_t index) void SpriteBatchNode::updateQuadFromSprite(Sprite* sprite, ssize_t index)
{ {
CCASSERT(sprite != nullptr, "Argument must be non-nil"); AXASSERT(sprite != nullptr, "Argument must be non-nil");
CCASSERT(dynamic_cast<Sprite*>(sprite) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); AXASSERT(dynamic_cast<Sprite*>(sprite) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
// make needed room // make needed room
while (index >= _textureAtlas->getCapacity() || _textureAtlas->getCapacity() == _textureAtlas->getTotalQuads()) while (index >= _textureAtlas->getCapacity() || _textureAtlas->getCapacity() == _textureAtlas->getTotalQuads())
@ -772,8 +772,8 @@ void SpriteBatchNode::updateQuadFromSprite(Sprite* sprite, ssize_t index)
SpriteBatchNode* SpriteBatchNode::addSpriteWithoutQuad(Sprite* child, int z, int aTag) SpriteBatchNode* SpriteBatchNode::addSpriteWithoutQuad(Sprite* child, int z, int aTag)
{ {
CCASSERT(child != nullptr, "Argument must be non-nullptr"); AXASSERT(child != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<Sprite*>(child), "CCSpriteBatchNode only supports Sprites as children"); AXASSERT(dynamic_cast<Sprite*>(child), "CCSpriteBatchNode only supports Sprites as children");
// quad index is Z // quad index is Z
child->setAtlasIndex(z); child->setAtlasIndex(z);

View File

@ -152,7 +152,7 @@ bool SpriteFrame::initWithTextureFilename(std::string_view filename,
SpriteFrame::~SpriteFrame() SpriteFrame::~SpriteFrame()
{ {
CCLOGINFO("deallocing SpriteFrame: %p", this); AXLOGINFO("deallocing SpriteFrame: %p", this);
AX_SAFE_RELEASE(_texture); AX_SAFE_RELEASE(_texture);
} }

View File

@ -124,7 +124,7 @@ bool SpriteFrameCache::isSpriteFramesWithFileLoaded(std::string_view plist) cons
void SpriteFrameCache::addSpriteFrame(SpriteFrame* frame, std::string_view frameName) void SpriteFrameCache::addSpriteFrame(SpriteFrame* frame, std::string_view frameName)
{ {
CCASSERT(frame, "frame should not be nil"); AXASSERT(frame, "frame should not be nil");
const std::string name = "by#addSpriteFrame()"; const std::string name = "by#addSpriteFrame()";
auto&& itr = _spriteSheets.find(name); auto&& itr = _spriteSheets.find(name);
@ -158,7 +158,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames()
{ {
toRemoveFrames.push_back(iter.first); toRemoveFrames.push_back(iter.first);
spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame); spriteFrame->getTexture()->removeSpriteFrameCapInset(spriteFrame);
CCLOG("cocos2d: SpriteFrameCache: removing unused frame: %s", iter.first.c_str()); AXLOG("cocos2d: SpriteFrameCache: removing unused frame: %s", iter.first.c_str());
removed = true; removed = true;
} }
} }
@ -184,7 +184,7 @@ void SpriteFrameCache::removeSpriteFramesFromFile(std::string_view atlasPath)
// auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath); // auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
// if (dict.empty()) // if (dict.empty())
//{ //{
// CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFile: create dict by %s fail.",plist.c_str()); // AXLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFile: create dict by %s fail.",plist.c_str());
// return; // return;
// } // }
// removeSpriteFramesFromDictionary(dict); // removeSpriteFramesFromDictionary(dict);
@ -199,7 +199,7 @@ void SpriteFrameCache::removeSpriteFramesFromFileContent(std::string_view plist_
FileUtils::getInstance()->getValueMapFromData(plist_content.data(), static_cast<int>(plist_content.size())); FileUtils::getInstance()->getValueMapFromData(plist_content.data(), static_cast<int>(plist_content.size()));
if (dict.empty()) if (dict.empty())
{ {
CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFileContent: create dict by fail."); AXLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFileContent: create dict by fail.");
return; return;
} }
removeSpriteFramesFromDictionary(dict); removeSpriteFramesFromDictionary(dict);
@ -246,14 +246,14 @@ SpriteFrame* SpriteFrameCache::getSpriteFrameByName(std::string_view name)
auto* frame = findFrame(name); auto* frame = findFrame(name);
if (!frame) if (!frame)
{ {
CCLOG("cocos2d: SpriteFrameCache: Frame '%s' isn't found", name.data()); AXLOG("cocos2d: SpriteFrameCache: Frame '%s' isn't found", name.data());
} }
return frame; return frame;
} }
bool SpriteFrameCache::reloadTexture(std::string_view spriteSheetFileName) bool SpriteFrameCache::reloadTexture(std::string_view spriteSheetFileName)
{ {
CCASSERT(!spriteSheetFileName.empty(), "plist filename should not be nullptr"); AXASSERT(!spriteSheetFileName.empty(), "plist filename should not be nullptr");
const auto spriteSheetItr = _spriteSheets.find(spriteSheetFileName); const auto spriteSheetItr = _spriteSheets.find(spriteSheetFileName);
if (spriteSheetItr == _spriteSheets.end()) if (spriteSheetItr == _spriteSheets.end())

View File

@ -37,7 +37,7 @@ TMXObjectGroup::TMXObjectGroup() : _groupName("") {}
TMXObjectGroup::~TMXObjectGroup() TMXObjectGroup::~TMXObjectGroup()
{ {
CCLOGINFO("deallocing TMXObjectGroup: %p", this); AXLOGINFO("deallocing TMXObjectGroup: %p", this);
} }
ValueMap TMXObjectGroup::getObject(std::string_view objectName) const ValueMap TMXObjectGroup::getObject(std::string_view objectName) const

View File

@ -45,7 +45,7 @@ TMXLayerInfo::TMXLayerInfo() : _name(""), _tiles(nullptr), _ownTiles(true) {}
TMXLayerInfo::~TMXLayerInfo() TMXLayerInfo::~TMXLayerInfo()
{ {
CCLOGINFO("deallocing TMXLayerInfo: %p", this); AXLOGINFO("deallocing TMXLayerInfo: %p", this);
if (_ownTiles && _tiles) if (_ownTiles && _tiles)
{ {
free(_tiles); free(_tiles);
@ -69,7 +69,7 @@ TMXTilesetInfo::TMXTilesetInfo() : _firstGid(0), _tileSize(Vec2::ZERO), _spacing
TMXTilesetInfo::~TMXTilesetInfo() TMXTilesetInfo::~TMXTilesetInfo()
{ {
CCLOGINFO("deallocing TMXTilesetInfo: %p", this); AXLOGINFO("deallocing TMXTilesetInfo: %p", this);
} }
Rect TMXTilesetInfo::getRectForGID(uint32_t gid) Rect TMXTilesetInfo::getRectForGID(uint32_t gid)
@ -168,7 +168,7 @@ TMXMapInfo::TMXMapInfo()
TMXMapInfo::~TMXMapInfo() TMXMapInfo::~TMXMapInfo()
{ {
CCLOGINFO("deallocing TMXMapInfo: %p", this); AXLOGINFO("deallocing TMXMapInfo: %p", this);
} }
bool TMXMapInfo::parseXMLString(std::string_view xmlString) bool TMXMapInfo::parseXMLString(std::string_view xmlString)
@ -221,7 +221,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
if (elementName == "map") if (elementName == "map")
{ {
std::string version = attributeDict["version"].asString(); std::string version = attributeDict["version"].asString();
CCLOG("cocos2d: TMXFormat: TMX version: %s", version.c_str()); AXLOG("cocos2d: TMXFormat: TMX version: %s", version.c_str());
std::string orientationStr = attributeDict["orientation"].asString(); std::string orientationStr = attributeDict["orientation"].asString();
if (orientationStr == "orthogonal") if (orientationStr == "orthogonal")
@ -242,7 +242,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
} }
else else
{ {
CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation()); AXLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
} }
std::string staggerAxisStr = attributeDict["staggeraxis"].asString(); std::string staggerAxisStr = attributeDict["staggeraxis"].asString();
@ -467,7 +467,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
layerAttribs = tmxMapInfo->getLayerAttribs(); layerAttribs = tmxMapInfo->getLayerAttribs();
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribZlib); tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribZlib);
} }
CCASSERT(compression == "" || compression == "gzip" || compression == "zlib", AXASSERT(compression == "" || compression == "gzip" || compression == "zlib",
"TMX: unsupported compression method"); "TMX: unsupported compression method");
} }
else if (encoding == "csv") else if (encoding == "csv")
@ -525,7 +525,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
{ {
if (tmxMapInfo->getParentElement() == TMXPropertyNone) if (tmxMapInfo->getParentElement() == TMXPropertyNone)
{ {
CCLOG("TMX tile map: Parent element is unsupported. Cannot add property named '%s' with value '%s'", AXLOG("TMX tile map: Parent element is unsupported. Cannot add property named '%s' with value '%s'",
attributeDict["name"].asString().c_str(), attributeDict["value"].asString().c_str()); attributeDict["name"].asString().c_str(), attributeDict["value"].asString().c_str());
} }
else if (tmxMapInfo->getParentElement() == TMXPropertyMap) else if (tmxMapInfo->getParentElement() == TMXPropertyMap)
@ -694,7 +694,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char* name)
base64Decode((unsigned char*)currentString.data(), (unsigned int)currentString.length(), &buffer); base64Decode((unsigned char*)currentString.data(), (unsigned int)currentString.length(), &buffer);
if (!buffer) if (!buffer)
{ {
CCLOG("cocos2d: TiledMap: decode data error"); AXLOG("cocos2d: TiledMap: decode data error");
return; return;
} }
@ -706,14 +706,14 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char* name)
ssize_t sizeHint = s.width * s.height * sizeof(unsigned int); ssize_t sizeHint = s.width * s.height * sizeof(unsigned int);
ssize_t AX_UNUSED inflatedLen = ZipUtils::inflateMemoryWithHint(buffer, len, &deflated, sizeHint); ssize_t AX_UNUSED inflatedLen = ZipUtils::inflateMemoryWithHint(buffer, len, &deflated, sizeHint);
CCASSERT(inflatedLen == sizeHint, "inflatedLen should be equal to sizeHint!"); AXASSERT(inflatedLen == sizeHint, "inflatedLen should be equal to sizeHint!");
free(buffer); free(buffer);
buffer = nullptr; buffer = nullptr;
if (!deflated) if (!deflated)
{ {
CCLOG("cocos2d: TiledMap: inflate data error"); AXLOG("cocos2d: TiledMap: inflate data error");
return; return;
} }
@ -753,7 +753,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char* name)
buffer = (unsigned char*)malloc(gidTokens.size() * 4); buffer = (unsigned char*)malloc(gidTokens.size() * 4);
if (!buffer) if (!buffer)
{ {
CCLOG("cocos2d: TiledMap: CSV buffer not allocated."); AXLOG("cocos2d: TiledMap: CSV buffer not allocated.");
return; return;
} }

View File

@ -83,7 +83,7 @@ void TileMapAtlas::releaseMap()
void TileMapAtlas::calculateItemsToRender() void TileMapAtlas::calculateItemsToRender()
{ {
CCASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil"); AXASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil");
_itemsToRender = 0; _itemsToRender = 0;
for (int x = 0; x < _TGAInfo->width; x++) for (int x = 0; x < _TGAInfo->width; x++)
@ -113,7 +113,7 @@ void TileMapAtlas::loadTGAfile(std::string_view file)
#if 1 #if 1
if (_TGAInfo->status != TGA_OK) if (_TGAInfo->status != TGA_OK)
{ {
CCASSERT(0, "TileMapAtlasLoadTGA : TileMapAtlas cannot load TGA file"); AXASSERT(0, "TileMapAtlasLoadTGA : TileMapAtlas cannot load TGA file");
} }
#endif #endif
} }
@ -121,16 +121,16 @@ void TileMapAtlas::loadTGAfile(std::string_view file)
// TileMapAtlas - Atlas generation / updates // TileMapAtlas - Atlas generation / updates
void TileMapAtlas::setTile(const Color3B& tile, const Vec2& position) void TileMapAtlas::setTile(const Color3B& tile, const Vec2& position)
{ {
CCASSERT(_TGAInfo != nullptr, "tgaInfo must not be nil"); AXASSERT(_TGAInfo != nullptr, "tgaInfo must not be nil");
CCASSERT(position.x < _TGAInfo->width, "Invalid position.x"); AXASSERT(position.x < _TGAInfo->width, "Invalid position.x");
CCASSERT(position.y < _TGAInfo->height, "Invalid position.x"); AXASSERT(position.y < _TGAInfo->height, "Invalid position.x");
CCASSERT(tile.r != 0, "R component must be non 0"); AXASSERT(tile.r != 0, "R component must be non 0");
Color3B* ptr = (Color3B*)_TGAInfo->imageData; Color3B* ptr = (Color3B*)_TGAInfo->imageData;
Color3B value = ptr[(unsigned int)(position.x + position.y * _TGAInfo->width)]; Color3B value = ptr[(unsigned int)(position.x + position.y * _TGAInfo->width)];
if (value.r == 0) if (value.r == 0)
{ {
CCLOG("cocos2d: Value.r must be non 0."); AXLOG("cocos2d: Value.r must be non 0.");
} }
else else
{ {
@ -147,9 +147,9 @@ void TileMapAtlas::setTile(const Color3B& tile, const Vec2& position)
Color3B TileMapAtlas::getTileAt(const Vec2& position) const Color3B TileMapAtlas::getTileAt(const Vec2& position) const
{ {
CCASSERT(_TGAInfo != nullptr, "tgaInfo must not be nil"); AXASSERT(_TGAInfo != nullptr, "tgaInfo must not be nil");
CCASSERT(position.x < _TGAInfo->width, "Invalid position.x"); AXASSERT(position.x < _TGAInfo->width, "Invalid position.x");
CCASSERT(position.y < _TGAInfo->height, "Invalid position.y"); AXASSERT(position.y < _TGAInfo->height, "Invalid position.y");
Color3B* ptr = (Color3B*)_TGAInfo->imageData; Color3B* ptr = (Color3B*)_TGAInfo->imageData;
Color3B value = ptr[(unsigned int)(position.x + position.y * _TGAInfo->width)]; Color3B value = ptr[(unsigned int)(position.x + position.y * _TGAInfo->width)];
@ -159,7 +159,7 @@ Color3B TileMapAtlas::getTileAt(const Vec2& position) const
void TileMapAtlas::updateAtlasValueAt(const Vec2& pos, const Color3B& value, int index) void TileMapAtlas::updateAtlasValueAt(const Vec2& pos, const Color3B& value, int index)
{ {
CCASSERT(index >= 0 && index < _textureAtlas->getCapacity(), "updateAtlasValueAt: Invalid index"); AXASSERT(index >= 0 && index < _textureAtlas->getCapacity(), "updateAtlasValueAt: Invalid index");
V3F_C4B_T2F_Quad* quad = &((_textureAtlas->getQuads())[index]); V3F_C4B_T2F_Quad* quad = &((_textureAtlas->getQuads())[index]);
@ -224,7 +224,7 @@ void TileMapAtlas::updateAtlasValueAt(const Vec2& pos, const Color3B& value, int
void TileMapAtlas::updateAtlasValues() void TileMapAtlas::updateAtlasValues()
{ {
CCASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil"); AXASSERT(_TGAInfo != nullptr, "tgaInfo must be non-nil");
int total = 0; int total = 0;

View File

@ -67,7 +67,7 @@ TransitionScene* TransitionScene::create(float t, Scene* scene)
bool TransitionScene::initWithDuration(float t, Scene* scene) bool TransitionScene::initWithDuration(float t, Scene* scene)
{ {
CCASSERT(scene != nullptr, "Argument scene must be non-nil"); AXASSERT(scene != nullptr, "Argument scene must be non-nil");
if (Scene::init()) if (Scene::init())
{ {
@ -93,7 +93,7 @@ bool TransitionScene::initWithDuration(float t, Scene* scene)
} }
_outScene->retain(); _outScene->retain();
CCASSERT(_inScene != _outScene, "Incoming scene must be different from the outgoing scene"); AXASSERT(_inScene != _outScene, "Incoming scene must be different from the outgoing scene");
sceneOrder(); sceneOrder();

View File

@ -117,7 +117,7 @@ void TransitionProgress::setupTransition()
ProgressTimer* TransitionProgress::progressTimerNodeWithRenderTexture(RenderTexture* /*texture*/) ProgressTimer* TransitionProgress::progressTimerNodeWithRenderTexture(RenderTexture* /*texture*/)
{ {
CCASSERT(false, "override me - abstract class"); AXASSERT(false, "override me - abstract class");
return nullptr; return nullptr;
} }

View File

@ -113,7 +113,7 @@ const std::string getAttributeName(const VertexKey& key)
static int max = sizeof(s_attributeNames) / sizeof(s_attributeNames[0]); static int max = sizeof(s_attributeNames) / sizeof(s_attributeNames[0]);
auto idx = static_cast<int>(key); auto idx = static_cast<int>(key);
CCASSERT(idx >= 0 && idx < max, "invalid key "); AXASSERT(idx >= 0 && idx < max, "invalid key ");
return s_attributeNames[idx]; return s_attributeNames[idx];
} }
}; // namespace shaderinfos }; // namespace shaderinfos

View File

@ -224,7 +224,7 @@ void Animate3D::startWithTarget(Node* target)
if (!hasCurve) if (!hasCurve)
{ {
CCLOG("warning: no animation found for the skeleton"); AXLOG("warning: no animation found for the skeleton");
} }
} }
@ -434,7 +434,7 @@ void Animate3D::setSpeed(float speed)
void Animate3D::setWeight(float weight) void Animate3D::setWeight(float weight)
{ {
CCASSERT(weight >= 0.0f, "invalid weight"); AXASSERT(weight >= 0.0f, "invalid weight");
_weight = fabsf(weight); _weight = fabsf(weight);
} }

View File

@ -178,7 +178,7 @@ bool BillBoard::calculateBillboardTransform()
camWorldMat.transformVector(Vec3(0.0f, 0.0f, -1.0f), &camDir); camWorldMat.transformVector(Vec3(0.0f, 0.0f, -1.0f), &camDir);
break; break;
default: default:
CCASSERT(false, "invalid billboard mode"); AXASSERT(false, "invalid billboard mode");
break; break;
} }
_modeDirty = false; _modeDirty = false;

View File

@ -193,7 +193,7 @@ bool Bundle3D::load(std::string_view path)
} }
else else
{ {
CCLOG("warning: %s is invalid file formate", path.data()); AXLOG("warning: %s is invalid file formate", path.data());
} }
ret ? (_path = path) : (_path = ""); ret ? (_path = path) : (_path = "");
@ -329,7 +329,7 @@ bool Bundle3D::loadObj(MeshDatas& meshdatas,
return true; return true;
} }
CCLOG("warning: load %s file error: %s", fullPath.data(), ret.c_str()); AXLOG("warning: load %s file error: %s", fullPath.data(), ret.c_str());
return false; return false;
} }
@ -396,7 +396,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
unsigned int meshSize = 0; unsigned int meshSize = 0;
if (_binaryReader.read(&meshSize, 4, 1) != 1) if (_binaryReader.read(&meshSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
return false; return false;
} }
MeshData* meshData = nullptr; MeshData* meshData = nullptr;
@ -406,7 +406,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
// read mesh data // read mesh data
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1) if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
meshData = new MeshData(); meshData = new MeshData();
@ -418,7 +418,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
unsigned int vSize; unsigned int vSize;
if (_binaryReader.read(&vSize, 4, 1) != 1) if (_binaryReader.read(&vSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
std::string type = _binaryReader.readString(); std::string type = _binaryReader.readString();
@ -430,14 +430,14 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
// Read vertex data // Read vertex data
if (_binaryReader.read(&vertexSizeInFloat, 4, 1) != 1 || vertexSizeInFloat == 0) if (_binaryReader.read(&vertexSizeInFloat, 4, 1) != 1 || vertexSizeInFloat == 0)
{ {
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
meshData->vertex.resize(vertexSizeInFloat); meshData->vertex.resize(vertexSizeInFloat);
if (_binaryReader.read(&meshData->vertex[0], 4, vertexSizeInFloat) != vertexSizeInFloat) if (_binaryReader.read(&meshData->vertex[0], 4, vertexSizeInFloat) != vertexSizeInFloat)
{ {
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
@ -453,13 +453,13 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
unsigned int nIndexCount; unsigned int nIndexCount;
if (_binaryReader.read(&nIndexCount, 4, 1) != 1) if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
indexArray.resize(nIndexCount); indexArray.resize(nIndexCount);
if (_binaryReader.read(indexArray.data(), 2, nIndexCount) != nIndexCount) if (_binaryReader.read(indexArray.data(), 2, nIndexCount) != nIndexCount)
{ {
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
auto& storedIndices = meshData->subMeshIndices.emplace_back(std::move(indexArray)); auto& storedIndices = meshData->subMeshIndices.emplace_back(std::move(indexArray));
@ -472,7 +472,7 @@ bool Bundle3D::loadMeshDatasBinary(MeshDatas& meshdatas)
float aabb[6]; float aabb[6];
if (_binaryReader.read(aabb, 4, 6) != 6) if (_binaryReader.read(aabb, 4, 6) != 6)
{ {
CCLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: aabb '%s'.", _path.c_str());
goto FAILED; goto FAILED;
} }
meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5]))); meshData->subMeshAABB.push_back(AABB(Vec3(aabb[0], aabb[1], aabb[2]), Vec3(aabb[3], aabb[4], aabb[5])));
@ -511,7 +511,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
unsigned int attribSize = 0; unsigned int attribSize = 0;
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1) if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -535,7 +535,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
shaderinfos::VertexKey usage; shaderinfos::VertexKey usage;
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1) if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -564,7 +564,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
} }
else else
{ {
CCASSERT(false, "invalidate usage value"); AXASSERT(false, "invalidate usage value");
} }
meshVertexAttribute.vertexAttrib = usage; meshVertexAttribute.vertexAttrib = usage;
@ -574,7 +574,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
// Read vertex data // Read vertex data
if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0) if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
{ {
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -582,7 +582,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
meshdata->vertex.resize(meshdata->vertexSizeInFloat); meshdata->vertex.resize(meshdata->vertexSizeInFloat);
if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat) if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
{ {
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -594,7 +594,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
unsigned int nIndexCount; unsigned int nIndexCount;
if (_binaryReader.read(&nIndexCount, 4, 1) != 1) if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -603,7 +603,7 @@ bool Bundle3D::loadMeshDatasBinary_0_1(MeshDatas& meshdatas)
indices.resize(nIndexCount); indices.resize(nIndexCount);
if (_binaryReader.read(indices.data(), 2, nIndexCount) != nIndexCount) if (_binaryReader.read(indices.data(), 2, nIndexCount) != nIndexCount)
{ {
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -629,7 +629,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
unsigned int attribSize = 0; unsigned int attribSize = 0;
if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1) if (_binaryReader.read(&attribSize, 4, 1) != 1 || attribSize < 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -653,7 +653,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
shaderinfos::VertexKey usage = shaderinfos::VertexKey::VERTEX_ATTRIB_ERROR; shaderinfos::VertexKey usage = shaderinfos::VertexKey::VERTEX_ATTRIB_ERROR;
if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1) if (_binaryReader.read(&vUsage, 4, 1) != 1 || _binaryReader.read(&vSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: usage or size '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -688,7 +688,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
// Read vertex data // Read vertex data
if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0) if (_binaryReader.read(&meshdata->vertexSizeInFloat, 4, 1) != 1 || meshdata->vertexSizeInFloat == 0)
{ {
CCLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertexSizeInFloat '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -696,7 +696,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
meshdata->vertex.resize(meshdata->vertexSizeInFloat); meshdata->vertex.resize(meshdata->vertexSizeInFloat);
if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat) if (_binaryReader.read(&meshdata->vertex[0], 4, meshdata->vertexSizeInFloat) != meshdata->vertexSizeInFloat)
{ {
CCLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: vertex element '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -705,7 +705,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
unsigned int submeshCount; unsigned int submeshCount;
if (_binaryReader.read(&submeshCount, 4, 1) != 1) if (_binaryReader.read(&submeshCount, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: submeshCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: submeshCount '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -715,7 +715,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
unsigned int nIndexCount; unsigned int nIndexCount;
if (_binaryReader.read(&nIndexCount, 4, 1) != 1) if (_binaryReader.read(&nIndexCount, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: nIndexCount '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -724,7 +724,7 @@ bool Bundle3D::loadMeshDatasBinary_0_2(MeshDatas& meshdatas)
indices.resize(nIndexCount); indices.resize(nIndexCount);
if (_binaryReader.read(indices.data(), 2, nIndexCount) != nIndexCount) if (_binaryReader.read(indices.data(), 2, nIndexCount) != nIndexCount)
{ {
CCLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: indices '%s'.", _path.c_str());
AX_SAFE_DELETE(meshdata); AX_SAFE_DELETE(meshdata);
return false; return false;
} }
@ -943,13 +943,13 @@ bool Bundle3D::loadMaterialsBinary(MaterialDatas& materialdatas)
textureData.id = _binaryReader.readString(); textureData.id = _binaryReader.readString();
if (textureData.id.empty()) if (textureData.id.empty())
{ {
CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", textureData.id.c_str()); AXLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", textureData.id.c_str());
return false; return false;
} }
std::string texturePath = _binaryReader.readString(); std::string texturePath = _binaryReader.readString();
if (texturePath.empty()) if (texturePath.empty())
{ {
CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str()); AXLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
return false; return false;
} }
@ -975,7 +975,7 @@ bool Bundle3D::loadMaterialsBinary_0_1(MaterialDatas& materialdatas)
std::string texturePath = _binaryReader.readString(); std::string texturePath = _binaryReader.readString();
if (texturePath.empty()) if (texturePath.empty())
{ {
CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str()); AXLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
return false; return false;
} }
@ -1003,7 +1003,7 @@ bool Bundle3D::loadMaterialsBinary_0_2(MaterialDatas& materialdatas)
std::string texturePath = _binaryReader.readString(); std::string texturePath = _binaryReader.readString();
if (texturePath.empty()) if (texturePath.empty())
{ {
CCLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str()); AXLOG("warning: Failed to read Materialdata: texturePath is empty '%s'.", _path.c_str());
return true; return true;
} }
@ -1070,7 +1070,7 @@ bool Bundle3D::loadJson(std::string_view path)
if (_jsonReader.ParseInsitu<0>((char*)_jsonBuffer.c_str()).HasParseError()) if (_jsonReader.ParseInsitu<0>((char*)_jsonBuffer.c_str()).HasParseError())
{ {
clear(); clear();
CCLOG("Parse json failed in Bundle3D::loadJson function"); AXLOG("Parse json failed in Bundle3D::loadJson function");
return false; return false;
} }
@ -1093,7 +1093,7 @@ bool Bundle3D::loadBinary(std::string_view path)
if (_binaryBuffer.isNull()) if (_binaryBuffer.isNull())
{ {
clear(); clear();
CCLOG("warning: Failed to read file: %s", path.data()); AXLOG("warning: Failed to read file: %s", path.data());
return false; return false;
} }
@ -1106,7 +1106,7 @@ bool Bundle3D::loadBinary(std::string_view path)
if (_binaryReader.read(sig, 1, 4) != 4 || memcmp(sig, identifier, 4) != 0) if (_binaryReader.read(sig, 1, 4) != 4 || memcmp(sig, identifier, 4) != 0)
{ {
clear(); clear();
CCLOG("warning: Invalid identifier: %s", path.data()); AXLOG("warning: Invalid identifier: %s", path.data());
return false; return false;
} }
@ -1114,7 +1114,7 @@ bool Bundle3D::loadBinary(std::string_view path)
unsigned char ver[2]; unsigned char ver[2];
if (_binaryReader.read(ver, 1, 2) != 2) if (_binaryReader.read(ver, 1, 2) != 2)
{ {
CCLOG("warning: Failed to read version:"); AXLOG("warning: Failed to read version:");
return false; return false;
} }
@ -1126,7 +1126,7 @@ bool Bundle3D::loadBinary(std::string_view path)
if (_binaryReader.read(&_referenceCount, 4, 1) != 1) if (_binaryReader.read(&_referenceCount, 4, 1) != 1)
{ {
clear(); clear();
CCLOG("warning: Failed to read ref table size '%s'.", path.data()); AXLOG("warning: Failed to read ref table size '%s'.", path.data());
return false; return false;
} }
@ -1140,7 +1140,7 @@ bool Bundle3D::loadBinary(std::string_view path)
_binaryReader.read(&_references[i].offset, 4, 1) != 1) _binaryReader.read(&_references[i].offset, 4, 1) != 1)
{ {
clear(); clear();
CCLOG("warning: Failed to read ref number %u for bundle '%s'.", i, path.data()); AXLOG("warning: Failed to read ref number %u for bundle '%s'.", i, path.data());
AX_SAFE_DELETE_ARRAY(_references); AX_SAFE_DELETE_ARRAY(_references);
return false; return false;
} }
@ -1259,7 +1259,7 @@ bool Bundle3D::loadSkinDataJson(SkinData* skindata)
const rapidjson::Value& skin_data_array = _jsonReader[SKIN]; const rapidjson::Value& skin_data_array = _jsonReader[SKIN];
CCASSERT(skin_data_array.IsArray(), "skin data is not an array"); AXASSERT(skin_data_array.IsArray(), "skin data is not an array");
const rapidjson::Value& skin_data_array_val_0 = skin_data_array[(rapidjson::SizeType)0]; const rapidjson::Value& skin_data_array_val_0 = skin_data_array[(rapidjson::SizeType)0];
if (!skin_data_array_val_0.HasMember(BONES)) if (!skin_data_array_val_0.HasMember(BONES))
@ -1301,7 +1301,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
float bindShape[16]; float bindShape[16];
if (!_binaryReader.readMatrix(bindShape)) if (!_binaryReader.readMatrix(bindShape))
{ {
CCLOG("warning: Failed to read SkinData: bindShape matrix '%s'.", _path.c_str()); AXLOG("warning: Failed to read SkinData: bindShape matrix '%s'.", _path.c_str());
return false; return false;
} }
@ -1309,7 +1309,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
unsigned int boneNum; unsigned int boneNum;
if (!_binaryReader.read(&boneNum)) if (!_binaryReader.read(&boneNum))
{ {
CCLOG("warning: Failed to read SkinData: boneNum '%s'.", _path.c_str()); AXLOG("warning: Failed to read SkinData: boneNum '%s'.", _path.c_str());
return false; return false;
} }
@ -1325,7 +1325,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
skindata->skinBoneNames.push_back(skinBoneName); skindata->skinBoneNames.push_back(skinBoneName);
if (!_binaryReader.readMatrix(bindpos)) if (!_binaryReader.readMatrix(bindpos))
{ {
CCLOG("warning: Failed to load SkinData: bindpos '%s'.", _path.c_str()); AXLOG("warning: Failed to load SkinData: bindpos '%s'.", _path.c_str());
return false; return false;
} }
skindata->inverseBindPoseMatrices.push_back(bindpos); skindata->inverseBindPoseMatrices.push_back(bindpos);
@ -1365,7 +1365,7 @@ bool Bundle3D::loadSkinDataBinary(SkinData* skindata)
if (!_binaryReader.readMatrix(transform)) if (!_binaryReader.readMatrix(transform))
{ {
CCLOG("warning: Failed to load SkinData: transform '%s'.", _path.c_str()); AXLOG("warning: Failed to load SkinData: transform '%s'.", _path.c_str());
return false; return false;
} }
@ -1572,7 +1572,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
{ {
if (!_binaryReader.read(&animNum)) if (!_binaryReader.read(&animNum))
{ {
CCLOG("warning: Failed to read AnimationData: animNum '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: animNum '%s'.", _path.c_str());
return false; return false;
} }
} }
@ -1585,14 +1585,14 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
if (!_binaryReader.read(&animationdata->_totalTime)) if (!_binaryReader.read(&animationdata->_totalTime))
{ {
CCLOG("warning: Failed to read AnimationData: totalTime '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: totalTime '%s'.", _path.c_str());
return false; return false;
} }
unsigned int nodeAnimationNum; unsigned int nodeAnimationNum;
if (!_binaryReader.read(&nodeAnimationNum)) if (!_binaryReader.read(&nodeAnimationNum))
{ {
CCLOG("warning: Failed to read AnimationData: animNum '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: animNum '%s'.", _path.c_str());
return false; return false;
} }
for (unsigned int i = 0; i < nodeAnimationNum; ++i) for (unsigned int i = 0; i < nodeAnimationNum; ++i)
@ -1601,7 +1601,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
unsigned int keyframeNum; unsigned int keyframeNum;
if (!_binaryReader.read(&keyframeNum)) if (!_binaryReader.read(&keyframeNum))
{ {
CCLOG("warning: Failed to read AnimationData: keyframeNum '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: keyframeNum '%s'.", _path.c_str());
return false; return false;
} }
@ -1614,7 +1614,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
float keytime; float keytime;
if (!_binaryReader.read(&keytime)) if (!_binaryReader.read(&keytime))
{ {
CCLOG("warning: Failed to read AnimationData: keytime '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: keytime '%s'.", _path.c_str());
return false; return false;
} }
@ -1624,7 +1624,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
{ {
if (!_binaryReader.read(&transformFlag)) if (!_binaryReader.read(&transformFlag))
{ {
CCLOG("warning: Failed to read AnimationData: transformFlag '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: transformFlag '%s'.", _path.c_str());
return false; return false;
} }
} }
@ -1639,7 +1639,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
Quaternion rotate; Quaternion rotate;
if (_binaryReader.read(&rotate, 4, 4) != 4) if (_binaryReader.read(&rotate, 4, 4) != 4)
{ {
CCLOG("warning: Failed to read AnimationData: rotate '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: rotate '%s'.", _path.c_str());
return false; return false;
} }
animationdata->_rotationKeys[boneName].push_back(Animation3DData::QuatKey(keytime, rotate)); animationdata->_rotationKeys[boneName].push_back(Animation3DData::QuatKey(keytime, rotate));
@ -1655,7 +1655,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
Vec3 scale; Vec3 scale;
if (_binaryReader.read(&scale, 4, 3) != 3) if (_binaryReader.read(&scale, 4, 3) != 3)
{ {
CCLOG("warning: Failed to read AnimationData: scale '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: scale '%s'.", _path.c_str());
return false; return false;
} }
animationdata->_scaleKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, scale)); animationdata->_scaleKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, scale));
@ -1671,7 +1671,7 @@ bool Bundle3D::loadAnimationDataBinary(std::string_view id, Animation3DData* ani
Vec3 position; Vec3 position;
if (_binaryReader.read(&position, 4, 3) != 3) if (_binaryReader.read(&position, 4, 3) != 3)
{ {
CCLOG("warning: Failed to read AnimationData: position '%s'.", _path.c_str()); AXLOG("warning: Failed to read AnimationData: position '%s'.", _path.c_str());
return false; return false;
} }
animationdata->_translationKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, position)); animationdata->_translationKeys[boneName].push_back(Animation3DData::Vec3Key(keytime, position));
@ -1748,7 +1748,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo
if (modelnodedata->subMeshId == "" || modelnodedata->materialId == "") if (modelnodedata->subMeshId == "" || modelnodedata->materialId == "")
{ {
CCLOG("warning: Node %s part is missing meshPartId or materialId", nodedata->id.c_str()); AXLOG("warning: Node %s part is missing meshPartId or materialId", nodedata->id.c_str());
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1765,7 +1765,7 @@ NodeData* Bundle3D::parseNodesRecursivelyJson(const rapidjson::Value& jvalue, bo
// node // node
if (!bone.HasMember(NODE)) if (!bone.HasMember(NODE))
{ {
CCLOG("warning: Bone node ID missing"); AXLOG("warning: Bone node ID missing");
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1832,7 +1832,7 @@ bool Bundle3D::loadNodesBinary(NodeDatas& nodedatas)
unsigned int nodeSize = 0; unsigned int nodeSize = 0;
if (_binaryReader.read(&nodeSize, 4, 1) != 1) if (_binaryReader.read(&nodeSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read nodes"); AXLOG("warning: Failed to read nodes");
return false; return false;
} }
@ -1857,7 +1857,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
bool skeleton_; bool skeleton_;
if (_binaryReader.read(&skeleton_, 1, 1) != 1) if (_binaryReader.read(&skeleton_, 1, 1) != 1)
{ {
CCLOG("warning: Failed to read is skeleton"); AXLOG("warning: Failed to read is skeleton");
return nullptr; return nullptr;
} }
if (skeleton_) if (skeleton_)
@ -1867,14 +1867,14 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
Mat4 transform; Mat4 transform;
if (!_binaryReader.readMatrix(transform.m)) if (!_binaryReader.readMatrix(transform.m))
{ {
CCLOG("warning: Failed to read transform matrix"); AXLOG("warning: Failed to read transform matrix");
return nullptr; return nullptr;
} }
// parts // parts
unsigned int partsSize = 0; unsigned int partsSize = 0;
if (_binaryReader.read(&partsSize, 4, 1) != 1) if (_binaryReader.read(&partsSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
return nullptr; return nullptr;
} }
@ -1893,7 +1893,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
if (modelnodedata->subMeshId.empty() || modelnodedata->materialId.empty()) if (modelnodedata->subMeshId.empty() || modelnodedata->materialId.empty())
{ {
CCLOG("Node %s part is missing meshPartId or materialId", nodedata->id.c_str()); AXLOG("Node %s part is missing meshPartId or materialId", nodedata->id.c_str());
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1903,7 +1903,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
unsigned int bonesSize = 0; unsigned int bonesSize = 0;
if (_binaryReader.read(&bonesSize, 4, 1) != 1) if (_binaryReader.read(&bonesSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1931,7 +1931,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
unsigned int uvMapping = 0; unsigned int uvMapping = 0;
if (_binaryReader.read(&uvMapping, 4, 1) != 1) if (_binaryReader.read(&uvMapping, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read nodedata: uvMapping '%s'.", _path.c_str()); AXLOG("warning: Failed to read nodedata: uvMapping '%s'.", _path.c_str());
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1941,7 +1941,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
unsigned int textureIndexSize = 0; unsigned int textureIndexSize = 0;
if (_binaryReader.read(&textureIndexSize, 4, 1) != 1) if (_binaryReader.read(&textureIndexSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
AX_SAFE_DELETE(modelnodedata); AX_SAFE_DELETE(modelnodedata);
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
@ -1982,7 +1982,7 @@ NodeData* Bundle3D::parseNodesRecursivelyBinary(bool& skeleton, bool singleSprit
unsigned int childrenSize = 0; unsigned int childrenSize = 0;
if (_binaryReader.read(&childrenSize, 4, 1) != 1) if (_binaryReader.read(&childrenSize, 4, 1) != 1)
{ {
CCLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str()); AXLOG("warning: Failed to read meshdata: attribCount '%s'.", _path.c_str());
AX_SAFE_DELETE(nodedata); AX_SAFE_DELETE(nodedata);
return nullptr; return nullptr;
} }
@ -2007,7 +2007,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::UBYTE4; return backend::VertexFormat::UBYTE4;
default: default:
CCLOGERROR("parseVertexType GL_BYTE x %d error", size); AXLOGERROR("parseVertexType GL_BYTE x %d error", size);
} }
} }
else if (str == "GL_UNSIGNED_BYTE") else if (str == "GL_UNSIGNED_BYTE")
@ -2017,7 +2017,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::UBYTE4; return backend::VertexFormat::UBYTE4;
default: default:
CCLOGERROR("parseVertexType GL_UNSIGNED_BYTE x %d error", size); AXLOGERROR("parseVertexType GL_UNSIGNED_BYTE x %d error", size);
} }
} }
else if (str == "GL_SHORT") else if (str == "GL_SHORT")
@ -2029,7 +2029,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::USHORT4; return backend::VertexFormat::USHORT4;
default: default:
CCLOGERROR("parseVertexType GL_SHORT x %d error", size); AXLOGERROR("parseVertexType GL_SHORT x %d error", size);
} }
} }
else if (str == "GL_UNSIGNED_SHORT") else if (str == "GL_UNSIGNED_SHORT")
@ -2041,7 +2041,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::USHORT4; return backend::VertexFormat::USHORT4;
default: default:
CCLOGERROR("parseVertexType GL_UNSIGNED_SHORT x %d error", size); AXLOGERROR("parseVertexType GL_UNSIGNED_SHORT x %d error", size);
} }
} }
else if (str == "GL_INT") else if (str == "GL_INT")
@ -2057,7 +2057,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::INT4; return backend::VertexFormat::INT4;
default: default:
CCLOGERROR("parseVertexType GL_INT x %d error", size); AXLOGERROR("parseVertexType GL_INT x %d error", size);
} }
} }
else if (str == "GL_UNSIGNED_INT") else if (str == "GL_UNSIGNED_INT")
@ -2073,7 +2073,7 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::INT4; return backend::VertexFormat::INT4;
default: default:
CCLOGERROR("parseVertexType GL_UNSIGNED_INT x %d error", size); AXLOGERROR("parseVertexType GL_UNSIGNED_INT x %d error", size);
} }
} }
else if (str == "GL_FLOAT") else if (str == "GL_FLOAT")
@ -2089,10 +2089,10 @@ backend::VertexFormat Bundle3D::parseGLDataType(std::string_view str, int size)
case 4: case 4:
return backend::VertexFormat::FLOAT4; return backend::VertexFormat::FLOAT4;
default: default:
CCLOGERROR("parseVertexType GL_UNSIGNED_INT x %d error", size); AXLOGERROR("parseVertexType GL_UNSIGNED_INT x %d error", size);
} }
} }
CCASSERT(false, "parseVertexType failed!"); AXASSERT(false, "parseVertexType failed!");
return ret; return ret;
} }
@ -2109,7 +2109,7 @@ backend::SamplerAddressMode Bundle3D::parseSamplerAddressMode(std::string_view s
} }
else else
{ {
CCASSERT(false, "Invalid GL type"); AXASSERT(false, "Invalid GL type");
return backend::SamplerAddressMode::REPEAT; return backend::SamplerAddressMode::REPEAT;
} }
} }
@ -2158,7 +2158,7 @@ NTextureData::Usage Bundle3D::parseGLTextureType(std::string_view str)
} }
else else
{ {
CCASSERT(false, "Wrong Texture type"); AXASSERT(false, "Wrong Texture type");
return NTextureData::Usage::Unknown; return NTextureData::Usage::Unknown;
} }
} }
@ -2227,7 +2227,7 @@ shaderinfos::VertexKey Bundle3D::parseGLProgramAttribute(std::string_view str)
} }
else else
{ {
CCASSERT(false, "Wrong Attribute type"); AXASSERT(false, "Wrong Attribute type");
return shaderinfos::VertexKey::VERTEX_ATTRIB_ERROR; return shaderinfos::VertexKey::VERTEX_ATTRIB_ERROR;
} }
} }
@ -2256,7 +2256,7 @@ Reference* Bundle3D::seekToFirstType(unsigned int type, std::string_view id)
// Found a match // Found a match
if (_binaryReader.seek(ref->offset, SEEK_SET) == false) if (_binaryReader.seek(ref->offset, SEEK_SET) == false)
{ {
CCLOG("warning: Failed to seek to object '%s' in bundle '%s'.", ref->id.c_str(), _path.c_str()); AXLOG("warning: Failed to seek to object '%s' in bundle '%s'.", ref->id.c_str(), _path.c_str());
return nullptr; return nullptr;
} }
return ref; return ref;

View File

@ -23,7 +23,7 @@ int MeshVertexAttrib::getAttribSizeBytes() const
case backend::VertexFormat::USHORT2: case backend::VertexFormat::USHORT2:
return 4; return 4;
default: default:
CCASSERT(false, "VertexFormat convert to size error"); AXASSERT(false, "VertexFormat convert to size error");
} }
return ret; return ret;
} }

View File

@ -50,7 +50,7 @@ ssize_t BundleReader::read(void* ptr, ssize_t size, ssize_t count)
{ {
if (!_buffer || eof()) if (!_buffer || eof())
{ {
CCLOG("warning: bundle reader out of range"); AXLOG("warning: bundle reader out of range");
return 0; return 0;
} }
@ -72,7 +72,7 @@ ssize_t BundleReader::read(void* ptr, ssize_t size, ssize_t count)
_position += readLength; _position += readLength;
validCount += 1; validCount += 1;
} }
CCLOG("warning: bundle reader out of range"); AXLOG("warning: bundle reader out of range");
} }
else else
{ {

View File

@ -188,7 +188,7 @@ inline bool BundleReader::read<char>(char* ptr)
template <> template <>
inline bool BundleReader::read<std::string>(std::string* /*ptr*/) inline bool BundleReader::read<std::string>(std::string* /*ptr*/)
{ {
CCLOG("can not read std::string, use readString() instead"); AXLOG("can not read std::string, use readString() instead");
return false; return false;
} }

View File

@ -349,7 +349,7 @@ void Mesh::setMaterial(Material* material)
int i = 0; int i = 0;
for (auto pass : technique->getPasses()) for (auto pass : technique->getPasses())
{ {
#ifdef COCOS2D_DEBUG #ifdef AXIS_DEBUG
// make it crashed when missing attribute data // make it crashed when missing attribute data
if (_material->getTechnique()->getName().compare(technique->getName()) == 0) if (_material->getTechnique()->getName().compare(technique->getName()) == 0)
{ {
@ -357,7 +357,7 @@ void Mesh::setMaterial(Material* material)
auto attributes = program->getActiveAttributes(); auto attributes = program->getActiveAttributes();
auto meshVertexData = _meshIndexData->getMeshVertexData(); auto meshVertexData = _meshIndexData->getMeshVertexData();
auto attributeCount = meshVertexData->getMeshVertexAttribCount(); auto attributeCount = meshVertexData->getMeshVertexAttribCount();
CCASSERT(attributes.size() <= attributeCount, "missing attribute data"); AXASSERT(attributes.size() <= attributeCount, "missing attribute data");
} }
#endif #endif
// TODO // TODO
@ -534,8 +534,8 @@ void Mesh::bindMeshCommand()
void Mesh::setLightUniforms(Pass* pass, Scene* scene, const Vec4& color, unsigned int lightmask) void Mesh::setLightUniforms(Pass* pass, Scene* scene, const Vec4& color, unsigned int lightmask)
{ {
CCASSERT(pass, "Invalid Pass"); AXASSERT(pass, "Invalid Pass");
CCASSERT(scene, "Invalid scene"); AXASSERT(scene, "Invalid scene");
const auto& conf = Configuration::getInstance(); const auto& conf = Configuration::getInstance();
int maxDirLight = conf->getMaxSupportDirLightInShader(); int maxDirLight = conf->getMaxSupportDirLightInShader();

View File

@ -235,7 +235,7 @@ MeshMaterial* MeshMaterial::createBuiltInMaterial(MaterialType type, bool skinne
break; break;
case MeshMaterial::MaterialType::VERTEX_LIT: case MeshMaterial::MaterialType::VERTEX_LIT:
CCASSERT(0, "not implemented"); AXASSERT(0, "not implemented");
break; break;
case MeshMaterial::MaterialType::DIFFUSE: case MeshMaterial::MaterialType::DIFFUSE:
@ -291,7 +291,7 @@ MeshMaterial* MeshMaterial::createWithFilename(std::string_view path)
MeshMaterial* MeshMaterial::createWithProgramState(backend::ProgramState* programState) MeshMaterial* MeshMaterial::createWithProgramState(backend::ProgramState* programState)
{ {
CCASSERT(programState, "Invalid program state."); AXASSERT(programState, "Invalid program state.");
auto mat = new MeshMaterial(); auto mat = new MeshMaterial();
if (mat->initWithProgramState(programState)) if (mat->initWithProgramState(programState))
@ -377,7 +377,7 @@ void MeshMaterialCache::removeUnusedMeshMaterial()
auto value = it->second; auto value = it->second;
if (value->getReferenceCount() == 1) if (value->getReferenceCount() == 1)
{ {
CCLOG("cocos2d: MeshMaterialCache: removing unused mesh renderer materials."); AXLOG("cocos2d: MeshMaterialCache: removing unused mesh renderer materials.");
value->release(); value->release();
it = _materials.erase(it); it = _materials.erase(it);

View File

@ -64,7 +64,7 @@ MeshRenderer* MeshRenderer::create()
MeshRenderer* MeshRenderer::create(std::string_view modelPath) MeshRenderer* MeshRenderer::create(std::string_view modelPath)
{ {
CCASSERT(modelPath.length() >= 4, "Invalid filename."); AXASSERT(modelPath.length() >= 4, "Invalid filename.");
auto mesh = new MeshRenderer(); auto mesh = new MeshRenderer();
if (mesh->initWithFile(modelPath)) if (mesh->initWithFile(modelPath))
@ -176,7 +176,7 @@ void MeshRenderer::afterAsyncLoad(void* param)
} }
else else
{ {
CCLOG("file load failed: %s\n", asyncParam->modelPath.c_str()); AXLOG("file load failed: %s\n", asyncParam->modelPath.c_str());
} }
asyncParam->afterLoadCallback(this, asyncParam->callbackParam); asyncParam->afterLoadCallback(this, asyncParam->callbackParam);
} }
@ -472,8 +472,8 @@ void MeshRenderer::setMaterial(Material* material)
void MeshRenderer::setMaterial(Material* material, int meshIndex) void MeshRenderer::setMaterial(Material* material, int meshIndex)
{ {
CCASSERT(material, "Invalid Material"); AXASSERT(material, "Invalid Material");
CCASSERT(meshIndex == -1 || (meshIndex >= 0 && meshIndex < _meshes.size()), "Invalid meshIndex."); AXASSERT(meshIndex == -1 || (meshIndex >= 0 && meshIndex < _meshes.size()), "Invalid meshIndex.");
if (meshIndex == -1) if (meshIndex == -1)
{ {
@ -493,7 +493,7 @@ void MeshRenderer::setMaterial(Material* material, int meshIndex)
Material* MeshRenderer::getMaterial(int meshIndex) const Material* MeshRenderer::getMaterial(int meshIndex) const
{ {
CCASSERT(meshIndex >= 0 && meshIndex < _meshes.size(), "Invalid meshIndex."); AXASSERT(meshIndex >= 0 && meshIndex < _meshes.size(), "Invalid meshIndex.");
return _meshes.at(meshIndex)->getMaterial(); return _meshes.at(meshIndex)->getMaterial();
} }
@ -505,7 +505,7 @@ void MeshRenderer::genMaterial(bool useLight)
for (auto meshVertexData : _meshVertexDatas) for (auto meshVertexData : _meshVertexDatas)
{ {
auto material = getMeshRendererMaterialForAttribs(meshVertexData, useLight); auto material = getMeshRendererMaterialForAttribs(meshVertexData, useLight);
CCASSERT(material, "material should cannot be null."); AXASSERT(material, "material should cannot be null.");
materials[meshVertexData] = material; materials[meshVertexData] = material;
} }
@ -911,7 +911,7 @@ void MeshRenderer::setCullFaceEnabled(bool enable)
Mesh* MeshRenderer::getMeshByIndex(int index) const Mesh* MeshRenderer::getMeshByIndex(int index) const
{ {
CCASSERT(index < _meshes.size(), "Invalid index."); AXASSERT(index < _meshes.size(), "Invalid index.");
return _meshes.at(index); return _meshes.at(index);
} }

View File

@ -47,7 +47,7 @@ MeshSkin* MeshSkin::create(Skeleton3D* skeleton,
skin->_skeleton = skeleton; skin->_skeleton = skeleton;
skeleton->retain(); skeleton->retain();
CCASSERT(boneNames.size() == invBindPose.size(), "bone names' num should equals to invBindPose's num"); AXASSERT(boneNames.size() == invBindPose.size(), "bone names' num should equals to invBindPose's num");
for (const auto& it : boneNames) for (const auto& it : boneNames)
{ {
auto bone = skeleton->getBoneByName(it); auto bone = skeleton->getBoneByName(it);

View File

@ -89,7 +89,7 @@ MotionStreak3D* MotionStreak3D::create(float fade, float minSeg, float stroke, c
bool MotionStreak3D::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path) bool MotionStreak3D::initWithFade(float fade, float minSeg, float stroke, const Color3B& color, std::string_view path)
{ {
CCASSERT(!path.empty(), "Invalid filename"); AXASSERT(!path.empty(), "Invalid filename");
Texture2D* texture = _director->getTextureCache()->addImage(path); Texture2D* texture = _director->getTextureCache()->addImage(path);
return initWithFade(fade, minSeg, stroke, color, texture); return initWithFade(fade, minSeg, stroke, color, texture);
@ -293,12 +293,12 @@ const BlendFunc& MotionStreak3D::getBlendFunc() const
void MotionStreak3D::setOpacity(uint8_t /*opacity*/) void MotionStreak3D::setOpacity(uint8_t /*opacity*/)
{ {
CCASSERT(false, "Set opacity no supported"); AXASSERT(false, "Set opacity no supported");
} }
uint8_t MotionStreak3D::getOpacity() const uint8_t MotionStreak3D::getOpacity() const
{ {
CCASSERT(false, "Opacity no supported"); AXASSERT(false, "Opacity no supported");
return 0; return 0;
} }

View File

@ -374,7 +374,7 @@ Vec3 OBB::getEdgeDirection(int index) const
tmpLine.normalize(); tmpLine.normalize();
break; break;
default: default:
CCASSERT(0, "Invalid index!"); AXASSERT(0, "Invalid index!");
break; break;
} }
return tmpLine; return tmpLine;
@ -407,7 +407,7 @@ Vec3 OBB::getFaceDirection(int index) const
faceDirection.normalize(); faceDirection.normalize();
break; break;
default: default:
CCASSERT(0, "Invalid index!"); AXASSERT(0, "Invalid index!");
break; break;
} }
return faceDirection; return faceDirection;

View File

@ -167,7 +167,7 @@ void Skybox::draw(Renderer* renderer, const Mat4& transform, uint32_t flags)
void Skybox::setTexture(TextureCube* texture) void Skybox::setTexture(TextureCube* texture)
{ {
CCASSERT(texture != nullptr, __FUNCTION__); AXASSERT(texture != nullptr, __FUNCTION__);
AX_SAFE_RELEASE_NULL(_texture); AX_SAFE_RELEASE_NULL(_texture);
texture->retain(); texture->retain();
_texture = texture; _texture = texture;

View File

@ -246,7 +246,7 @@ bool Terrain::initHeightMap(std::string_view heightMap)
} }
else else
{ {
CCLOG("warning: the height map size is not POT or POT + 1"); AXLOG("warning: the height map size is not POT or POT + 1");
return false; return false;
} }
} }
@ -267,7 +267,7 @@ Terrain::Terrain()
#ifdef AX_USE_METAL #ifdef AX_USE_METAL
auto image = new Image(); auto image = new Image();
bool AX_UNUSED isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8); bool AX_UNUSED isOK = image->initWithRawData(cc_2x2_white_image, sizeof(cc_2x2_white_image), 2, 2, 8);
CCASSERT(isOK, "The 2x2 empty texture was created unsuccessfully."); AXASSERT(isOK, "The 2x2 empty texture was created unsuccessfully.");
_dummyTexture = new Texture2D(); _dummyTexture = new Texture2D();
_dummyTexture->initWithImage(image); _dummyTexture->initWithImage(image);
AX_SAFE_RELEASE(image); AX_SAFE_RELEASE(image);
@ -683,7 +683,7 @@ void Terrain::setDetailMap(unsigned int index, DetailMap detailMap)
{ {
if (index > 4) if (index > 4)
{ {
CCLOG("invalid DetailMap index %d\n", index); AXLOG("invalid DetailMap index %d\n", index);
} }
_terrainData._detailMaps[index] = detailMap; _terrainData._detailMaps[index] = detailMap;
if (_detailMapTextures[index]) if (_detailMapTextures[index])
@ -971,7 +971,7 @@ void Terrain::Chunk::bindAndDraw()
} }
auto* renderer = Director::getInstance()->getRenderer(); auto* renderer = Director::getInstance()->getRenderer();
CCASSERT(_buffer && _chunkIndices._indexBuffer, "buffer should not be nullptr"); AXASSERT(_buffer && _chunkIndices._indexBuffer, "buffer should not be nullptr");
_command.setIndexBuffer(_chunkIndices._indexBuffer, backend::IndexFormat::U_SHORT); _command.setIndexBuffer(_chunkIndices._indexBuffer, backend::IndexFormat::U_SHORT);
_command.setVertexBuffer(_buffer); _command.setVertexBuffer(_buffer);
_command.getPipelineDescriptor().programState = _terrain->_programState; _command.getPipelineDescriptor().programState = _terrain->_programState;

View File

@ -50,7 +50,7 @@ VertexAttribBinding::~VertexAttribBinding()
VertexAttribBinding* VertexAttribBinding::create(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command) VertexAttribBinding* VertexAttribBinding::create(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command)
{ {
CCASSERT(meshIndexData && pass && pass->getProgramState(), "Invalid MeshIndexData and/or programState"); AXASSERT(meshIndexData && pass && pass->getProgramState(), "Invalid MeshIndexData and/or programState");
// Search for an existing vertex attribute binding that can be used. // Search for an existing vertex attribute binding that can be used.
VertexAttribBinding* b; VertexAttribBinding* b;
@ -78,7 +78,7 @@ VertexAttribBinding* VertexAttribBinding::create(MeshIndexData* meshIndexData, P
bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command) bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCommand* command)
{ {
CCASSERT(meshIndexData && pass && pass->getProgramState(), "Invalid arguments"); AXASSERT(meshIndexData && pass && pass->getProgramState(), "Invalid arguments");
auto programState = pass->getProgramState(); auto programState = pass->getProgramState();
@ -105,7 +105,7 @@ bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCom
_vertexLayout->setLayout(offset); _vertexLayout->setLayout(offset);
CCASSERT(offset == meshVertexData->getSizePerVertex(), "vertex layout mismatch!"); AXASSERT(offset == meshVertexData->getSizePerVertex(), "vertex layout mismatch!");
return true; return true;
} }
@ -117,7 +117,7 @@ uint32_t VertexAttribBinding::getVertexAttribsFlags() const
void VertexAttribBinding::parseAttributes() void VertexAttribBinding::parseAttributes()
{ {
CCASSERT(_programState, "invalid glprogram"); AXASSERT(_programState, "invalid glprogram");
_attributes.clear(); _attributes.clear();
_vertexAttribsFlags = 0; _vertexAttribsFlags = 0;
@ -149,13 +149,13 @@ void VertexAttribBinding::setVertexAttribPointer(std::string_view name,
auto v = getVertexAttribValue(name); auto v = getVertexAttribValue(name);
if (v) if (v)
{ {
// CCLOG("cocos2d: set attribute '%s' location: %d, offset: %d", name.c_str(), v->location, offset); // AXLOG("cocos2d: set attribute '%s' location: %d, offset: %d", name.c_str(), v->location, offset);
_vertexLayout->setAttribute(name, v->location, type, offset, normalized); _vertexLayout->setAttribute(name, v->location, type, offset, normalized);
_vertexAttribsFlags |= flag; _vertexAttribsFlags |= flag;
} }
else else
{ {
// CCLOG("cocos2d: warning: Attribute not found: %s", name.c_str()); // AXLOG("cocos2d: warning: Attribute not found: %s", name.c_str());
} }
} }

View File

@ -37,7 +37,7 @@
#define QUOTEME_(x) #x #define QUOTEME_(x) #x
#define QUOTEME(x) QUOTEME_(x) #define QUOTEME(x) QUOTEME_(x)
// log, CCLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output // log, AXLOG aren't threadsafe, since we uses sub threads for parsing pcm data, threadsafe log output
// is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output. // is needed. Define the following macros (ALOGV, ALOGD, ALOGI, ALOGW, ALOGE) for threadsafe log output.
#if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32 #if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32
# include "base/ccUTF8.h" // for StringUtils::format # include "base/ccUTF8.h" // for StringUtils::format
@ -49,7 +49,7 @@
# define AUDIO_LOG(fmt, ...) printf(fmt "\n", ##__VA_ARGS__) # define AUDIO_LOG(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#endif #endif
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 #if defined(AXIS_DEBUG) && AXIS_DEBUG > 0
# define ALOGV(fmt, ...) AUDIO_LOG("V/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__) # define ALOGV(fmt, ...) AUDIO_LOG("V/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__)
#else #else
# define ALOGV(fmt, ...) \ # define ALOGV(fmt, ...) \
@ -62,7 +62,7 @@
#define ALOGW(fmt, ...) AUDIO_LOG("W/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__) #define ALOGW(fmt, ...) AUDIO_LOG("W/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__)
#define ALOGE(fmt, ...) AUDIO_LOG("E/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__) #define ALOGE(fmt, ...) AUDIO_LOG("E/" LOG_TAG " (" QUOTEME(__LINE__) "): " fmt "", ##__VA_ARGS__)
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0 #if defined(AXIS_DEBUG) && AXIS_DEBUG > 0
# define CHECK_AL_ERROR_DEBUG() \ # define CHECK_AL_ERROR_DEBUG() \
do \ do \
{ \ { \

View File

@ -30,7 +30,7 @@ NS_AX_BEGIN
AutoreleasePool::AutoreleasePool() AutoreleasePool::AutoreleasePool()
: _name("") : _name("")
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
, _isClearing(false) , _isClearing(false)
#endif #endif
{ {
@ -40,7 +40,7 @@ AutoreleasePool::AutoreleasePool()
AutoreleasePool::AutoreleasePool(std::string_view name) AutoreleasePool::AutoreleasePool(std::string_view name)
: _name(name) : _name(name)
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
, _isClearing(false) , _isClearing(false)
#endif #endif
{ {
@ -50,7 +50,7 @@ AutoreleasePool::AutoreleasePool(std::string_view name)
AutoreleasePool::~AutoreleasePool() AutoreleasePool::~AutoreleasePool()
{ {
CCLOGINFO("deallocing AutoreleasePool: %p", this); AXLOGINFO("deallocing AutoreleasePool: %p", this);
clear(); clear();
PoolManager::getInstance()->pop(); PoolManager::getInstance()->pop();
@ -63,7 +63,7 @@ void AutoreleasePool::addObject(Ref* object)
void AutoreleasePool::clear() void AutoreleasePool::clear()
{ {
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
_isClearing = true; _isClearing = true;
#endif #endif
std::vector<Ref*> releasings; std::vector<Ref*> releasings;
@ -72,7 +72,7 @@ void AutoreleasePool::clear()
{ {
obj->release(); obj->release();
} }
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
_isClearing = false; _isClearing = false;
#endif #endif
} }
@ -89,12 +89,12 @@ bool AutoreleasePool::contains(Ref* object) const
void AutoreleasePool::dump() void AutoreleasePool::dump()
{ {
CCLOG("autorelease pool: %s, number of managed object %d\n", _name.c_str(), AXLOG("autorelease pool: %s, number of managed object %d\n", _name.c_str(),
static_cast<int>(_managedObjectArray.size())); static_cast<int>(_managedObjectArray.size()));
CCLOG("%20s%20s%20s", "Object pointer", "Object id", "reference count"); AXLOG("%20s%20s%20s", "Object pointer", "Object id", "reference count");
for (const auto& obj : _managedObjectArray) for (const auto& obj : _managedObjectArray)
{ {
CCLOG("%20p%20u\n", obj, obj->getReferenceCount()); AXLOG("%20p%20u\n", obj, obj->getReferenceCount());
} }
} }
@ -130,7 +130,7 @@ PoolManager::PoolManager()
PoolManager::~PoolManager() PoolManager::~PoolManager()
{ {
CCLOGINFO("deallocing PoolManager: %p", this); AXLOGINFO("deallocing PoolManager: %p", this);
while (!_releasePoolStack.empty()) while (!_releasePoolStack.empty())
{ {

View File

@ -89,7 +89,7 @@ public:
*/ */
void clear(); void clear();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
/** /**
* Whether the autorelease pool is doing `clear` operation. * Whether the autorelease pool is doing `clear` operation.
* *
@ -135,7 +135,7 @@ private:
std::vector<Ref*> _managedObjectArray; std::vector<Ref*> _managedObjectArray;
std::string _name; std::string _name;
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
/** /**
* The flag for checking whether the pool is doing `clear` operation. * The flag for checking whether the pool is doing `clear` operation.
*/ */

View File

@ -80,7 +80,7 @@ bool Configuration::init()
_valueDict["axis.compiled_with_gl_state_cache"] = Value(true); _valueDict["axis.compiled_with_gl_state_cache"] = Value(true);
#endif #endif
#if COCOS2D_DEBUG #if AXIS_DEBUG
_valueDict["axis.build_type"] = Value("DEBUG"); _valueDict["axis.build_type"] = Value("DEBUG");
#else #else
_valueDict["axis.build_type"] = Value("RELEASE"); _valueDict["axis.build_type"] = Value("RELEASE");
@ -98,13 +98,13 @@ std::string Configuration::getInfo() const
{ {
// And Dump some warnings as well // And Dump some warnings as well
#if AX_ENABLE_PROFILERS #if AX_ENABLE_PROFILERS
CCLOG( AXLOG(
"cocos2d: **** WARNING **** AX_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from " "cocos2d: **** WARNING **** AX_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from "
"ccConfig.h)\n"); "ccConfig.h)\n");
#endif #endif
#if AX_ENABLE_GL_STATE_CACHE == 0 #if AX_ENABLE_GL_STATE_CACHE == 0
CCLOG( AXLOG(
"cocos2d: **** WARNING **** AX_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it (from " "cocos2d: **** WARNING **** AX_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it (from "
"ccConfig.h)\n"); "ccConfig.h)\n");
#endif #endif
@ -117,7 +117,7 @@ std::string Configuration::getInfo() const
void Configuration::gatherGPUInfo() void Configuration::gatherGPUInfo()
{ {
auto _deviceInfo = backend::Device::getInstance()->getDeviceInfo(); auto _deviceInfo = backend::Device::getInstance()->getDeviceInfo();
CCLOG("Supported extensions: %s", _deviceInfo->getExtension()); AXLOG("Supported extensions: %s", _deviceInfo->getExtension());
_valueDict["vendor"] = Value(_deviceInfo->getVendor()); _valueDict["vendor"] = Value(_deviceInfo->getVendor());
_valueDict["renderer"] = Value(_deviceInfo->getRenderer()); _valueDict["renderer"] = Value(_deviceInfo->getRenderer());
@ -335,7 +335,7 @@ void Configuration::setValue(std::string_view key, const Value& value)
void Configuration::loadConfigFile(std::string_view filename) void Configuration::loadConfigFile(std::string_view filename)
{ {
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(filename); ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(filename);
CCASSERT(!dict.empty(), "cannot create dictionary"); AXASSERT(!dict.empty(), "cannot create dictionary");
// search for metadata // search for metadata
bool validMetadata = false; bool validMetadata = false;
@ -360,14 +360,14 @@ void Configuration::loadConfigFile(std::string_view filename)
if (!validMetadata) if (!validMetadata)
{ {
CCLOG("Invalid config format for file: %s", filename.data()); AXLOG("Invalid config format for file: %s", filename.data());
return; return;
} }
auto dataIter = dict.find("data"); auto dataIter = dict.find("data");
if (dataIter == dict.cend() || dataIter->second.getType() != Value::Type::MAP) if (dataIter == dict.cend() || dataIter->second.getType() != Value::Type::MAP)
{ {
CCLOG("Expected 'data' dict, but not found. Config file: %s", filename.data()); AXLOG("Expected 'data' dict, but not found. Config file: %s", filename.data());
return; return;
} }
@ -379,7 +379,7 @@ void Configuration::loadConfigFile(std::string_view filename)
if (_valueDict.find(dataMapIter.first) == _valueDict.cend()) if (_valueDict.find(dataMapIter.first) == _valueDict.cend())
_valueDict[dataMapIter.first] = dataMapIter.second; _valueDict[dataMapIter.first] = dataMapIter.second;
else else
CCLOG("Key already present. Ignoring '%s'", dataMapIter.first.c_str()); AXLOG("Key already present. Ignoring '%s'", dataMapIter.first.c_str());
} }
// light info // light info

View File

@ -105,10 +105,10 @@ const char* inet_ntop(int af, const void* src, char* dst, int cnt)
#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) #if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32)
void SendLogToWindow(const char* log) void SendLogToWindow(const char* log)
{ {
static const int CCLOG_STRING_TAG = 1; static const int AXLOG_STRING_TAG = 1;
// Send data as a message // Send data as a message
COPYDATASTRUCT myCDS; COPYDATASTRUCT myCDS;
myCDS.dwData = CCLOG_STRING_TAG; myCDS.dwData = AXLOG_STRING_TAG;
myCDS.cbData = (DWORD)strlen(log) + 1; myCDS.cbData = (DWORD)strlen(log) + 1;
myCDS.lpData = (PVOID)log; myCDS.lpData = (PVOID)log;
if (Director::getInstance()->getOpenGLView()) if (Director::getInstance()->getOpenGLView())

View File

@ -53,7 +53,7 @@ public:
static void onConnected(std::string_view deviceName, int deviceId) static void onConnected(std::string_view deviceName, int deviceId)
{ {
// Check whether the controller is already connected. // Check whether the controller is already connected.
CCLOG("onConnected %s,%d", deviceName.data(), deviceId); AXLOG("onConnected %s,%d", deviceName.data(), deviceId);
auto iter = findController(deviceName, deviceId); auto iter = findController(deviceName, deviceId);
if (iter != Controller::s_allController.end()) if (iter != Controller::s_allController.end())
@ -70,12 +70,12 @@ public:
static void onDisconnected(std::string_view deviceName, int deviceId) static void onDisconnected(std::string_view deviceName, int deviceId)
{ {
CCLOG("onDisconnected %s,%d", deviceName.data(), deviceId); AXLOG("onDisconnected %s,%d", deviceName.data(), deviceId);
auto iter = findController(deviceName, deviceId); auto iter = findController(deviceName, deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOGERROR("Could not find the controller!"); AXLOGERROR("Could not find the controller!");
return; return;
} }
@ -93,7 +93,7 @@ public:
auto iter = findController(deviceName, deviceId); auto iter = findController(deviceName, deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOG("onButtonEvent:connect new controller."); AXLOG("onButtonEvent:connect new controller.");
onConnected(deviceName, deviceId); onConnected(deviceName, deviceId);
iter = findController(deviceName, deviceId); iter = findController(deviceName, deviceId);
} }
@ -106,7 +106,7 @@ public:
auto iter = findController(deviceName, deviceId); auto iter = findController(deviceName, deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOG("onAxisEvent:connect new controller."); AXLOG("onAxisEvent:connect new controller.");
onConnected(deviceName, deviceId); onConnected(deviceName, deviceId);
iter = findController(deviceName, deviceId); iter = findController(deviceName, deviceId);
} }
@ -172,7 +172,7 @@ JNIEXPORT void JNICALL Java_org_cocos2dx_lib_GameControllerAdapter_nativeControl
jstring deviceName, jstring deviceName,
jint controllerID) jint controllerID)
{ {
CCLOG("controller id: %d connected!", controllerID); AXLOG("controller id: %d connected!", controllerID);
axis::ControllerImpl::onConnected(axis::JniHelper::jstring2string(deviceName), controllerID); axis::ControllerImpl::onConnected(axis::JniHelper::jstring2string(deviceName), controllerID);
} }
@ -181,7 +181,7 @@ JNIEXPORT void JNICALL Java_org_cocos2dx_lib_GameControllerAdapter_nativeControl
jstring deviceName, jstring deviceName,
jint controllerID) jint controllerID)
{ {
CCLOG("controller id: %d disconnected!", controllerID); AXLOG("controller id: %d disconnected!", controllerID);
axis::ControllerImpl::onDisconnected(axis::JniHelper::jstring2string(deviceName), controllerID); axis::ControllerImpl::onDisconnected(axis::JniHelper::jstring2string(deviceName), controllerID);
} }

View File

@ -4222,14 +4222,14 @@ public:
if (deviceName.compare(it.first) == 0) if (deviceName.compare(it.first) == 0)
{ {
// Found controller profile. Attach it to the controller: // Found controller profile. Attach it to the controller:
CCLOG("ControllerImpl: Found input profile for controller: %s", deviceName.data()); AXLOG("ControllerImpl: Found input profile for controller: %s", deviceName.data());
controller->_buttonInputMap = it.second.first; controller->_buttonInputMap = it.second.first;
controller->_axisInputMap = it.second.second; controller->_axisInputMap = it.second.second;
// Show a one-time warning in debug mode for every button that's currently not matched in the input profile. // Show a one-time warning in debug mode for every button that's currently not matched in the input profile.
// This will let the developers know that the mapping must be included in the constructor of ControllerImpl located // This will let the developers know that the mapping must be included in the constructor of ControllerImpl located
// above. // above.
# ifdef COCOS2D_DEBUG # ifdef AXIS_DEBUG
int count; int count;
glfwGetJoystickButtons(deviceId, &count); glfwGetJoystickButtons(deviceId, &count);
for (int i = 0; i < count; ++i) for (int i = 0; i < count; ++i)
@ -4238,7 +4238,7 @@ public:
const auto& it = controller->_buttonInputMap.find(i); const auto& it = controller->_buttonInputMap.find(i);
if (it == controller->_buttonInputMap.end()) if (it == controller->_buttonInputMap.end())
{ {
CCLOG( AXLOG(
"ControllerImpl: Could not find a button input mapping for controller \"%s\", and keyCode " "ControllerImpl: Could not find a button input mapping for controller \"%s\", and keyCode "
"\"%d\". This keyCode will not match any from Controller::Key", "\"%d\". This keyCode will not match any from Controller::Key",
controller->getDeviceName().data(), i); controller->getDeviceName().data(), i);
@ -4252,7 +4252,7 @@ public:
const auto& it = controller->_axisInputMap.find(i); const auto& it = controller->_axisInputMap.find(i);
if (it == controller->_axisInputMap.end()) if (it == controller->_axisInputMap.end())
{ {
CCLOG( AXLOG(
"ControllerImpl: Could not find an axis input mapping for controller \"%s\", and keyCode " "ControllerImpl: Could not find an axis input mapping for controller \"%s\", and keyCode "
"\"%d\". This keyCode will not match any from Controller::Key", "\"%d\". This keyCode will not match any from Controller::Key",
controller->getDeviceName().data(), i); controller->getDeviceName().data(), i);
@ -4265,15 +4265,15 @@ public:
} }
// Show a warning if the controller input profile is non-existent: // Show a warning if the controller input profile is non-existent:
# ifdef COCOS2D_DEBUG # ifdef AXIS_DEBUG
if (controller->_buttonInputMap.empty()) if (controller->_buttonInputMap.empty())
{ {
CCLOG("ControllerImpl: Could not find a button input map for controller: %s", deviceName.data()); AXLOG("ControllerImpl: Could not find a button input map for controller: %s", deviceName.data());
} }
if (controller->_axisInputMap.empty()) if (controller->_axisInputMap.empty())
{ {
CCLOG("ControllerImpl: Could not find an axis input map for controller: %s", deviceName.data()); AXLOG("ControllerImpl: Could not find an axis input map for controller: %s", deviceName.data());
} }
# endif # endif
@ -4286,7 +4286,7 @@ public:
auto iter = findController(deviceId); auto iter = findController(deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOGERROR("ControllerImpl Error: Could not find the controller!"); AXLOGERROR("ControllerImpl Error: Could not find the controller!");
return; return;
} }
@ -4299,7 +4299,7 @@ public:
auto iter = findController(deviceId); auto iter = findController(deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOG("ControllerImpl::onButtonEvent: new controller detected. Registering..."); AXLOG("ControllerImpl::onButtonEvent: new controller detected. Registering...");
onConnected(glfwGetJoystickName(deviceId), deviceId); onConnected(glfwGetJoystickName(deviceId), deviceId);
iter = findController(deviceId); iter = findController(deviceId);
} }
@ -4312,7 +4312,7 @@ public:
auto iter = findController(deviceId); auto iter = findController(deviceId);
if (iter == Controller::s_allController.end()) if (iter == Controller::s_allController.end())
{ {
CCLOG("ControllerImpl::onAxisEvent: new controller detected. Registering..."); AXLOG("ControllerImpl::onAxisEvent: new controller detected. Registering...");
onConnected(glfwGetJoystickName(deviceId), deviceId); onConnected(glfwGetJoystickName(deviceId), deviceId);
iter = findController(deviceId); iter = findController(deviceId);
} }
@ -4332,10 +4332,10 @@ public:
{ {
ControllerImpl::getInstance()->onDisconnected(deviceId); ControllerImpl::getInstance()->onDisconnected(deviceId);
} }
# ifdef COCOS2D_DEBUG # ifdef AXIS_DEBUG
else else
{ {
CCLOG("ControllerImpl: Unhandled GLFW joystick event: %d", event); AXLOG("ControllerImpl: Unhandled GLFW joystick event: %d", event);
} }
# endif # endif
} }

View File

@ -33,18 +33,18 @@ const Data Data::Null;
Data::Data() : _bytes(nullptr), _size(0) Data::Data() : _bytes(nullptr), _size(0)
{ {
CCLOGINFO("In the empty constructor of Data."); AXLOGINFO("In the empty constructor of Data.");
} }
Data::Data(Data&& other) : _bytes(nullptr), _size(0) Data::Data(Data&& other) : _bytes(nullptr), _size(0)
{ {
CCLOGINFO("In the move constructor of Data."); AXLOGINFO("In the move constructor of Data.");
move(other); move(other);
} }
Data::Data(const Data& other) : _bytes(nullptr), _size(0) Data::Data(const Data& other) : _bytes(nullptr), _size(0)
{ {
CCLOGINFO("In the copy constructor of Data."); AXLOGINFO("In the copy constructor of Data.");
if (other._bytes && other._size) if (other._bytes && other._size)
{ {
copy(other._bytes, other._size); copy(other._bytes, other._size);
@ -53,7 +53,7 @@ Data::Data(const Data& other) : _bytes(nullptr), _size(0)
Data::~Data() Data::~Data()
{ {
CCLOGINFO("deallocing Data: %p", this); AXLOGINFO("deallocing Data: %p", this);
clear(); clear();
} }
@ -61,7 +61,7 @@ Data& Data::operator=(const Data& other)
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the copy assignment of Data."); AXLOGINFO("In the copy assignment of Data.");
copy(other._bytes, other._size); copy(other._bytes, other._size);
} }
return *this; return *this;
@ -71,7 +71,7 @@ Data& Data::operator=(Data&& other)
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the move assignment of Data."); AXLOGINFO("In the move assignment of Data.");
move(other); move(other);
} }
return *this; return *this;
@ -106,8 +106,8 @@ ssize_t Data::getSize() const
ssize_t Data::copy(const unsigned char* bytes, const ssize_t size) ssize_t Data::copy(const unsigned char* bytes, const ssize_t size)
{ {
CCASSERT(size >= 0, "copy size should be non-negative"); AXASSERT(size >= 0, "copy size should be non-negative");
CCASSERT(bytes, "bytes should not be nullptr"); AXASSERT(bytes, "bytes should not be nullptr");
if (size <= 0) if (size <= 0)
return 0; return 0;
@ -138,8 +138,8 @@ uint8_t* Data::resize(ssize_t size)
void Data::fastSet(uint8_t* bytes, const ssize_t size) void Data::fastSet(uint8_t* bytes, const ssize_t size)
{ {
CCASSERT(size >= 0, "fastSet size should be non-negative"); AXASSERT(size >= 0, "fastSet size should be non-negative");
// CCASSERT(bytes, "bytes should not be nullptr"); // AXASSERT(bytes, "bytes should not be nullptr");
_bytes = bytes; _bytes = bytes;
_size = size; _size = size;
} }

View File

@ -92,7 +92,7 @@ Director* Director::getInstance()
if (!s_SharedDirector) if (!s_SharedDirector)
{ {
s_SharedDirector = new Director; s_SharedDirector = new Director;
CCASSERT(s_SharedDirector, "FATAL: Not enough memory"); AXASSERT(s_SharedDirector, "FATAL: Not enough memory");
s_SharedDirector->init(); s_SharedDirector->init();
} }
@ -148,7 +148,7 @@ bool Director::init()
Director::~Director() Director::~Director()
{ {
CCLOGINFO("deallocing Director: %p", this); AXLOGINFO("deallocing Director: %p", this);
AX_SAFE_RELEASE(_FPSLabel); AX_SAFE_RELEASE(_FPSLabel);
AX_SAFE_RELEASE(_drawnVerticesLabel); AX_SAFE_RELEASE(_drawnVerticesLabel);
@ -208,7 +208,7 @@ void Director::setDefaultValues()
else if (projection == "custom") else if (projection == "custom")
_projection = Projection::CUSTOM; _projection = Projection::CUSTOM;
else else
CCASSERT(false, "Invalid projection value"); AXASSERT(false, "Invalid projection value");
// Default pixel format for PNG images with alpha // Default pixel format for PNG images with alpha
std::string pixel_format = conf->getValue("axis.texture.pixel_format_for_png", Value("rgba8888")).asString(); std::string pixel_format = conf->getValue("axis.texture.pixel_format_for_png", Value("rgba8888")).asString();
@ -241,7 +241,7 @@ void Director::setDefaultValues()
void Director::setGLDefaultValues() void Director::setGLDefaultValues()
{ {
// This method SHOULD be called only after openGLView_ was initialized // This method SHOULD be called only after openGLView_ was initialized
CCASSERT(_openGLView, "opengl view should not be null"); AXASSERT(_openGLView, "opengl view should not be null");
_renderer->setDepthTest(false); _renderer->setDepthTest(false);
_renderer->setDepthCompareFunction(backend::CompareFunction::LESS_EQUAL); _renderer->setDepthCompareFunction(backend::CompareFunction::LESS_EQUAL);
@ -358,7 +358,7 @@ void Director::calculateDeltaTime()
_deltaTime = MAX(0, _deltaTime); _deltaTime = MAX(0, _deltaTime);
} }
#if COCOS2D_DEBUG #if AXIS_DEBUG
// If we are debugging our code, prevent big delta time // If we are debugging our code, prevent big delta time
if (_deltaTime > 0.2f) if (_deltaTime > 0.2f)
{ {
@ -373,14 +373,14 @@ float Director::getDeltaTime() const
} }
void Director::setOpenGLView(GLView* openGLView) void Director::setOpenGLView(GLView* openGLView)
{ {
CCASSERT(openGLView, "opengl view should not be null"); AXASSERT(openGLView, "opengl view should not be null");
if (_openGLView != openGLView) if (_openGLView != openGLView)
{ {
// Configuration. Gather GPU info // Configuration. Gather GPU info
Configuration* conf = Configuration::getInstance(); Configuration* conf = Configuration::getInstance();
conf->gatherGPUInfo(); conf->gatherGPUInfo();
CCLOG("%s\n", conf->getInfo().c_str()); AXLOG("%s\n", conf->getInfo().c_str());
if (_openGLView) if (_openGLView)
_openGLView->release(); _openGLView->release();
@ -487,7 +487,7 @@ void Director::popMatrix(MATRIX_STACK_TYPE type)
} }
else else
{ {
CCASSERT(false, "unknown matrix stack type"); AXASSERT(false, "unknown matrix stack type");
} }
} }
@ -507,7 +507,7 @@ void Director::loadIdentityMatrix(MATRIX_STACK_TYPE type)
} }
else else
{ {
CCASSERT(false, "unknown matrix stack type"); AXASSERT(false, "unknown matrix stack type");
} }
} }
@ -527,7 +527,7 @@ void Director::loadMatrix(MATRIX_STACK_TYPE type, const Mat4& mat)
} }
else else
{ {
CCASSERT(false, "unknown matrix stack type"); AXASSERT(false, "unknown matrix stack type");
} }
} }
@ -547,7 +547,7 @@ void Director::multiplyMatrix(MATRIX_STACK_TYPE type, const Mat4& mat)
} }
else else
{ {
CCASSERT(false, "unknown matrix stack type"); AXASSERT(false, "unknown matrix stack type");
} }
} }
@ -567,7 +567,7 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
} }
else else
{ {
CCASSERT(false, "unknown matrix stack type"); AXASSERT(false, "unknown matrix stack type");
} }
} }
@ -586,7 +586,7 @@ const Mat4& Director::getMatrix(MATRIX_STACK_TYPE type) const
return _textureMatrixStack.top(); return _textureMatrixStack.top();
} }
CCASSERT(false, "unknown matrix stack type, will return modelview matrix instead"); AXASSERT(false, "unknown matrix stack type, will return modelview matrix instead");
return _modelViewMatrixStack.top(); return _modelViewMatrixStack.top();
} }
@ -596,7 +596,7 @@ void Director::setProjection(Projection projection)
if (size.width == 0 || size.height == 0) if (size.width == 0 || size.height == 0)
{ {
CCLOGERROR("cocos2d: warning, Director::setProjection() failed because size is 0"); AXLOGERROR("cocos2d: warning, Director::setProjection() failed because size is 0");
return; return;
} }
@ -638,7 +638,7 @@ void Director::setProjection(Projection projection)
break; break;
default: default:
CCLOG("cocos2d: Director: unrecognized projection"); AXLOG("cocos2d: Director: unrecognized projection");
break; break;
} }
@ -680,7 +680,7 @@ static void GLToClipTransform(Mat4* transformOut)
return; return;
Director* director = Director::getInstance(); Director* director = Director::getInstance();
CCASSERT(nullptr != director, "Director is null when setting matrix stack"); AXASSERT(nullptr != director, "Director is null when setting matrix stack");
auto& projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION); auto& projection = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_PROJECTION);
auto& modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW); auto& modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -785,9 +785,9 @@ Rect Director::getSafeAreaRect() const
void Director::runWithScene(Scene* scene) void Director::runWithScene(Scene* scene)
{ {
CCASSERT(scene != nullptr, AXASSERT(scene != nullptr,
"This command can only be used to start the Director. There is already a scene present."); "This command can only be used to start the Director. There is already a scene present.");
CCASSERT(_runningScene == nullptr, "_runningScene should be null"); AXASSERT(_runningScene == nullptr, "_runningScene should be null");
pushScene(scene); pushScene(scene);
startAnimation(); startAnimation();
@ -795,8 +795,8 @@ void Director::runWithScene(Scene* scene)
void Director::replaceScene(Scene* scene) void Director::replaceScene(Scene* scene)
{ {
// CCASSERT(_runningScene, "Use runWithScene: instead to start the director"); // AXASSERT(_runningScene, "Use runWithScene: instead to start the director");
CCASSERT(scene != nullptr, "the scene should not be null"); AXASSERT(scene != nullptr, "the scene should not be null");
if (_runningScene == nullptr) if (_runningScene == nullptr)
{ {
@ -835,7 +835,7 @@ void Director::replaceScene(Scene* scene)
void Director::pushScene(Scene* scene) void Director::pushScene(Scene* scene)
{ {
CCASSERT(scene, "the scene should not null"); AXASSERT(scene, "the scene should not null");
_sendCleanupToScene = false; _sendCleanupToScene = false;
@ -852,7 +852,7 @@ void Director::pushScene(Scene* scene)
void Director::popScene() void Director::popScene()
{ {
CCASSERT(_runningScene != nullptr, "running scene should not null"); AXASSERT(_runningScene != nullptr, "running scene should not null");
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS #if AX_ENABLE_GC_FOR_NATIVE_OBJECTS
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine(); auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
@ -882,7 +882,7 @@ void Director::popToRootScene()
void Director::popToSceneStackLevel(int level) void Director::popToSceneStackLevel(int level)
{ {
CCASSERT(_runningScene != nullptr, "A running Scene is needed"); AXASSERT(_runningScene != nullptr, "A running Scene is needed");
ssize_t c = _scenesStack.size(); ssize_t c = _scenesStack.size();
// level 0? -> end // level 0? -> end
@ -1271,7 +1271,7 @@ void Director::createStatsLabel()
{ {
if (image) if (image)
delete image; delete image;
CCLOGERROR("%s", "Fails: init fps_images"); AXLOGERROR("%s", "Fails: init fps_images");
return; return;
} }

View File

@ -88,7 +88,7 @@ static EventListener::ListenerID __getListenerID(Event* event)
case Event::Type::TOUCH: case Event::Type::TOUCH:
// Touch listener is very special, it contains two kinds of listeners, EventListenerTouchOneByOne and // Touch listener is very special, it contains two kinds of listeners, EventListenerTouchOneByOne and
// EventListenerTouchAllAtOnce. return UNKNOWN instead. // EventListenerTouchAllAtOnce. return UNKNOWN instead.
CCASSERT(false, "Don't call this method if the event is for touch."); AXASSERT(false, "Don't call this method if the event is for touch.");
break; break;
#if (AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID || AX_TARGET_PLATFORM == AX_PLATFORM_IOS || \ #if (AX_TARGET_PLATFORM == AX_PLATFORM_ANDROID || AX_TARGET_PLATFORM == AX_PLATFORM_IOS || \
AX_TARGET_PLATFORM == AX_PLATFORM_MAC || AX_TARGET_PLATFORM == AX_PLATFORM_LINUX || \ AX_TARGET_PLATFORM == AX_PLATFORM_MAC || AX_TARGET_PLATFORM == AX_PLATFORM_LINUX || \
@ -98,7 +98,7 @@ static EventListener::ListenerID __getListenerID(Event* event)
break; break;
#endif #endif
default: default:
CCASSERT(false, "Invalid type!"); AXASSERT(false, "Invalid type!");
break; break;
} }
@ -135,11 +135,11 @@ bool EventDispatcher::EventListenerVector::empty() const
void EventDispatcher::EventListenerVector::push_back(EventListener* listener) void EventDispatcher::EventListenerVector::push_back(EventListener* listener)
{ {
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS
CCASSERT(_sceneGraphListeners == nullptr || AXASSERT(_sceneGraphListeners == nullptr ||
std::count(_sceneGraphListeners->begin(), _sceneGraphListeners->end(), listener) == 0, std::count(_sceneGraphListeners->begin(), _sceneGraphListeners->end(), listener) == 0,
"Listener should not be added twice!"); "Listener should not be added twice!");
CCASSERT(_fixedListeners == nullptr || std::count(_fixedListeners->begin(), _fixedListeners->end(), listener) == 0, AXASSERT(_fixedListeners == nullptr || std::count(_fixedListeners->begin(), _fixedListeners->end(), listener) == 0,
"Listener should not be added twice!"); "Listener should not be added twice!");
#endif #endif
@ -472,7 +472,7 @@ void EventDispatcher::forceAddEventListener(EventListener* listener)
setDirty(listenerID, DirtyFlag::SCENE_GRAPH_PRIORITY); setDirty(listenerID, DirtyFlag::SCENE_GRAPH_PRIORITY);
auto node = listener->getAssociatedNode(); auto node = listener->getAssociatedNode();
CCASSERT(node != nullptr, "Invalid scene graph priority!"); AXASSERT(node != nullptr, "Invalid scene graph priority!");
associateNodeAndEventListener(node, listener); associateNodeAndEventListener(node, listener);
@ -489,8 +489,8 @@ void EventDispatcher::forceAddEventListener(EventListener* listener)
void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node) void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node)
{ {
CCASSERT(listener && node, "Invalid parameters."); AXASSERT(listener && node, "Invalid parameters.");
CCASSERT(!listener->isRegistered(), "The listener has been registered."); AXASSERT(!listener->isRegistered(), "The listener has been registered.");
if (!listener->checkAvailable()) if (!listener->checkAvailable())
return; return;
@ -502,7 +502,7 @@ void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* list
addEventListener(listener); addEventListener(listener);
} }
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && AXIS_DEBUG > 0
void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node) void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
{ {
@ -517,7 +517,7 @@ void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
{ {
for (EventListener* listener : *eventListenerVector->getSceneGraphPriorityListeners()) for (EventListener* listener : *eventListenerVector->getSceneGraphPriorityListeners())
{ {
CCASSERT(!listener || listener->getAssociatedNode() != node, AXASSERT(!listener || listener->getAssociatedNode() != node,
"Node should have no event listeners registered for it upon destruction!"); "Node should have no event listeners registered for it upon destruction!");
} }
} }
@ -527,13 +527,13 @@ void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
// Check the node listeners map // Check the node listeners map
for (const auto& keyValuePair : _nodeListenersMap) for (const auto& keyValuePair : _nodeListenersMap)
{ {
CCASSERT(keyValuePair.first != node, "Node should have no event listeners registered for it upon destruction!"); AXASSERT(keyValuePair.first != node, "Node should have no event listeners registered for it upon destruction!");
if (keyValuePair.second) if (keyValuePair.second)
{ {
for (EventListener* listener : *keyValuePair.second) for (EventListener* listener : *keyValuePair.second)
{ {
CCASSERT(listener->getAssociatedNode() != node, AXASSERT(listener->getAssociatedNode() != node,
"Node should have no event listeners registered for it upon destruction!"); "Node should have no event listeners registered for it upon destruction!");
} }
} }
@ -542,30 +542,30 @@ void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
// Check the node priority map // Check the node priority map
for (const auto& keyValuePair : _nodePriorityMap) for (const auto& keyValuePair : _nodePriorityMap)
{ {
CCASSERT(keyValuePair.first != node, "Node should have no event listeners registered for it upon destruction!"); AXASSERT(keyValuePair.first != node, "Node should have no event listeners registered for it upon destruction!");
} }
// Check the to be added list // Check the to be added list
for (EventListener* listener : _toAddedListeners) for (EventListener* listener : _toAddedListeners)
{ {
CCASSERT(listener->getAssociatedNode() != node, AXASSERT(listener->getAssociatedNode() != node,
"Node should have no event listeners registered for it upon destruction!"); "Node should have no event listeners registered for it upon destruction!");
} }
// Check the dirty nodes set // Check the dirty nodes set
for (Node* dirtyNode : _dirtyNodes) for (Node* dirtyNode : _dirtyNodes)
{ {
CCASSERT(dirtyNode != node, "Node should have no event listeners registered for it upon destruction!"); AXASSERT(dirtyNode != node, "Node should have no event listeners registered for it upon destruction!");
} }
} }
#endif // #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 #endif // #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && AXIS_DEBUG > 0
void EventDispatcher::addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority) void EventDispatcher::addEventListenerWithFixedPriority(EventListener* listener, int fixedPriority)
{ {
CCASSERT(listener, "Invalid parameters."); AXASSERT(listener, "Invalid parameters.");
CCASSERT(!listener->isRegistered(), "The listener has been registered."); AXASSERT(!listener->isRegistered(), "The listener has been registered.");
CCASSERT(fixedPriority != 0, AXASSERT(fixedPriority != 0,
"0 priority is forbidden for fixed priority since it's used for scene graph based priority."); "0 priority is forbidden for fixed priority since it's used for scene graph based priority.");
if (!listener->checkAvailable()) if (!listener->checkAvailable())
@ -654,12 +654,12 @@ void EventDispatcher::removeEventListener(EventListener* listener)
} }
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS
CCASSERT( AXASSERT(
_inDispatch != 0 || !sceneGraphPriorityListeners || _inDispatch != 0 || !sceneGraphPriorityListeners ||
std::count(sceneGraphPriorityListeners->begin(), sceneGraphPriorityListeners->end(), listener) == 0, std::count(sceneGraphPriorityListeners->begin(), sceneGraphPriorityListeners->end(), listener) == 0,
"Listener should be in no lists after this is done if we're not currently in dispatch mode."); "Listener should be in no lists after this is done if we're not currently in dispatch mode.");
CCASSERT(_inDispatch != 0 || !fixedPriorityListeners || AXASSERT(_inDispatch != 0 || !fixedPriorityListeners ||
std::count(fixedPriorityListeners->begin(), fixedPriorityListeners->end(), listener) == 0, std::count(fixedPriorityListeners->begin(), fixedPriorityListeners->end(), listener) == 0,
"Listener should be in no lists after this is done if we're not currently in dispatch mode."); "Listener should be in no lists after this is done if we're not currently in dispatch mode.");
#endif #endif
@ -712,7 +712,7 @@ void EventDispatcher::setPriority(EventListener* listener, int fixedPriority)
auto found = std::find(fixedPriorityListeners->begin(), fixedPriorityListeners->end(), listener); auto found = std::find(fixedPriorityListeners->begin(), fixedPriorityListeners->end(), listener);
if (found != fixedPriorityListeners->end()) if (found != fixedPriorityListeners->end())
{ {
CCASSERT(listener->getAssociatedNode() == nullptr, AXASSERT(listener->getAssociatedNode() == nullptr,
"Can't set fixed priority with scene graph based listener."); "Can't set fixed priority with scene graph based listener.");
if (listener->getFixedPriority() != fixedPriority) if (listener->getFixedPriority() != fixedPriority)
@ -737,7 +737,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners,
// priority < 0 // priority < 0
if (fixedPriorityListeners) if (fixedPriorityListeners)
{ {
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()), AXASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
"Out of range exception!"); "Out of range exception!");
if (!fixedPriorityListeners->empty()) if (!fixedPriorityListeners->empty())
@ -801,7 +801,7 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene
// priority < 0 // priority < 0
if (fixedPriorityListeners) if (fixedPriorityListeners)
{ {
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()), AXASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
"Out of range exception!"); "Out of range exception!");
if (!fixedPriorityListeners->empty()) if (!fixedPriorityListeners->empty())
@ -1032,7 +1032,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
} }
break; break;
default: default:
CCASSERT(false, "The eventcode is invalid."); AXASSERT(false, "The eventcode is invalid.");
break; break;
} }
} }
@ -1044,7 +1044,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
return true; return true;
} }
CCASSERT(touches->getID() == (*mutableTouchesIter)->getID(), AXASSERT(touches->getID() == (*mutableTouchesIter)->getID(),
"touches ID should be equal to mutableTouchesIter's ID."); "touches ID should be equal to mutableTouchesIter's ID.");
if (isClaimed && listener->_isRegistered && listener->_needSwallow) if (isClaimed && listener->_isRegistered && listener->_needSwallow)
@ -1113,7 +1113,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
} }
break; break;
default: default:
CCASSERT(false, "The eventcode is invalid."); AXASSERT(false, "The eventcode is invalid.");
break; break;
} }
@ -1139,7 +1139,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
void EventDispatcher::updateListeners(Event* event) void EventDispatcher::updateListeners(Event* event)
{ {
CCASSERT(_inDispatch > 0, "If program goes here, there should be event in dispatch."); AXASSERT(_inDispatch > 0, "If program goes here, there should be event in dispatch.");
if (_inDispatch > 1) if (_inDispatch > 1)
return; return;
@ -1217,7 +1217,7 @@ void EventDispatcher::updateListeners(Event* event)
onUpdateListeners(__getListenerID(event)); onUpdateListeners(__getListenerID(event));
} }
CCASSERT(_inDispatch == 1, "_inDispatch should be 1 here."); AXASSERT(_inDispatch == 1, "_inDispatch should be 1 here.");
for (auto iter = _listenerMap.begin(); iter != _listenerMap.end();) for (auto iter = _listenerMap.begin(); iter != _listenerMap.end();)
{ {
@ -1474,7 +1474,7 @@ void EventDispatcher::removeEventListenersForType(EventListener::Type listenerTy
} }
else else
{ {
CCASSERT(false, "Invalid listener type!"); AXASSERT(false, "Invalid listener type!");
} }
} }

View File

@ -196,7 +196,7 @@ public:
*/ */
~EventDispatcher(); ~EventDispatcher();
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && COCOS2D_DEBUG > 0 #if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS && AXIS_DEBUG > 0
/** /**
* To help track down event listener issues in debug builds. * To help track down event listener issues in debug builds.

View File

@ -32,7 +32,7 @@ EventListener::EventListener() {}
EventListener::~EventListener() EventListener::~EventListener()
{ {
CCLOGINFO("In the destructor of EventListener. %p", this); AXLOGINFO("In the destructor of EventListener. %p", this);
} }
bool EventListener::init(Type t, std::string_view listenerID, const std::function<void(Event*)>& callback) bool EventListener::init(Type t, std::string_view listenerID, const std::function<void(Event*)>& callback)

View File

@ -35,7 +35,7 @@ EventListenerAcceleration::EventListenerAcceleration() {}
EventListenerAcceleration::~EventListenerAcceleration() EventListenerAcceleration::~EventListenerAcceleration()
{ {
CCLOGINFO("In the destructor of AccelerationEventListener. %p", this); AXLOGINFO("In the destructor of AccelerationEventListener. %p", this);
} }
EventListenerAcceleration* EventListenerAcceleration::create(const std::function<void(Acceleration*, Event*)>& callback) EventListenerAcceleration* EventListenerAcceleration::create(const std::function<void(Acceleration*, Event*)>& callback)
@ -87,7 +87,7 @@ EventListenerAcceleration* EventListenerAcceleration::clone()
bool EventListenerAcceleration::checkAvailable() bool EventListenerAcceleration::checkAvailable()
{ {
CCASSERT(onAccelerationEvent, "onAccelerationEvent can't be nullptr!"); AXASSERT(onAccelerationEvent, "onAccelerationEvent can't be nullptr!");
return true; return true;
} }

View File

@ -93,7 +93,7 @@ bool EventListenerController::init()
} }
break; break;
default: default:
CCASSERT(false, "Invalid EventController type"); AXASSERT(false, "Invalid EventController type");
break; break;
} }
}; };

View File

@ -36,7 +36,7 @@ EventListenerFocus::EventListenerFocus() : onFocusChanged(nullptr) {}
EventListenerFocus::~EventListenerFocus() EventListenerFocus::~EventListenerFocus()
{ {
CCLOGINFO("In the destructor of EventListenerFocus, %p", this); AXLOGINFO("In the destructor of EventListenerFocus, %p", this);
} }
EventListenerFocus* EventListenerFocus::create() EventListenerFocus* EventListenerFocus::create()
@ -84,7 +84,7 @@ bool EventListenerFocus::checkAvailable()
{ {
if (onFocusChanged == nullptr) if (onFocusChanged == nullptr)
{ {
CCASSERT(false, "Invalid EventListenerFocus!"); AXASSERT(false, "Invalid EventListenerFocus!");
return false; return false;
} }

View File

@ -35,7 +35,7 @@ bool EventListenerKeyboard::checkAvailable()
{ {
if (onKeyPressed == nullptr && onKeyReleased == nullptr) if (onKeyPressed == nullptr && onKeyReleased == nullptr)
{ {
CCASSERT(false, "Invalid EventListenerKeyboard!"); AXASSERT(false, "Invalid EventListenerKeyboard!");
return false; return false;
} }

View File

@ -44,7 +44,7 @@ EventListenerTouchOneByOne::EventListenerTouchOneByOne()
EventListenerTouchOneByOne::~EventListenerTouchOneByOne() EventListenerTouchOneByOne::~EventListenerTouchOneByOne()
{ {
CCLOGINFO("In the destructor of EventListenerTouchOneByOne, %p", this); AXLOGINFO("In the destructor of EventListenerTouchOneByOne, %p", this);
} }
bool EventListenerTouchOneByOne::init() bool EventListenerTouchOneByOne::init()
@ -87,7 +87,7 @@ bool EventListenerTouchOneByOne::checkAvailable()
// message to 'EventListenerTouchOneByOne' or not. So 'onTouchBegan' needs to be set. // message to 'EventListenerTouchOneByOne' or not. So 'onTouchBegan' needs to be set.
if (onTouchBegan == nullptr) if (onTouchBegan == nullptr)
{ {
CCASSERT(false, "Invalid EventListenerTouchOneByOne!"); AXASSERT(false, "Invalid EventListenerTouchOneByOne!");
return false; return false;
} }
@ -126,7 +126,7 @@ EventListenerTouchAllAtOnce::EventListenerTouchAllAtOnce()
EventListenerTouchAllAtOnce::~EventListenerTouchAllAtOnce() EventListenerTouchAllAtOnce::~EventListenerTouchAllAtOnce()
{ {
CCLOGINFO("In the destructor of EventListenerTouchAllAtOnce, %p", this); AXLOGINFO("In the destructor of EventListenerTouchAllAtOnce, %p", this);
} }
bool EventListenerTouchAllAtOnce::init() bool EventListenerTouchAllAtOnce::init()
@ -158,7 +158,7 @@ bool EventListenerTouchAllAtOnce::checkAvailable()
if (onTouchesBegan == nullptr && onTouchesMoved == nullptr && onTouchesEnded == nullptr && if (onTouchesBegan == nullptr && onTouchesMoved == nullptr && onTouchesEnded == nullptr &&
onTouchesCancelled == nullptr) onTouchesCancelled == nullptr)
{ {
CCASSERT(false, "Invalid EventListenerTouchAllAtOnce!"); AXASSERT(false, "Invalid EventListenerTouchAllAtOnce!");
return false; return false;
} }

View File

@ -90,14 +90,14 @@ public:
Map() : _data() Map() : _data()
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!");
CCLOGINFO("In the default constructor of Map!"); AXLOGINFO("In the default constructor of Map!");
} }
/** Constructor with capacity. */ /** Constructor with capacity. */
explicit Map(ssize_t capacity) : _data() explicit Map(ssize_t capacity) : _data()
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!");
CCLOGINFO("In the constructor with capacity of Map!"); AXLOGINFO("In the constructor with capacity of Map!");
_data.reserve(capacity); _data.reserve(capacity);
} }
@ -105,7 +105,7 @@ public:
Map(const Map& other) Map(const Map& other)
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!");
CCLOGINFO("In the copy constructor of Map!"); AXLOGINFO("In the copy constructor of Map!");
_data = other._data; _data = other._data;
addRefForAllObjects(); addRefForAllObjects();
} }
@ -114,7 +114,7 @@ public:
Map(Map&& other) Map(Map&& other)
{ {
static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!"); static_assert(std::is_convertible<V, Ref*>::value, "Invalid Type for axis::Map<K, V>!");
CCLOGINFO("In the move constructor of Map!"); AXLOGINFO("In the move constructor of Map!");
_data = std::move(other._data); _data = std::move(other._data);
} }
@ -124,7 +124,7 @@ public:
*/ */
~Map() ~Map()
{ {
CCLOGINFO("In the destructor of Map!"); AXLOGINFO("In the destructor of Map!");
clear(); clear();
} }
@ -273,7 +273,7 @@ public:
template <typename K2> template <typename K2>
void insert(const K2& key, V object) void insert(const K2& key, V object)
{ {
CCASSERT(object != nullptr, "Object is nullptr!"); AXASSERT(object != nullptr, "Object is nullptr!");
object->retain(); object->retain();
erase(key); erase(key);
_data.emplace(key, object); _data.emplace(key, object);
@ -287,14 +287,14 @@ public:
*/ */
iterator erase(const_iterator position) iterator erase(const_iterator position)
{ {
CCASSERT(position != _data.cend(), "Invalid iterator!"); AXASSERT(position != _data.cend(), "Invalid iterator!");
position->second->release(); position->second->release();
return _data.erase(position); return _data.erase(position);
} }
iterator erase(iterator position) iterator erase(iterator position)
{ {
CCASSERT(position != _data.cend(), "Invalid iterator!"); AXASSERT(position != _data.cend(), "Invalid iterator!");
position->second->release(); position->second->release();
return _data.erase(position); return _data.erase(position);
} }
@ -379,25 +379,25 @@ public:
// Don't uses operator since we could not decide whether it needs 'retain'/'release'. // Don't uses operator since we could not decide whether it needs 'retain'/'release'.
// V& operator[] ( const K& key ) // V& operator[] ( const K& key )
// { // {
// CCLOG("copy: [] ref"); // AXLOG("copy: [] ref");
// return _data[key]; // return _data[key];
// } // }
// //
// V& operator[] ( K&& key ) // V& operator[] ( K&& key )
// { // {
// CCLOG("move [] ref"); // AXLOG("move [] ref");
// return _data[key]; // return _data[key];
// } // }
// const V& operator[] ( const K& key ) const // const V& operator[] ( const K& key ) const
// { // {
// CCLOG("const copy []"); // AXLOG("const copy []");
// return _data.at(key); // return _data.at(key);
// } // }
// //
// const V& operator[] ( K&& key ) const // const V& operator[] ( K&& key ) const
// { // {
// CCLOG("const move []"); // AXLOG("const move []");
// return _data.at(key); // return _data.at(key);
// } // }
@ -406,7 +406,7 @@ public:
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the copy assignment operator of Map!"); AXLOGINFO("In the copy assignment operator of Map!");
clear(); clear();
_data = other._data; _data = other._data;
addRefForAllObjects(); addRefForAllObjects();
@ -419,7 +419,7 @@ public:
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the move assignment operator of Map!"); AXLOGINFO("In the move assignment operator of Map!");
clear(); clear();
_data = std::move(other._data); _data = std::move(other._data);
} }

View File

@ -35,14 +35,14 @@ NinePatchImageParser::NinePatchImageParser() : _image(nullptr), _imageFrame(Rect
NinePatchImageParser::NinePatchImageParser(Image* image) : _image(image), _imageFrame(Rect::ZERO), _isRotated(false) NinePatchImageParser::NinePatchImageParser(Image* image) : _image(image), _imageFrame(Rect::ZERO), _isRotated(false)
{ {
this->_imageFrame = Rect(0, 0, image->getWidth(), image->getHeight()); this->_imageFrame = Rect(0, 0, image->getWidth(), image->getHeight());
CCASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8, AXASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888"); "unsupported format, currently only supports rgba8888");
} }
NinePatchImageParser::NinePatchImageParser(Image* image, const Rect& frame, bool rotated) NinePatchImageParser::NinePatchImageParser(Image* image, const Rect& frame, bool rotated)
: _image(image), _imageFrame(frame), _isRotated(rotated) : _image(image), _imageFrame(frame), _isRotated(rotated)
{ {
CCASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8, AXASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888"); "unsupported format, currently only supports rgba8888");
} }
@ -173,7 +173,7 @@ Rect NinePatchImageParser::parseCapInset() const
void NinePatchImageParser::setSpriteFrameInfo(Image* image, const axis::Rect& frameRect, bool rotated) void NinePatchImageParser::setSpriteFrameInfo(Image* image, const axis::Rect& frameRect, bool rotated)
{ {
this->_image = image; this->_image = image;
CCASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8, AXASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888"); "unsupported format, currently only supports rgba8888");
this->_imageFrame = frameRect; this->_imageFrame = frameRect;
this->_isRotated = rotated; this->_isRotated = rotated;

View File

@ -142,7 +142,7 @@ void ProfilingEndTimingBlock(const char* timerName)
Profiler* p = Profiler::getInstance(); Profiler* p = Profiler::getInstance();
ProfilingTimer* timer = p->_activeTimers.at(timerName); ProfilingTimer* timer = p->_activeTimers.at(timerName);
CCASSERT(timer, "CCProfilingTimer not found"); AXASSERT(timer, "CCProfilingTimer not found");
int32_t duration = int32_t duration =
static_cast<int32_t>(chrono::duration_cast<chrono::microseconds>(now - timer->_startTime).count()); static_cast<int32_t>(chrono::duration_cast<chrono::microseconds>(now - timer->_startTime).count());
@ -159,7 +159,7 @@ void ProfilingResetTimingBlock(const char* timerName)
Profiler* p = Profiler::getInstance(); Profiler* p = Profiler::getInstance();
ProfilingTimer* timer = p->_activeTimers.at(timerName); ProfilingTimer* timer = p->_activeTimers.at(timerName);
CCASSERT(timer, "CCProfilingTimer not found"); AXASSERT(timer, "CCProfilingTimer not found");
timer->reset(); timer->reset();
} }

View File

@ -101,7 +101,7 @@ Properties* Properties::createNonRefCounted(std::string_view url)
{ {
if (url.empty()) if (url.empty())
{ {
CCLOGERROR("Attempting to create a Properties object from an empty URL!"); AXLOGERROR("Attempting to create a Properties object from an empty URL!");
return nullptr; return nullptr;
} }
@ -122,7 +122,7 @@ Properties* Properties::createNonRefCounted(std::string_view url)
Properties* p = getPropertiesFromNamespacePath(properties, namespacePath); Properties* p = getPropertiesFromNamespacePath(properties, namespacePath);
if (!p) if (!p)
{ {
CCLOGWARN("Failed to load properties from url '%s'.", url.data()); AXLOGWARN("Failed to load properties from url '%s'.", url.data());
AX_SAFE_DELETE(properties); AX_SAFE_DELETE(properties);
return nullptr; return nullptr;
} }
@ -159,7 +159,7 @@ static bool isVariable(const char* str, char* outName, size_t outSize)
void Properties::readProperties() void Properties::readProperties()
{ {
CCASSERT(_data->getSize() > 0, "Invalid data"); AXASSERT(_data->getSize() > 0, "Invalid data");
char line[2048]; char line[2048];
char variable[256]; char variable[256];
@ -185,7 +185,7 @@ void Properties::readProperties()
rc = readLine(line, 2048); rc = readLine(line, 2048);
if (rc == NULL) if (rc == NULL)
{ {
CCLOGERROR("Error reading line from file."); AXLOGERROR("Error reading line from file.");
return; return;
} }
@ -219,7 +219,7 @@ void Properties::readProperties()
name = strtok(line, "="); name = strtok(line, "=");
if (name == NULL) if (name == NULL)
{ {
CCLOGERROR("Error parsing properties file: attribute without name."); AXLOGERROR("Error parsing properties file: attribute without name.");
return; return;
} }
@ -230,7 +230,7 @@ void Properties::readProperties()
value = strtok(NULL, ""); value = strtok(NULL, "");
if (value == NULL) if (value == NULL)
{ {
CCLOGERROR("Error parsing properties file: attribute with name ('%s') but no value.", name); AXLOGERROR("Error parsing properties file: attribute with name ('%s') but no value.", name);
return; return;
} }
@ -272,7 +272,7 @@ void Properties::readProperties()
name = trimWhiteSpace(name); name = trimWhiteSpace(name);
if (name == NULL) if (name == NULL)
{ {
CCLOGERROR("Error parsing properties file: failed to determine a valid token for line '%s'.", line); AXLOGERROR("Error parsing properties file: failed to determine a valid token for line '%s'.", line);
return; return;
} }
else if (name[0] == '}') else if (name[0] == '}')
@ -299,20 +299,20 @@ void Properties::readProperties()
{ {
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
while (readChar() != '}') while (readChar() != '}')
{ {
if (seekFromCurrent(-2) == false) if (seekFromCurrent(-2) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
} }
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
} }
@ -326,7 +326,7 @@ void Properties::readProperties()
{ {
if (seekFromCurrent(1) == false) if (seekFromCurrent(1) == false)
{ {
CCLOGERROR("Failed to seek to immediately after a '}' character in properties file."); AXLOGERROR("Failed to seek to immediately after a '}' character in properties file.");
return; return;
} }
} }
@ -341,20 +341,20 @@ void Properties::readProperties()
{ {
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
while (readChar() != '}') while (readChar() != '}')
{ {
if (seekFromCurrent(-2) == false) if (seekFromCurrent(-2) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
} }
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
{ {
CCLOGERROR("Failed to seek back to before a '}' character in properties file."); AXLOGERROR("Failed to seek back to before a '}' character in properties file.");
return; return;
} }
} }
@ -368,7 +368,7 @@ void Properties::readProperties()
{ {
if (seekFromCurrent(1) == false) if (seekFromCurrent(1) == false)
{ {
CCLOGERROR("Failed to seek to immediately after a '}' character in properties file."); AXLOGERROR("Failed to seek to immediately after a '}' character in properties file.");
return; return;
} }
} }
@ -388,7 +388,7 @@ void Properties::readProperties()
{ {
// Back up from fgetc() // Back up from fgetc()
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
CCLOGERROR( AXLOGERROR(
"Failed to seek backwards a single character after testing if the next line starts " "Failed to seek backwards a single character after testing if the next line starts "
"with '{'."); "with '{'.");
@ -481,7 +481,7 @@ void Properties::skipWhiteSpace()
{ {
if (seekFromCurrent(-1) == false) if (seekFromCurrent(-1) == false)
{ {
CCLOGERROR("Failed to seek backwards one character after skipping whitespace."); AXLOGERROR("Failed to seek backwards one character after skipping whitespace.");
} }
} }
} }
@ -584,7 +584,7 @@ void Properties::resolveInheritance(const char* id)
void Properties::mergeWith(Properties* overrides) void Properties::mergeWith(Properties* overrides)
{ {
CCASSERT(overrides, "Invalid overrides"); AXASSERT(overrides, "Invalid overrides");
// Overwrite or add each property found in child. // Overwrite or add each property found in child.
overrides->rewind(); overrides->rewind();
@ -674,7 +674,7 @@ void Properties::rewind()
Properties* Properties::getNamespace(const char* id, bool searchNames, bool recurse) const Properties* Properties::getNamespace(const char* id, bool searchNames, bool recurse) const
{ {
CCASSERT(id, "invalid id"); AXASSERT(id, "invalid id");
for (const auto& it : _namespaces) for (const auto& it : _namespaces)
{ {
@ -720,7 +720,7 @@ bool Properties::exists(const char* name) const
static bool isStringNumeric(const char* str) static bool isStringNumeric(const char* str)
{ {
CCASSERT(str, "invalid str"); AXASSERT(str, "invalid str");
// The first character may be '-' // The first character may be '-'
if (*str == '-') if (*str == '-')
@ -879,7 +879,7 @@ int Properties::getInt(const char* name) const
scanned = sscanf(valueString, "%d", &value); scanned = sscanf(valueString, "%d", &value);
if (scanned != 1) if (scanned != 1)
{ {
CCLOGERROR("Error attempting to parse property '%s' as an integer.", name); AXLOGERROR("Error attempting to parse property '%s' as an integer.", name);
return 0; return 0;
} }
return value; return value;
@ -898,7 +898,7 @@ float Properties::getFloat(const char* name) const
scanned = sscanf(valueString, "%f", &value); scanned = sscanf(valueString, "%f", &value);
if (scanned != 1) if (scanned != 1)
{ {
CCLOGERROR("Error attempting to parse property '%s' as a float.", name); AXLOGERROR("Error attempting to parse property '%s' as a float.", name);
return 0.0f; return 0.0f;
} }
return value; return value;
@ -909,7 +909,7 @@ float Properties::getFloat(const char* name) const
bool Properties::getMat4(const char* name, Mat4* out) const bool Properties::getMat4(const char* name, Mat4* out) const
{ {
CCASSERT(out, "Invalid out"); AXASSERT(out, "Invalid out");
const char* valueString = getString(name); const char* valueString = getString(name);
if (valueString) if (valueString)
@ -921,7 +921,7 @@ bool Properties::getMat4(const char* name, Mat4* out) const
if (scanned != 16) if (scanned != 16)
{ {
CCLOGERROR("Error attempting to parse property '%s' as a matrix.", name); AXLOGERROR("Error attempting to parse property '%s' as a matrix.", name);
out->setIdentity(); out->setIdentity();
return false; return false;
} }
@ -966,7 +966,7 @@ bool Properties::getColor(const char* name, Vec4* out) const
bool Properties::getPath(const char* name, std::string* path) const bool Properties::getPath(const char* name, std::string* path) const
{ {
CCASSERT(name && path, "Invalid name or path"); AXASSERT(name && path, "Invalid name or path");
const char* valueString = getString(name); const char* valueString = getString(name);
if (valueString) if (valueString)
{ {
@ -1021,7 +1021,7 @@ const char* Properties::getVariable(const char* name, const char* defaultValue)
void Properties::setVariable(const char* name, const char* value) void Properties::setVariable(const char* name, const char* value)
{ {
CCASSERT(name, "Invalid name"); AXASSERT(name, "Invalid name");
Property* prop = NULL; Property* prop = NULL;
@ -1071,7 +1071,7 @@ Properties* Properties::clone()
for (size_t i = 0, count = _namespaces.size(); i < count; i++) for (size_t i = 0, count = _namespaces.size(); i < count; i++)
{ {
CCASSERT(_namespaces[i], "Invalid namespace"); AXASSERT(_namespaces[i], "Invalid namespace");
Properties* child = _namespaces[i]->clone(); Properties* child = _namespaces[i]->clone();
p->_namespaces.push_back(child); p->_namespaces.push_back(child);
child->_parent = p; child->_parent = p;
@ -1144,7 +1144,7 @@ Properties* getPropertiesFromNamespacePath(Properties* properties, const std::ve
{ {
if (iter == NULL) if (iter == NULL)
{ {
CCLOGWARN("Failed to load properties object from url."); AXLOGWARN("Failed to load properties object from url.");
return nullptr; return nullptr;
} }
@ -1185,7 +1185,7 @@ bool Properties::parseVec2(const char* str, Vec2* out)
} }
else else
{ {
CCLOGWARN("Error attempting to parse property as a two-dimensional vector: %s", str); AXLOGWARN("Error attempting to parse property as a two-dimensional vector: %s", str);
} }
} }
@ -1207,7 +1207,7 @@ bool Properties::parseVec3(const char* str, Vec3* out)
} }
else else
{ {
CCLOGWARN("Error attempting to parse property as a three-dimensional vector: %s", str); AXLOGWARN("Error attempting to parse property as a three-dimensional vector: %s", str);
} }
} }
@ -1229,7 +1229,7 @@ bool Properties::parseVec4(const char* str, Vec4* out)
} }
else else
{ {
CCLOGWARN("Error attempting to parse property as a four-dimensional vector: %s", str); AXLOGWARN("Error attempting to parse property as a four-dimensional vector: %s", str);
} }
} }
@ -1251,7 +1251,7 @@ bool Properties::parseAxisAngle(const char* str, Quaternion* out)
} }
else else
{ {
CCLOGWARN("Error attempting to parse property as an axis-angle rotation: %s", str); AXLOGWARN("Error attempting to parse property as an axis-angle rotation: %s", str);
} }
} }
@ -1277,13 +1277,13 @@ bool Properties::parseColor(const char* str, Vec3* out)
else else
{ {
// Invalid format // Invalid format
CCLOGWARN("Error attempting to parse property as an RGB color: %s", str); AXLOGWARN("Error attempting to parse property as an RGB color: %s", str);
} }
} }
else else
{ {
// Not a color string. // Not a color string.
CCLOGWARN("Error attempting to parse property as an RGB color (not specified as a color string): %s", str); AXLOGWARN("Error attempting to parse property as an RGB color (not specified as a color string): %s", str);
} }
} }
@ -1309,13 +1309,13 @@ bool Properties::parseColor(const char* str, Vec4* out)
else else
{ {
// Invalid format // Invalid format
CCLOGWARN("Error attempting to parse property as an RGBA color: %s", str); AXLOGWARN("Error attempting to parse property as an RGBA color: %s", str);
} }
} }
else else
{ {
// Not a color string. // Not a color string.
CCLOGWARN("Error attempting to parse property as an RGBA color (not specified as a color string): %s", str); AXLOGWARN("Error attempting to parse property as an RGBA color (not specified as a color string): %s", str);
} }
} }

View File

@ -80,18 +80,18 @@ Ref::~Ref()
void Ref::retain() void Ref::retain()
{ {
CCASSERT(_referenceCount > 0, "reference count should be greater than 0"); AXASSERT(_referenceCount > 0, "reference count should be greater than 0");
++_referenceCount; ++_referenceCount;
} }
void Ref::release() void Ref::release()
{ {
CCASSERT(_referenceCount > 0, "reference count should be greater than 0"); AXASSERT(_referenceCount > 0, "reference count should be greater than 0");
--_referenceCount; --_referenceCount;
if (_referenceCount == 0) if (_referenceCount == 0)
{ {
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0) #if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
auto poolManager = PoolManager::getInstance(); auto poolManager = PoolManager::getInstance();
if (!poolManager->getCurrentPool()->isClearing() && poolManager->isObjectInPools(this)) if (!poolManager->getCurrentPool()->isClearing() && poolManager->isObjectInPools(this))
{ {
@ -123,7 +123,7 @@ void Ref::release()
// auto obj = Node::create(); // auto obj = Node::create();
// obj->retain(); // obj->retain();
// obj->release(); // This `release` is the pair of `retain` of previous line. // obj->release(); // This `release` is the pair of `retain` of previous line.
CCASSERT(false, "The reference shouldn't be 0 because it is still in autorelease pool."); AXASSERT(false, "The reference shouldn't be 0 because it is still in autorelease pool.");
} }
#endif #endif
@ -175,7 +175,7 @@ void Ref::printLeaks()
static void trackRef(Ref* ref) static void trackRef(Ref* ref)
{ {
std::lock_guard<std::mutex> refLockGuard(__refMutex); std::lock_guard<std::mutex> refLockGuard(__refMutex);
CCASSERT(ref, "Invalid parameter, ref should not be null!"); AXASSERT(ref, "Invalid parameter, ref should not be null!");
// Create memory allocation record. // Create memory allocation record.
__refAllocationList.push_back(ref); __refAllocationList.push_back(ref);

View File

@ -160,13 +160,13 @@ public:
T& operator*() const T& operator*() const
{ {
CCASSERT(_ptr, "Attempt to dereference a null pointer!"); AXASSERT(_ptr, "Attempt to dereference a null pointer!");
return *_ptr; return *_ptr;
} }
T* operator->() const T* operator->() const
{ {
CCASSERT(_ptr, "Attempt to dereference a null pointer!"); AXASSERT(_ptr, "Attempt to dereference a null pointer!");
return _ptr; return _ptr;
} }

View File

@ -296,8 +296,8 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
bool paused, bool paused,
std::string_view key) std::string_view key)
{ {
CCASSERT(target, "Argument target must be non-nullptr"); AXASSERT(target, "Argument target must be non-nullptr");
CCASSERT(!key.empty(), "key should not be empty!"); AXASSERT(!key.empty(), "key should not be empty!");
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); HASH_FIND_PTR(_hashForTimers, &target, element);
@ -314,7 +314,7 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
} }
else else
{ {
CCASSERT(element->paused == paused, "element's paused should be paused!"); AXASSERT(element->paused == paused, "element's paused should be paused!");
} }
if (element->timers == nullptr) if (element->timers == nullptr)
@ -329,7 +329,7 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
if (timer && !timer->isExhausted() && key == timer->getKey()) if (timer && !timer->isExhausted() && key == timer->getKey())
{ {
CCLOG("CCScheduler#schedule. Reiniting timer with interval %.4f, repeat %u, delay %.4f", interval, AXLOG("CCScheduler#schedule. Reiniting timer with interval %.4f, repeat %u, delay %.4f", interval,
repeat, delay); repeat, delay);
timer->setupTimerWithInterval(interval, repeat, delay); timer->setupTimerWithInterval(interval, repeat, delay);
return; return;
@ -352,8 +352,8 @@ void Scheduler::unschedule(std::string_view key, void* target)
return; return;
} }
// CCASSERT(target); // AXASSERT(target);
// CCASSERT(selector); // AXASSERT(selector);
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); HASH_FIND_PTR(_hashForTimers, &target, element);
@ -514,8 +514,8 @@ void Scheduler::schedulePerFrame(const ccSchedulerFunc& callback, void* target,
bool Scheduler::isScheduled(std::string_view key, const void* target) const bool Scheduler::isScheduled(std::string_view key, const void* target) const
{ {
CCASSERT(!key.empty(), "Argument key must not be empty"); AXASSERT(!key.empty(), "Argument key must not be empty");
CCASSERT(target, "Argument target must be non-nullptr"); AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); HASH_FIND_PTR(_hashForTimers, &target, element);
@ -688,7 +688,7 @@ void Scheduler::unscheduleScriptEntry(unsigned int scheduleScriptEntryID)
void Scheduler::resumeTarget(void* target) void Scheduler::resumeTarget(void* target)
{ {
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
// custom selectors // custom selectors
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
@ -703,14 +703,14 @@ void Scheduler::resumeTarget(void* target)
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate); HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate) if (elementUpdate)
{ {
CCASSERT(elementUpdate->entry != nullptr, "elementUpdate's entry can't be nullptr!"); AXASSERT(elementUpdate->entry != nullptr, "elementUpdate's entry can't be nullptr!");
elementUpdate->entry->paused = false; elementUpdate->entry->paused = false;
} }
} }
void Scheduler::pauseTarget(void* target) void Scheduler::pauseTarget(void* target)
{ {
CCASSERT(target != nullptr, "target can't be nullptr!"); AXASSERT(target != nullptr, "target can't be nullptr!");
// custom selectors // custom selectors
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
@ -725,14 +725,14 @@ void Scheduler::pauseTarget(void* target)
HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate); HASH_FIND_PTR(_hashForUpdates, &target, elementUpdate);
if (elementUpdate) if (elementUpdate)
{ {
CCASSERT(elementUpdate->entry != nullptr, "elementUpdate's entry can't be nullptr!"); AXASSERT(elementUpdate->entry != nullptr, "elementUpdate's entry can't be nullptr!");
elementUpdate->entry->paused = true; elementUpdate->entry->paused = true;
} }
} }
bool Scheduler::isTargetPaused(void* target) bool Scheduler::isTargetPaused(void* target)
{ {
CCASSERT(target != nullptr, "target must be non nil"); AXASSERT(target != nullptr, "target must be non nil");
// Custom selectors // Custom selectors
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
@ -880,7 +880,7 @@ void Scheduler::update(float dt)
for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex)) for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(elt->timerIndex))
{ {
elt->currentTimer = (Timer*)(elt->timers->arr[elt->timerIndex]); elt->currentTimer = (Timer*)(elt->timers->arr[elt->timerIndex]);
CCASSERT(!elt->currentTimer->isAborted(), "An aborted timer should not be updated"); AXASSERT(!elt->currentTimer->isAborted(), "An aborted timer should not be updated");
elt->currentTimer->update(dt); elt->currentTimer->update(dt);
@ -966,7 +966,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
float delay, float delay,
bool paused) bool paused)
{ {
CCASSERT(target, "Argument target must be non-nullptr"); AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); HASH_FIND_PTR(_hashForTimers, &target, element);
@ -983,7 +983,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
} }
else else
{ {
CCASSERT(element->paused == paused, "element's paused should be paused."); AXASSERT(element->paused == paused, "element's paused should be paused.");
} }
if (element->timers == nullptr) if (element->timers == nullptr)
@ -998,7 +998,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
if (timer && !timer->isExhausted() && selector == timer->getSelector()) if (timer && !timer->isExhausted() && selector == timer->getSelector())
{ {
CCLOG("CCScheduler#schedule. Reiniting timer with interval %.4f, repeat %u, delay %.4f", interval, AXLOG("CCScheduler#schedule. Reiniting timer with interval %.4f, repeat %u, delay %.4f", interval,
repeat, delay); repeat, delay);
timer->setupTimerWithInterval(interval, repeat, delay); timer->setupTimerWithInterval(interval, repeat, delay);
return; return;
@ -1020,8 +1020,8 @@ void Scheduler::schedule(SEL_SCHEDULE selector, Ref* target, float interval, boo
bool Scheduler::isScheduled(SEL_SCHEDULE selector, const Ref* target) const bool Scheduler::isScheduled(SEL_SCHEDULE selector, const Ref* target) const
{ {
CCASSERT(selector, "Argument selector must be non-nullptr"); AXASSERT(selector, "Argument selector must be non-nullptr");
CCASSERT(target, "Argument target must be non-nullptr"); AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr; tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element); HASH_FIND_PTR(_hashForTimers, &target, element);

View File

@ -458,7 +458,7 @@ bool Value::operator==(const Value& v) const
/// Convert value to a specified type /// Convert value to a specified type
unsigned char Value::asByte(unsigned char defaultValue) const unsigned char Value::asByte(unsigned char defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
@ -491,7 +491,7 @@ unsigned char Value::asByte(unsigned char defaultValue) const
int Value::asInt(int defaultValue) const int Value::asInt(int defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -523,7 +523,7 @@ int Value::asInt(int defaultValue) const
unsigned int Value::asUint(unsigned int defaultValue) const unsigned int Value::asUint(unsigned int defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -556,7 +556,7 @@ unsigned int Value::asUint(unsigned int defaultValue) const
int64_t Value::asInt64(int64_t defaultValue) const int64_t Value::asInt64(int64_t defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -589,7 +589,7 @@ int64_t Value::asInt64(int64_t defaultValue) const
uint64_t Value::asUint64(uint64_t defaultValue) const uint64_t Value::asUint64(uint64_t defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -622,7 +622,7 @@ uint64_t Value::asUint64(uint64_t defaultValue) const
float Value::asFloat(float defaultValue) const float Value::asFloat(float defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -654,7 +654,7 @@ float Value::asFloat(float defaultValue) const
double Value::asDouble(double defaultValue) const double Value::asDouble(double defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -686,7 +686,7 @@ double Value::asDouble(double defaultValue) const
bool Value::asBool(bool defaultValue) const bool Value::asBool(bool defaultValue) const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
switch (_type) switch (_type)
{ {
@ -718,7 +718,7 @@ bool Value::asBool(bool defaultValue) const
std::string Value::asString() const std::string Value::asString() const
{ {
CCASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP, AXASSERT(_type != Type::VECTOR && _type != Type::MAP && _type != Type::INT_KEY_MAP,
"Only base type (bool, string, float, double, int) could be converted"); "Only base type (bool, string, float, double, int) could be converted");
if (_type == Type::STRING) if (_type == Type::STRING)
@ -778,37 +778,37 @@ std::string_view Value::asStringRef() const
ValueVector& Value::asValueVector() ValueVector& Value::asValueVector()
{ {
CCASSERT(_type == Type::VECTOR, "The value type isn't Type::VECTOR"); AXASSERT(_type == Type::VECTOR, "The value type isn't Type::VECTOR");
return *_field.vectorVal; return *_field.vectorVal;
} }
const ValueVector& Value::asValueVector() const const ValueVector& Value::asValueVector() const
{ {
CCASSERT(_type == Type::VECTOR, "The value type isn't Type::VECTOR"); AXASSERT(_type == Type::VECTOR, "The value type isn't Type::VECTOR");
return *_field.vectorVal; return *_field.vectorVal;
} }
ValueMap& Value::asValueMap() ValueMap& Value::asValueMap()
{ {
CCASSERT(_type == Type::MAP, "The value type isn't Type::MAP"); AXASSERT(_type == Type::MAP, "The value type isn't Type::MAP");
return *_field.mapVal; return *_field.mapVal;
} }
const ValueMap& Value::asValueMap() const const ValueMap& Value::asValueMap() const
{ {
CCASSERT(_type == Type::MAP, "The value type isn't Type::MAP"); AXASSERT(_type == Type::MAP, "The value type isn't Type::MAP");
return *_field.mapVal; return *_field.mapVal;
} }
ValueMapIntKey& Value::asIntKeyMap() ValueMapIntKey& Value::asIntKeyMap()
{ {
CCASSERT(_type == Type::INT_KEY_MAP, "The value type isn't Type::INT_KEY_MAP"); AXASSERT(_type == Type::INT_KEY_MAP, "The value type isn't Type::INT_KEY_MAP");
return *_field.intKeyMapVal; return *_field.intKeyMapVal;
} }
const ValueMapIntKey& Value::asIntKeyMap() const const ValueMapIntKey& Value::asIntKeyMap() const
{ {
CCASSERT(_type == Type::INT_KEY_MAP, "The value type isn't Type::INT_KEY_MAP"); AXASSERT(_type == Type::INT_KEY_MAP, "The value type isn't Type::INT_KEY_MAP");
return *_field.intKeyMapVal; return *_field.intKeyMapVal;
} }
@ -892,7 +892,7 @@ static std::string visit(const Value& v, int depth)
ret << visitMap(v.asIntKeyMap(), depth); ret << visitMap(v.asIntKeyMap(), depth);
break; break;
default: default:
CCASSERT(false, "Invalid type!"); AXASSERT(false, "Invalid type!");
break; break;
} }

View File

@ -120,7 +120,7 @@ public:
explicit Vector<T>(ssize_t capacity) : _data() explicit Vector<T>(ssize_t capacity) : _data()
{ {
static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!"); static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!");
CCLOGINFO("In the default constructor with capacity of Vector."); AXLOGINFO("In the default constructor with capacity of Vector.");
reserve(capacity); reserve(capacity);
} }
@ -136,7 +136,7 @@ public:
/** Destructor. */ /** Destructor. */
~Vector<T>() ~Vector<T>()
{ {
CCLOGINFO("In the destructor of Vector."); AXLOGINFO("In the destructor of Vector.");
clear(); clear();
} }
@ -144,7 +144,7 @@ public:
Vector<T>(const Vector<T>& other) Vector<T>(const Vector<T>& other)
{ {
static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!"); static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!");
CCLOGINFO("In the copy constructor!"); AXLOGINFO("In the copy constructor!");
_data = other._data; _data = other._data;
addRefForAllObjects(); addRefForAllObjects();
} }
@ -153,7 +153,7 @@ public:
Vector<T>(Vector<T>&& other) Vector<T>(Vector<T>&& other)
{ {
static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!"); static_assert(std::is_convertible<T, Ref*>::value, "Invalid Type for axis::Vector<T>!");
CCLOGINFO("In the move constructor of Vector!"); AXLOGINFO("In the move constructor of Vector!");
_data = std::move(other._data); _data = std::move(other._data);
} }
@ -162,7 +162,7 @@ public:
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the copy assignment operator!"); AXLOGINFO("In the copy assignment operator!");
clear(); clear();
_data = other._data; _data = other._data;
addRefForAllObjects(); addRefForAllObjects();
@ -175,7 +175,7 @@ public:
{ {
if (this != &other) if (this != &other)
{ {
CCLOGINFO("In the move assignment operator!"); AXLOGINFO("In the move assignment operator!");
clear(); clear();
_data = std::move(other._data); _data = std::move(other._data);
} }
@ -251,7 +251,7 @@ public:
/** Returns the element at position 'index' in the Vector. */ /** Returns the element at position 'index' in the Vector. */
T at(ssize_t index) const T at(ssize_t index) const
{ {
CCASSERT(index >= 0 && index < size(), "index out of range in getObjectAtIndex()"); AXASSERT(index >= 0 && index < size(), "index out of range in getObjectAtIndex()");
return _data[index]; return _data[index];
} }
@ -305,7 +305,7 @@ public:
/** Adds a new element at the end of the Vector. */ /** Adds a new element at the end of the Vector. */
void pushBack(T object) void pushBack(T object)
{ {
CCASSERT(object != nullptr, "The object should not be nullptr"); AXASSERT(object != nullptr, "The object should not be nullptr");
_data.push_back(object); _data.push_back(object);
object->retain(); object->retain();
} }
@ -327,8 +327,8 @@ public:
*/ */
void insert(ssize_t index, T object) void insert(ssize_t index, T object)
{ {
CCASSERT(index >= 0 && index <= size(), "Invalid index!"); AXASSERT(index >= 0 && index <= size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr"); AXASSERT(object != nullptr, "The object should not be nullptr");
_data.insert((std::begin(_data) + index), object); _data.insert((std::begin(_data) + index), object);
object->retain(); object->retain();
} }
@ -338,7 +338,7 @@ public:
/** Removes the last element in the Vector. */ /** Removes the last element in the Vector. */
void popBack() void popBack()
{ {
CCASSERT(!_data.empty(), "no objects added"); AXASSERT(!_data.empty(), "no objects added");
auto last = _data.back(); auto last = _data.back();
_data.pop_back(); _data.pop_back();
last->release(); last->release();
@ -351,7 +351,7 @@ public:
*/ */
void eraseObject(T object, bool removeAll = false) void eraseObject(T object, bool removeAll = false)
{ {
CCASSERT(object != nullptr, "The object should not be nullptr"); AXASSERT(object != nullptr, "The object should not be nullptr");
if (removeAll) if (removeAll)
{ {
@ -386,7 +386,7 @@ public:
*/ */
iterator erase(iterator position) iterator erase(iterator position)
{ {
CCASSERT(position >= _data.begin() && position < _data.end(), "Invalid position!"); AXASSERT(position >= _data.begin() && position < _data.end(), "Invalid position!");
(*position)->release(); (*position)->release();
return _data.erase(position); return _data.erase(position);
} }
@ -413,7 +413,7 @@ public:
*/ */
iterator erase(ssize_t index) iterator erase(ssize_t index)
{ {
CCASSERT(!_data.empty() && index >= 0 && index < size(), "Invalid index!"); AXASSERT(!_data.empty() && index >= 0 && index < size(), "Invalid index!");
auto it = std::next(begin(), index); auto it = std::next(begin(), index);
(*it)->release(); (*it)->release();
return _data.erase(it); return _data.erase(it);
@ -439,7 +439,7 @@ public:
ssize_t idx1 = getIndex(object1); ssize_t idx1 = getIndex(object1);
ssize_t idx2 = getIndex(object2); ssize_t idx2 = getIndex(object2);
CCASSERT(idx1 >= 0 && idx2 >= 0, "invalid object index"); AXASSERT(idx1 >= 0 && idx2 >= 0, "invalid object index");
std::swap(_data[idx1], _data[idx2]); std::swap(_data[idx1], _data[idx2]);
} }
@ -447,7 +447,7 @@ public:
/** Swap two elements by indexes. */ /** Swap two elements by indexes. */
void swap(ssize_t index1, ssize_t index2) void swap(ssize_t index1, ssize_t index2)
{ {
CCASSERT(index1 >= 0 && index1 < size() && index2 >= 0 && index2 < size(), "Invalid indices"); AXASSERT(index1 >= 0 && index1 < size() && index2 >= 0 && index2 < size(), "Invalid indices");
std::swap(_data[index1], _data[index2]); std::swap(_data[index1], _data[index2]);
} }
@ -455,8 +455,8 @@ public:
/** Replace value at index with given object. */ /** Replace value at index with given object. */
void replace(ssize_t index, T object) void replace(ssize_t index, T object)
{ {
CCASSERT(index >= 0 && index < size(), "Invalid index!"); AXASSERT(index >= 0 && index < size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr"); AXASSERT(object != nullptr, "The object should not be nullptr");
_data[index]->release(); _data[index]->release();
_data[index] = object; _data[index] = object;

View File

@ -70,16 +70,16 @@ inline void ZipUtils::decodeEncodedPvr(unsigned int* data, ssize_t len)
// check if key was set // check if key was set
// make sure to call caw_setkey_part() for all 4 key parts // make sure to call caw_setkey_part() for all 4 key parts
CCASSERT(s_uEncryptedPvrKeyParts[0] != 0, AXASSERT(s_uEncryptedPvrKeyParts[0] != 0,
"Cocos2D: CCZ file is encrypted but key part 0 is not set. Did you call " "Cocos2D: CCZ file is encrypted but key part 0 is not set. Did you call "
"ZipUtils::setPvrEncryptionKeyPart(...)?"); "ZipUtils::setPvrEncryptionKeyPart(...)?");
CCASSERT(s_uEncryptedPvrKeyParts[1] != 0, AXASSERT(s_uEncryptedPvrKeyParts[1] != 0,
"Cocos2D: CCZ file is encrypted but key part 1 is not set. Did you call " "Cocos2D: CCZ file is encrypted but key part 1 is not set. Did you call "
"ZipUtils::setPvrEncryptionKeyPart(...)?"); "ZipUtils::setPvrEncryptionKeyPart(...)?");
CCASSERT(s_uEncryptedPvrKeyParts[2] != 0, AXASSERT(s_uEncryptedPvrKeyParts[2] != 0,
"Cocos2D: CCZ file is encrypted but key part 2 is not set. Did you call " "Cocos2D: CCZ file is encrypted but key part 2 is not set. Did you call "
"ZipUtils::setPvrEncryptionKeyPart(...)?"); "ZipUtils::setPvrEncryptionKeyPart(...)?");
CCASSERT(s_uEncryptedPvrKeyParts[3] != 0, AXASSERT(s_uEncryptedPvrKeyParts[3] != 0,
"Cocos2D: CCZ file is encrypted but key part 3 is not set. Did you call " "Cocos2D: CCZ file is encrypted but key part 3 is not set. Did you call "
"ZipUtils::setPvrEncryptionKeyPart(...)?"); "ZipUtils::setPvrEncryptionKeyPart(...)?");
@ -211,7 +211,7 @@ int ZipUtils::inflateMemoryWithHint(unsigned char* in,
/* not enough memory, ouch */ /* not enough memory, ouch */
if (!*out) if (!*out)
{ {
CCLOG("cocos2d: ZipUtils: realloc failed"); AXLOG("cocos2d: ZipUtils: realloc failed");
inflateEnd(&d_stream); inflateEnd(&d_stream);
return Z_MEM_ERROR; return Z_MEM_ERROR;
} }
@ -236,19 +236,19 @@ ssize_t ZipUtils::inflateMemoryWithHint(unsigned char* in, ssize_t inLength, uns
{ {
if (err == Z_MEM_ERROR) if (err == Z_MEM_ERROR)
{ {
CCLOG("cocos2d: ZipUtils: Out of memory while decompressing map data!"); AXLOG("cocos2d: ZipUtils: Out of memory while decompressing map data!");
} }
else if (err == Z_VERSION_ERROR) else if (err == Z_VERSION_ERROR)
{ {
CCLOG("cocos2d: ZipUtils: Incompatible zlib version!"); AXLOG("cocos2d: ZipUtils: Incompatible zlib version!");
} }
else if (err == Z_DATA_ERROR) else if (err == Z_DATA_ERROR)
{ {
CCLOG("cocos2d: ZipUtils: Incorrect zlib compressed data!"); AXLOG("cocos2d: ZipUtils: Incorrect zlib compressed data!");
} }
else else
{ {
CCLOG("cocos2d: ZipUtils: Unknown error while decompressing map data!"); AXLOG("cocos2d: ZipUtils: Unknown error while decompressing map data!");
} }
if (*out) if (*out)
@ -273,13 +273,13 @@ int ZipUtils::inflateGZipFile(const char* path, unsigned char** out)
int len; int len;
unsigned int offset = 0; unsigned int offset = 0;
CCASSERT(out, "out can't be nullptr."); AXASSERT(out, "out can't be nullptr.");
CCASSERT(&*out, "&*out can't be nullptr."); AXASSERT(&*out, "&*out can't be nullptr.");
gzFile inFile = gzopen(path, "rb"); gzFile inFile = gzopen(path, "rb");
if (inFile == nullptr) if (inFile == nullptr)
{ {
CCLOG("cocos2d: ZipUtils: error open gzip file: %s", path); AXLOG("cocos2d: ZipUtils: error open gzip file: %s", path);
return -1; return -1;
} }
@ -290,7 +290,7 @@ int ZipUtils::inflateGZipFile(const char* path, unsigned char** out)
*out = (unsigned char*)malloc(bufferSize); *out = (unsigned char*)malloc(bufferSize);
if (*out == NULL) if (*out == NULL)
{ {
CCLOG("cocos2d: ZipUtils: out of memory"); AXLOG("cocos2d: ZipUtils: out of memory");
return -1; return -1;
} }
@ -299,7 +299,7 @@ int ZipUtils::inflateGZipFile(const char* path, unsigned char** out)
len = gzread(inFile, *out + offset, bufferSize); len = gzread(inFile, *out + offset, bufferSize);
if (len < 0) if (len < 0)
{ {
CCLOG("cocos2d: ZipUtils: error in gzread"); AXLOG("cocos2d: ZipUtils: error in gzread");
free(*out); free(*out);
*out = nullptr; *out = nullptr;
return -1; return -1;
@ -323,7 +323,7 @@ int ZipUtils::inflateGZipFile(const char* path, unsigned char** out)
if (!tmp) if (!tmp)
{ {
CCLOG("cocos2d: ZipUtils: out of memory"); AXLOG("cocos2d: ZipUtils: out of memory");
free(*out); free(*out);
*out = nullptr; *out = nullptr;
return -1; return -1;
@ -334,7 +334,7 @@ int ZipUtils::inflateGZipFile(const char* path, unsigned char** out)
if (gzclose(inFile) != Z_OK) if (gzclose(inFile) != Z_OK)
{ {
CCLOG("cocos2d: ZipUtils: gzclose failed"); AXLOG("cocos2d: ZipUtils: gzclose failed");
} }
return offset; return offset;
@ -347,7 +347,7 @@ bool ZipUtils::isCCZFile(const char* path)
if (compressedData.isNull()) if (compressedData.isNull())
{ {
CCLOG("cocos2d: ZipUtils: loading file failed"); AXLOG("cocos2d: ZipUtils: loading file failed");
return false; return false;
} }
@ -373,7 +373,7 @@ bool ZipUtils::isGZipFile(const char* path)
if (compressedData.isNull()) if (compressedData.isNull())
{ {
CCLOG("cocos2d: ZipUtils: loading file failed"); AXLOG("cocos2d: ZipUtils: loading file failed");
return false; return false;
} }
@ -401,14 +401,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
unsigned int version = AX_SWAP_INT16_BIG_TO_HOST(header->version); unsigned int version = AX_SWAP_INT16_BIG_TO_HOST(header->version);
if (version > 2) if (version > 2)
{ {
CCLOG("cocos2d: Unsupported CCZ header format"); AXLOG("cocos2d: Unsupported CCZ header format");
return -1; return -1;
} }
// verify compression format // verify compression format
if (AX_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB) if (AX_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB)
{ {
CCLOG("cocos2d: CCZ Unsupported compression method"); AXLOG("cocos2d: CCZ Unsupported compression method");
return -1; return -1;
} }
} }
@ -421,14 +421,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
unsigned int version = AX_SWAP_INT16_BIG_TO_HOST(header->version); unsigned int version = AX_SWAP_INT16_BIG_TO_HOST(header->version);
if (version > 0) if (version > 0)
{ {
CCLOG("cocos2d: Unsupported CCZ header format"); AXLOG("cocos2d: Unsupported CCZ header format");
return -1; return -1;
} }
// verify compression format // verify compression format
if (AX_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB) if (AX_SWAP_INT16_BIG_TO_HOST(header->compression_type) != CCZ_COMPRESSION_ZLIB)
{ {
CCLOG("cocos2d: CCZ Unsupported compression method"); AXLOG("cocos2d: CCZ Unsupported compression method");
return -1; return -1;
} }
@ -438,21 +438,21 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
decodeEncodedPvr(ints, enclen); decodeEncodedPvr(ints, enclen);
#if COCOS2D_DEBUG > 0 #if AXIS_DEBUG > 0
// verify checksum in debug mode // verify checksum in debug mode
unsigned int calculated = checksumPvr(ints, enclen); unsigned int calculated = checksumPvr(ints, enclen);
unsigned int required = AX_SWAP_INT32_BIG_TO_HOST(header->reserved); unsigned int required = AX_SWAP_INT32_BIG_TO_HOST(header->reserved);
if (calculated != required) if (calculated != required)
{ {
CCLOG("cocos2d: Can't decrypt image file. Is the decryption key valid?"); AXLOG("cocos2d: Can't decrypt image file. Is the decryption key valid?");
return -1; return -1;
} }
#endif #endif
} }
else else
{ {
CCLOG("cocos2d: Invalid CCZ file"); AXLOG("cocos2d: Invalid CCZ file");
return -1; return -1;
} }
@ -461,7 +461,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
*out = (unsigned char*)malloc(len); *out = (unsigned char*)malloc(len);
if (!*out) if (!*out)
{ {
CCLOG("cocos2d: CCZ: Failed to allocate memory for texture"); AXLOG("cocos2d: CCZ: Failed to allocate memory for texture");
return -1; return -1;
} }
@ -471,7 +471,7 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
if (ret != Z_OK) if (ret != Z_OK)
{ {
CCLOG("cocos2d: CCZ: Failed to uncompress data"); AXLOG("cocos2d: CCZ: Failed to uncompress data");
free(*out); free(*out);
*out = nullptr; *out = nullptr;
return -1; return -1;
@ -482,14 +482,14 @@ int ZipUtils::inflateCCZBuffer(const unsigned char* buffer, ssize_t bufferLen, u
int ZipUtils::inflateCCZFile(const char* path, unsigned char** out) int ZipUtils::inflateCCZFile(const char* path, unsigned char** out)
{ {
CCASSERT(out, "Invalid pointer for buffer!"); AXASSERT(out, "Invalid pointer for buffer!");
// load file into memory // load file into memory
Data compressedData = FileUtils::getInstance()->getDataFromFile(path); Data compressedData = FileUtils::getInstance()->getDataFromFile(path);
if (compressedData.isNull()) if (compressedData.isNull())
{ {
CCLOG("cocos2d: Error loading CCZ compressed file"); AXLOG("cocos2d: Error loading CCZ compressed file");
return -1; return -1;
} }
@ -498,8 +498,8 @@ int ZipUtils::inflateCCZFile(const char* path, unsigned char** out)
void ZipUtils::setPvrEncryptionKeyPart(int index, unsigned int value) void ZipUtils::setPvrEncryptionKeyPart(int index, unsigned int value)
{ {
CCASSERT(index >= 0, "Cocos2d: key part index cannot be less than 0"); AXASSERT(index >= 0, "Cocos2d: key part index cannot be less than 0");
CCASSERT(index <= 3, "Cocos2d: key part index cannot be greater than 3"); AXASSERT(index <= 3, "Cocos2d: key part index cannot be greater than 3");
if (s_uEncryptedPvrKeyParts[index] != value) if (s_uEncryptedPvrKeyParts[index] != value)
{ {
@ -817,7 +817,7 @@ unsigned char* ZipFile::getFileData(std::string_view fileName, ssize_t* size)
buffer = (unsigned char*)malloc(fileInfo.uncompressed_size); buffer = (unsigned char*)malloc(fileInfo.uncompressed_size);
int AX_UNUSED nSize = int AX_UNUSED nSize =
unzReadCurrentFile(_data->zipFile, buffer, static_cast<unsigned int>(fileInfo.uncompressed_size)); unzReadCurrentFile(_data->zipFile, buffer, static_cast<unsigned int>(fileInfo.uncompressed_size));
CCASSERT(nSize == 0 || nSize == (int)fileInfo.uncompressed_size, "the file size is wrong"); AXASSERT(nSize == 0 || nSize == (int)fileInfo.uncompressed_size, "the file size is wrong");
if (size) if (size)
{ {
@ -853,7 +853,7 @@ bool ZipFile::getFileData(std::string_view fileName, ResizableBuffer* buffer)
buffer->resize(fileInfo.uncompressed_size); buffer->resize(fileInfo.uncompressed_size);
int AX_UNUSED nSize = int AX_UNUSED nSize =
unzReadCurrentFile(_data->zipFile, buffer->buffer(), static_cast<unsigned int>(fileInfo.uncompressed_size)); unzReadCurrentFile(_data->zipFile, buffer->buffer(), static_cast<unsigned int>(fileInfo.uncompressed_size));
CCASSERT(nSize == 0 || nSize == (int)fileInfo.uncompressed_size, "the file size is wrong"); AXASSERT(nSize == 0 || nSize == (int)fileInfo.uncompressed_size, "the file size is wrong");
unzCloseCurrentFile(_data->zipFile); unzCloseCurrentFile(_data->zipFile);
res = true; res = true;
} while (0); } while (0);
@ -1034,7 +1034,7 @@ unsigned char* ZipFile::getFileDataFromZip(std::string_view zipFilePath, std::st
buffer = (unsigned char*)malloc(fileInfo.uncompressed_size); buffer = (unsigned char*)malloc(fileInfo.uncompressed_size);
int AX_UNUSED readedSize = unzReadCurrentFile(file, buffer, static_cast<unsigned>(fileInfo.uncompressed_size)); int AX_UNUSED readedSize = unzReadCurrentFile(file, buffer, static_cast<unsigned>(fileInfo.uncompressed_size));
CCASSERT(readedSize == 0 || readedSize == (int)fileInfo.uncompressed_size, "the file size is wrong"); AXASSERT(readedSize == 0 || readedSize == (int)fileInfo.uncompressed_size, "the file size is wrong");
*size = fileInfo.uncompressed_size; *size = fileInfo.uncompressed_size;
unzCloseCurrentFile(file); unzCloseCurrentFile(file);

View File

@ -64,7 +64,7 @@ void ccArrayDoubleCapacity(ccArray* arr)
arr->max *= 2; arr->max *= 2;
Ref** newArr = (Ref**)realloc(arr->arr, arr->max * sizeof(Ref*)); Ref** newArr = (Ref**)realloc(arr->arr, arr->max * sizeof(Ref*));
// will fail when there's not enough memory // will fail when there's not enough memory
CCASSERT(newArr != 0, "ccArrayDoubleCapacity failed. Not enough memory"); AXASSERT(newArr != 0, "ccArrayDoubleCapacity failed. Not enough memory");
arr->arr = newArr; arr->arr = newArr;
} }
@ -72,7 +72,7 @@ void ccArrayEnsureExtraCapacity(ccArray* arr, ssize_t extra)
{ {
while (arr->max < arr->num + extra) while (arr->max < arr->num + extra)
{ {
CCLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%zd] to [%zd].", arr->max, arr->max * 2); AXLOGINFO("cocos2d: ccCArray: resizing ccArray capacity from [%zd] to [%zd].", arr->max, arr->max * 2);
ccArrayDoubleCapacity(arr); ccArrayDoubleCapacity(arr);
} }
@ -97,7 +97,7 @@ void ccArrayShrink(ccArray* arr)
} }
arr->arr = (Ref**)realloc(arr->arr, newSize * sizeof(Ref*)); arr->arr = (Ref**)realloc(arr->arr, newSize * sizeof(Ref*));
CCASSERT(arr->arr != nullptr, "could not reallocate the memory"); AXASSERT(arr->arr != nullptr, "could not reallocate the memory");
} }
} }
@ -124,7 +124,7 @@ bool ccArrayContainsObject(ccArray* arr, Ref* object)
/** Appends an object. Behavior undefined if array doesn't have enough capacity. */ /** Appends an object. Behavior undefined if array doesn't have enough capacity. */
void ccArrayAppendObject(ccArray* arr, Ref* object) void ccArrayAppendObject(ccArray* arr, Ref* object)
{ {
CCASSERT(object != nullptr, "Invalid parameter!"); AXASSERT(object != nullptr, "Invalid parameter!");
object->retain(); object->retain();
arr->arr[arr->num] = object; arr->arr[arr->num] = object;
arr->num++; arr->num++;
@ -157,8 +157,8 @@ void ccArrayAppendArrayWithResize(ccArray* arr, ccArray* plusArr)
/** Inserts an object at index */ /** Inserts an object at index */
void ccArrayInsertObjectAtIndex(ccArray* arr, Ref* object, ssize_t index) void ccArrayInsertObjectAtIndex(ccArray* arr, Ref* object, ssize_t index)
{ {
CCASSERT(index <= arr->num, "Invalid index. Out of bounds"); AXASSERT(index <= arr->num, "Invalid index. Out of bounds");
CCASSERT(object != nullptr, "Invalid parameter!"); AXASSERT(object != nullptr, "Invalid parameter!");
ccArrayEnsureExtraCapacity(arr, 1); ccArrayEnsureExtraCapacity(arr, 1);
@ -176,8 +176,8 @@ void ccArrayInsertObjectAtIndex(ccArray* arr, Ref* object, ssize_t index)
/** Swaps two objects */ /** Swaps two objects */
void ccArraySwapObjectsAtIndexes(ccArray* arr, ssize_t index1, ssize_t index2) void ccArraySwapObjectsAtIndexes(ccArray* arr, ssize_t index1, ssize_t index2)
{ {
CCASSERT(index1 >= 0 && index1 < arr->num, "(1) Invalid index. Out of bounds"); AXASSERT(index1 >= 0 && index1 < arr->num, "(1) Invalid index. Out of bounds");
CCASSERT(index2 >= 0 && index2 < arr->num, "(2) Invalid index. Out of bounds"); AXASSERT(index2 >= 0 && index2 < arr->num, "(2) Invalid index. Out of bounds");
Ref* object1 = arr->arr[index1]; Ref* object1 = arr->arr[index1];
@ -198,7 +198,7 @@ void ccArrayRemoveAllObjects(ccArray* arr)
Behavior undefined if index outside [0, num-1]. */ Behavior undefined if index outside [0, num-1]. */
void ccArrayRemoveObjectAtIndex(ccArray* arr, ssize_t index, bool releaseObj /* = true*/) void ccArrayRemoveObjectAtIndex(ccArray* arr, ssize_t index, bool releaseObj /* = true*/)
{ {
CCASSERT(arr && arr->num > 0 && index >= 0 && index < arr->num, "Invalid index. Out of bounds"); AXASSERT(arr && arr->num > 0 && index >= 0 && index < arr->num, "Invalid index. Out of bounds");
if (releaseObj) if (releaseObj)
{ {
AX_SAFE_RELEASE(arr->arr[index]); AX_SAFE_RELEASE(arr->arr[index]);
@ -339,7 +339,7 @@ bool ccCArrayContainsValue(ccCArray* arr, void* value)
/** Inserts a value at a certain position. Behavior undefined if array doesn't have enough capacity */ /** Inserts a value at a certain position. Behavior undefined if array doesn't have enough capacity */
void ccCArrayInsertValueAtIndex(ccCArray* arr, void* value, ssize_t index) void ccCArrayInsertValueAtIndex(ccCArray* arr, void* value, ssize_t index)
{ {
CCASSERT(index < arr->max, "ccCArrayInsertValueAtIndex: invalid index"); AXASSERT(index < arr->max, "ccCArrayInsertValueAtIndex: invalid index");
auto remaining = arr->num - index; auto remaining = arr->num - index;
// make sure it has enough capacity // make sure it has enough capacity

View File

@ -36,11 +36,11 @@ THE SOFTWARE.
#include "base/CCConsole.h" #include "base/CCConsole.h"
#include "platform/CCStdC.h" #include "platform/CCStdC.h"
#ifndef CCASSERT #ifndef AXASSERT
# if COCOS2D_DEBUG > 0 # if AXIS_DEBUG > 0
# if AX_ENABLE_SCRIPT_BINDING # if AX_ENABLE_SCRIPT_BINDING
extern bool AX_DLL cc_assert_script_compatible(const char* msg); extern bool AX_DLL cc_assert_script_compatible(const char* msg);
# define CCASSERT(cond, msg) \ # define AXASSERT(cond, msg) \
do \ do \
{ \ { \
if (!(cond)) \ if (!(cond)) \
@ -51,17 +51,17 @@ extern bool AX_DLL cc_assert_script_compatible(const char* msg);
} \ } \
} while (0) } while (0)
# else # else
# define CCASSERT(cond, msg) AX_ASSERT(cond) # define AXASSERT(cond, msg) AX_ASSERT(cond)
# endif # endif
# else # else
# define CCASSERT(cond, msg) # define AXASSERT(cond, msg)
# endif # endif
# define GP_ASSERT(cond) CCASSERT(cond, "") # define GP_ASSERT(cond) AXASSERT(cond, "")
// FIXME:: Backward compatible // FIXME:: Backward compatible
# define CCAssert CCASSERT # define CCAssert AXASSERT
#endif // CCASSERT #endif // AXASSERT
#include "base/ccConfig.h" #include "base/ccConfig.h"
@ -71,15 +71,15 @@ extern bool AX_DLL cc_assert_script_compatible(const char* msg);
#define AX_DOUBLE_PI (M_PI * 2) #define AX_DOUBLE_PI (M_PI * 2)
/** @def CCRANDOM_MINUS1_1 /** @def AXRANDOM_MINUS1_1
returns a random float between -1 and 1 returns a random float between -1 and 1
*/ */
#define CCRANDOM_MINUS1_1() axis::rand_minus1_1() #define AXRANDOM_MINUS1_1() axis::rand_minus1_1()
/** @def CCRANDOM_0_1 /** @def AXRANDOM_0_1
returns a random float between 0 and 1 returns a random float between 0 and 1
*/ */
#define CCRANDOM_0_1() axis::rand_0_1() #define AXRANDOM_0_1() axis::rand_0_1()
/** @def AX_DEGREES_TO_RADIANS /** @def AX_DEGREES_TO_RADIANS
converts degrees to radians converts degrees to radians

View File

@ -478,7 +478,7 @@ void StringUTF8::replace(std::string_view newStr)
if (lengthString == 0) if (lengthString == 0)
{ {
CCLOG("Bad utf-8 set string: %s", newStr.data()); AXLOG("Bad utf-8 set string: %s", newStr.data());
return; return;
} }

View File

@ -82,7 +82,7 @@ void captureScreen(std::function<void(RefPtr<Image>)> imageCallback)
{ {
if (s_captureScreenListener) if (s_captureScreenListener)
{ {
CCLOG("Warning: CaptureScreen has been called already, don't call more than once in one frame."); AXLOG("Warning: CaptureScreen has been called already, don't call more than once in one frame.");
return; return;
} }
@ -119,7 +119,7 @@ void captureNode(Node* startNode, std::function<void(RefPtr<Image>)> imageCallba
{ {
if (s_captureNodeListener.find(startNode) != s_captureNodeListener.end()) if (s_captureNodeListener.find(startNode) != s_captureNodeListener.end())
{ {
CCLOG("Warning: current node has been captured already"); AXLOG("Warning: current node has been captured already");
return; return;
} }
@ -305,7 +305,7 @@ Sprite* createSpriteFromBase64Cached(const char* base64String, const char* key)
Image* image = new Image(); Image* image = new Image();
bool imageResult = image->initWithImageData(decoded, length, true); bool imageResult = image->initWithImageData(decoded, length, true);
CCASSERT(imageResult, "Failed to create image from base64!"); AXASSERT(imageResult, "Failed to create image from base64!");
if (!imageResult) if (!imageResult)
{ {
@ -329,7 +329,7 @@ Sprite* createSpriteFromBase64(const char* base64String)
Image* image = new Image(); Image* image = new Image();
bool imageResult = image->initWithImageData(decoded, length, decoded); bool imageResult = image->initWithImageData(decoded, length, decoded);
CCASSERT(imageResult, "Failed to create image from base64!"); AXASSERT(imageResult, "Failed to create image from base64!");
if (!imageResult) if (!imageResult)
{ {
@ -609,7 +609,7 @@ backend::SamplerFilter toBackendSamplerFilter(int mode)
case GLTexParamConst::NEAREST_MIPMAP_NEAREST: case GLTexParamConst::NEAREST_MIPMAP_NEAREST:
return backend::SamplerFilter::NEAREST; return backend::SamplerFilter::NEAREST;
default: default:
CCASSERT(false, "invalid GL sampler filter!"); AXASSERT(false, "invalid GL sampler filter!");
return backend::SamplerFilter::LINEAR; return backend::SamplerFilter::LINEAR;
} }
} }
@ -626,7 +626,7 @@ backend::SamplerAddressMode toBackendAddressMode(int mode)
case GLTexParamConst::MIRROR_REPEAT: case GLTexParamConst::MIRROR_REPEAT:
return backend::SamplerAddressMode::MIRROR_REPEAT; return backend::SamplerAddressMode::MIRROR_REPEAT;
default: default:
CCASSERT(false, "invalid GL address mode"); AXASSERT(false, "invalid GL address mode");
return backend::SamplerAddressMode::REPEAT; return backend::SamplerAddressMode::REPEAT;
} }
} }
@ -671,7 +671,7 @@ std::vector<int> parseIntegerList(std::string_view intsString)
if (errno == ERANGE) if (errno == ERANGE)
{ {
errno = 0; errno = 0;
CCLOGWARN("%s contains out of range integers", intsString.data()); AXLOGWARN("%s contains out of range integers", intsString.data());
} }
result.push_back(static_cast<int>(i)); result.push_back(static_cast<int>(i));
cStr = endptr; cStr = endptr;

View File

@ -131,7 +131,7 @@ void Mat4::createPerspective(float fieldOfView, float aspectRatio, float zNearPl
float theta = MATH_DEG_TO_RAD(fieldOfView) * 0.5f; float theta = MATH_DEG_TO_RAD(fieldOfView) * 0.5f;
if (std::abs(std::fmod(theta, MATH_PIOVER2)) < MATH_EPSILON) if (std::abs(std::fmod(theta, MATH_PIOVER2)) < MATH_EPSILON)
{ {
CCLOGERROR("Invalid field of view value (%f) causes attempted calculation tan(%f), which is undefined.", AXLOGERROR("Invalid field of view value (%f) causes attempted calculation tan(%f), which is undefined.",
fieldOfView, theta); fieldOfView, theta);
return; return;
} }

View File

@ -63,7 +63,7 @@ Rect& Rect::operator=(const Rect& other)
void Rect::setRect(float x, float y, float width, float height) void Rect::setRect(float x, float y, float width, float height)
{ {
// CGRect can support width<0 or height<0 // CGRect can support width<0 or height<0
// CCASSERT(width >= 0.0f && height >= 0.0f, "width and height of Rect must not less than 0."); // AXASSERT(width >= 0.0f && height >= 0.0f, "width and height of Rect must not less than 0.");
origin.x = x; origin.x = x;
origin.y = y; origin.y = y;

View File

@ -75,15 +75,15 @@ void HttpClient::destroyInstance()
{ {
if (nullptr == _httpClient) if (nullptr == _httpClient)
{ {
CCLOG("HttpClient singleton is nullptr"); AXLOG("HttpClient singleton is nullptr");
return; return;
} }
CCLOG("HttpClient::destroyInstance begin"); AXLOG("HttpClient::destroyInstance begin");
delete _httpClient; delete _httpClient;
_httpClient = nullptr; _httpClient = nullptr;
CCLOG("HttpClient::destroyInstance() finished!"); AXLOG("HttpClient::destroyInstance() finished!");
} }
void HttpClient::enableCookies(const char* cookieFile) void HttpClient::enableCookies(const char* cookieFile)
@ -119,7 +119,7 @@ HttpClient::HttpClient()
, _cookie(nullptr) , _cookie(nullptr)
, _clearResponsePredicate(nullptr) , _clearResponsePredicate(nullptr)
{ {
CCLOG("In the constructor of HttpClient!"); AXLOG("In the constructor of HttpClient!");
_scheduler = Director::getInstance()->getScheduler(); _scheduler = Director::getInstance()->getScheduler();
_service = new yasio::io_service(HttpClient::MAX_CHANNELS); _service = new yasio::io_service(HttpClient::MAX_CHANNELS);
@ -151,7 +151,7 @@ HttpClient::~HttpClient()
delete _cookie; delete _cookie;
} }
CCLOG("HttpClient destructor"); AXLOG("HttpClient destructor");
} }
void HttpClient::setDispatchOnWorkThread(bool bVal) void HttpClient::setDispatchOnWorkThread(bool bVal)
@ -408,7 +408,7 @@ void HttpClient::handleNetworkEOF(HttpResponse* response, yasio::io_channel* cha
{ {
if (responseCode == 302) if (responseCode == 302)
response->getHttpRequest()->setRequestType(HttpRequest::Type::GET); response->getHttpRequest()->setRequestType(HttpRequest::Type::GET);
CCLOG("Process url redirect (%d): %s", responseCode, iter->second.c_str()); AXLOG("Process url redirect (%d): %s", responseCode, iter->second.c_str());
_availChannelQueue.push_front(channel->index()); _availChannelQueue.push_front(channel->index());
processResponse(response, iter->second); processResponse(response, iter->second);
response->release(); response->release();

View File

@ -97,7 +97,7 @@ public:
*/ */
Ref* autorelease() Ref* autorelease()
{ {
CCASSERT(false, AXASSERT(false,
"HttpResponse is used between network thread and ui thread \ "HttpResponse is used between network thread and ui thread \
therefore, autorelease is forbidden here"); therefore, autorelease is forbidden here");
return nullptr; return nullptr;

View File

@ -84,12 +84,12 @@ public:
/** /**
* Override autorelease method to prevent developers from calling it. * Override autorelease method to prevent developers from calling it.
* If this method is called , it would trigger CCASSERT. * If this method is called , it would trigger AXASSERT.
* @return axis::Ref* always return nullptr. * @return axis::Ref* always return nullptr.
*/ */
axis::Ref* autorelease() axis::Ref* autorelease()
{ {
CCASSERT(false, AXASSERT(false,
"HttpResponse is used between network thread and ui thread \ "HttpResponse is used between network thread and ui thread \
therefore, autorelease is forbidden here"); therefore, autorelease is forbidden here");
return nullptr; return nullptr;

Some files were not shown because too many files have changed in this diff Show More