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**:
- 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:
The goals where:

View File

@ -41,7 +41,7 @@ Action::Action() : _originalTarget(nullptr), _target(nullptr), _tag(Action::INVA
Action::~Action()
{
CCLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
AXLOGINFO("deallocing Action: %p - tag: %i", this, _tag);
}
std::string Action::description() const
@ -66,12 +66,12 @@ bool Action::isDone() const
void Action::step(float /*dt*/)
{
CCLOG("[Action step]. override me");
AXLOG("[Action step]. override me");
}
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)
{
CCASSERT(action != nullptr, "action must not be NULL");
AXASSERT(action != nullptr, "action must not be NULL");
if (action == 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)
{
CCASSERT(followedNode != nullptr, "FollowedNode can't be NULL");
AXASSERT(followedNode != nullptr, "FollowedNode can't be NULL");
if (followedNode == nullptr)
{
log("Follow::initWithTarget error: followedNode is nullptr!");

View File

@ -79,7 +79,7 @@ PointArray* PointArray::clone() const
PointArray::~PointArray()
{
CCLOGINFO("deallocing PointArray: %p", this);
AXLOGINFO("deallocing PointArray: %p", this);
}
PointArray::PointArray() {}
@ -205,7 +205,7 @@ CardinalSplineTo* CardinalSplineTo::create(float duration, PointArray* points, f
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))
{

View File

@ -47,7 +47,7 @@ NS_AX_BEGIN
bool ActionEase::initWithAction(ActionInterval* action)
{
CCASSERT(action != nullptr, "action couldn't be nullptr!");
AXASSERT(action != nullptr, "action couldn't be nullptr!");
if (action == nullptr)
{
return false;
@ -106,7 +106,7 @@ ActionInterval* ActionEase::getInnerAction()
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();
if (easeRateAction->initWithAction(action, rate))

View File

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

View File

@ -74,7 +74,7 @@ void Waves3D::update(float time)
Vec2 pos((float)i, (float)j);
Vec3 v = getOriginalVertex(pos);
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));
setVertex(pos, v);
}
@ -107,7 +107,7 @@ bool FlipX3D::initWithSize(const Vec2& gridSize, float duration)
if (gridSize.width != 1 || gridSize.height != 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;
}

View File

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

View File

@ -54,7 +54,7 @@ ActionManager::ActionManager() : _targets(nullptr), _currentTarget(nullptr), _cu
ActionManager::~ActionManager()
{
CCLOGINFO("deallocing ActionManager: %p", this);
AXLOGINFO("deallocing ActionManager: %p", this);
removeAllActions();
}
@ -163,8 +163,8 @@ void ActionManager::resumeTargets(const Vector<Node*>& targetsToResume)
void ActionManager::addAction(Action* action, Node* target, bool paused)
{
CCASSERT(action != nullptr, "action can't be nullptr!");
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(action != nullptr, "action can't be nullptr!");
AXASSERT(target != nullptr, "target can't be nullptr!");
if (action == nullptr || target == nullptr)
return;
@ -183,7 +183,7 @@ void ActionManager::addAction(Action* action, Node* target, bool paused)
actionAllocWithHashElement(element);
CCASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!");
AXASSERT(!ccArrayContainsObject(element->actions, action), "action already be added!");
ccArrayAppendObject(element->actions, action);
action->startWithTarget(target);
@ -254,8 +254,8 @@ void ActionManager::removeAction(Action* action)
void ActionManager::removeActionByTag(int tag, Node* target)
{
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr)
{
return;
@ -282,8 +282,8 @@ void ActionManager::removeActionByTag(int tag, Node* target)
void ActionManager::removeAllActionsByTag(int tag, Node* target)
{
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag value!");
AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr)
{
return;
@ -318,7 +318,7 @@ void ActionManager::removeActionsByFlags(unsigned int flags, Node* target)
{
return;
}
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(target != nullptr, "target can't be nullptr!");
if (target == nullptr)
{
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
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;
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
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;
HASH_FIND_PTR(_targets, &target, element);

View File

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

View File

@ -62,7 +62,7 @@ ActionTween* ActionTween::clone() const
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);
_delta = _to - _from;
}

View File

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

View File

@ -60,7 +60,7 @@ AnimationCache::AnimationCache() {}
AnimationCache::~AnimationCache()
{
CCLOGINFO("deallocing AnimationCache: %p", this);
AXLOGINFO("deallocing AnimationCache: %p", this);
}
void AnimationCache::addAnimation(Animation* animation, std::string_view name)
@ -94,7 +94,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (frameNames.empty())
{
CCLOG(
AXLOG(
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
"animation cache.",
anim.first.c_str());
@ -110,7 +110,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (!spriteFrame)
{
CCLOG(
AXLOG(
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
"SpriteFrameCache. This frame will not be added to the animation.",
anim.first.c_str(), frameName.asString().c_str());
@ -124,7 +124,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
if (frames.empty())
{
CCLOG(
AXLOG(
"cocos2d: AnimationCache: None of the frames for animation '%s' were found in the SpriteFrameCache. "
"Animation is not being added to the Animation Cache.",
anim.first.c_str());
@ -132,7 +132,7 @@ void AnimationCache::parseVersion1(const ValueMap& animations)
}
else if (frames.size() != frameNameSize)
{
CCLOG(
AXLOG(
"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.",
anim.first.c_str());
@ -160,7 +160,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
if (frameArray.empty())
{
CCLOG(
AXLOG(
"cocos2d: AnimationCache: Animation '%s' found in dictionary without any frames - cannot add to "
"animation cache.",
name.c_str());
@ -178,7 +178,7 @@ void AnimationCache::parseVersion2(const ValueMap& animations)
if (!spriteFrame)
{
CCLOG(
AXLOG(
"cocos2d: AnimationCache: Animation '%s' refers to frame '%s' which is not currently in the "
"SpriteFrameCache. This frame will not be added to the animation.",
name.c_str(), spriteFrameName.c_str());
@ -210,7 +210,7 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
auto anisItr = dictionary.find("animations");
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;
}
@ -240,14 +240,14 @@ void AnimationCache::addAnimationsWithDictionary(const ValueMap& dictionary, std
parseVersion2(animations.asValueMap());
break;
default:
CCASSERT(false, "Invalid animation format");
AXASSERT(false, "Invalid animation format");
}
}
/** Read an NSDictionary from a plist file and parse it automatically for animations */
void AnimationCache::addAnimationsWithFile(std::string_view plist)
{
CCASSERT(!plist.empty(), "Invalid texture file name");
AXASSERT(!plist.empty(), "Invalid texture file name");
if (plist.empty())
{
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);
CCASSERT(!dict.empty(), "CCAnimationCache: File could not be found");
AXASSERT(!dict.empty(), "CCAnimationCache: File could not be found");
if (dict.empty())
{
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)
{
CCASSERT(!tile.empty(), "file size should not be empty");
AXASSERT(!tile.empty(), "file size should not be empty");
Texture2D* texture = _director->getTextureCache()->addImage(tile);
return initWithTexture(texture, tileWidth, tileHeight, itemsToRender);
}
@ -141,7 +141,7 @@ void AtlasNode::calculateMaxItems()
void AtlasNode::updateAtlasValues()
{
CCASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
AXASSERT(false, "CCAtlasNode:Abstract updateAtlasValue not overridden");
}
// AtlasNode - draw

View File

@ -62,7 +62,7 @@ PolygonInfo::PolygonInfo(const PolygonInfo& other) : triangles(), _isVertsOwner(
_rect = other._rect;
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
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.indexCount = other.triangles.indexCount;
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;
triangles.verts = new V3F_C4B_T2F[other.triangles.vertCount];
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.indexCount = other.triangles.indexCount;
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)
{
CCASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
AXASSERT(numberOfQuads >= 1 && numberOfQuads <= 9, "Invalid number of Quads");
releaseVertsAndIndices();
_isVertsOwner = false;
@ -174,7 +174,7 @@ AutoPolygon::AutoPolygon(std::string_view filename)
_filename = filename;
_image = new Image();
_image->initWithImageFile(filename);
CCASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8,
AXASSERT(_image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888");
_data = _image->getData();
_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;
}
@ -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;
Vec2 br = Vec2(x - 0.0f, y - 0.0f);
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;
}
@ -386,7 +386,7 @@ std::vector<axis::Vec2> AutoPolygon::marchSquare(const Rect& rect, const Vec2& s
}
break;
default:
CCLOG("this shouldn't happen.");
AXLOG("this shouldn't happen.");
}
// little optimization
// 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;
prevy = stepy;
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
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
} while (curx != startx || cury != starty);
return _points;
@ -666,7 +666,7 @@ void AutoPolygon::calculateUV(const Rect& rect, V3F_C4B_T2F* verts, ssize_t coun
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 texHeight = _height;
@ -688,7 +688,7 @@ Rect AutoPolygon::getRealRect(const Rect& rect)
if (realRect.equals(Rect::ZERO))
{
// 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);
}
else

View File

@ -81,7 +81,7 @@ Camera* Camera::getDefaultCamera()
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();
@ -233,7 +233,7 @@ bool Camera::initDefault()
break;
}
default:
CCLOG("unrecognized projection");
AXLOG("unrecognized projection");
break;
}
if (_zoomFactor != 1.0F)
@ -283,7 +283,7 @@ Vec2 Camera::project(const Vec3& src) const
Vec4 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 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);
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 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
{
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);
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
{
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);
screen.x = screen.x * 2.0f - 1.0f;

View File

@ -97,7 +97,7 @@ void ClippingNode::onEnter()
}
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:
// 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
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->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 ret = false;
CCASSERT(com != nullptr, "Component must be non-nil");
CCASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
AXASSERT(com != nullptr, "Component must be non-nil");
AXASSERT(com->getOwner() == nullptr, "Component already added. It can't be added again");
do
{
auto componentName = com->getName();
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;
}
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)
{
CCASSERT(count >= 0, "capacity must be >= 0");
AXASSERT(count >= 0, "capacity must be >= 0");
if (_bufferCountTriangle + count > _bufferCapacityTriangle)
{
@ -105,7 +105,7 @@ void DrawNode::ensureCapacity(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)
{
@ -120,7 +120,7 @@ void DrawNode::ensureCapacityGLPoint(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)
{
@ -605,7 +605,7 @@ void DrawNode::drawPolygon(const Vec2* verts,
float borderWidth,
const Color4B& borderColor)
{
CCASSERT(count >= 0, "invalid count value");
AXASSERT(count >= 0, "invalid count value");
bool outline = (borderColor.a > 0.0f && borderWidth > 0.0f);

View File

@ -211,7 +211,7 @@ void FastTMXLayer::updateTiles(const Rect& culledRect)
else
{
// do nothing, do not support
// CCASSERT(0, "TMX invalid value");
// AXASSERT(0, "TMX invalid value");
}
_indicesVertexZNumber.clear();
@ -321,7 +321,7 @@ void FastTMXLayer::setupTiles()
break;
case FAST_TMX_ORIENTATION_HEX:
default:
CCLOGERROR("FastTMX does not support type %d", _layerOrientation);
AXLOGERROR("FastTMX does not support type %d", _layerOrientation);
break;
}
@ -647,10 +647,10 @@ void FastTMXLayer::updateTotalQuads()
// removing / getting tiles
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,
"TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
Sprite* tile = nullptr;
int gid = this->getTileGIDAt(tileCoordinate);
@ -690,10 +690,10 @@ Sprite* FastTMXLayer::getTileAt(const Vec2& tileCoordinate)
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,
"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));
@ -737,10 +737,10 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
ret = static_cast<int>(-(_layerSize.height - pos.y));
break;
case FAST_TMX_ORIENTATION_HEX:
CCASSERT(0, "TMX Hexa vertexZ not supported");
AXASSERT(0, "TMX Hexa vertexZ not supported");
break;
default:
CCASSERT(0, "TMX invalid value");
AXASSERT(0, "TMX invalid value");
break;
}
}
@ -755,7 +755,7 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos)
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,
"TMXLayer: invalid position");
@ -842,7 +842,7 @@ Vec2 FastTMXLayer::calculateLayerOffset(const Vec2& pos)
break;
case FAST_TMX_ORIENTATION_HEX:
default:
CCASSERT(pos.isZero(), "offset for this map not implemented yet");
AXASSERT(pos.isZero(), "offset for this map not implemented yet");
break;
}
return ret;
@ -856,11 +856,11 @@ void FastTMXLayer::setTileGID(int gid, const Vec2& tileCoordinate)
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,
"TMXLayer: invalid position");
CCASSERT(_tiles, "TMXLayer: the tiles map has been released");
CCASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid");
AXASSERT(_tiles, "TMXLayer: the tiles map has been released");
AXASSERT(gid == 0 || gid >= _tileSet->_firstGid, "TMXLayer: invalid gid");
TMXTileFlags 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)
{
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);
@ -69,7 +69,7 @@ bool FastTMXTiledMap::initWithTMXFile(std::string_view tmxFile)
{
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);
_tmxFile = tmxFile;
@ -83,7 +83,7 @@ bool FastTMXTiledMap::initWithXML(std::string_view tmxString, std::string_view r
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);
return true;
@ -148,7 +148,7 @@ TMXTilesetInfo* FastTMXTiledMap::tilesetForLayer(TMXLayerInfo* layerInfo, TMXMap
}
// 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;
}
@ -196,7 +196,7 @@ void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
// public
FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) const
{
CCASSERT(!layerName.empty(), "Invalid layer name!");
AXASSERT(!layerName.empty(), "Invalid layer name!");
for (auto& child : _children)
{
@ -216,7 +216,7 @@ FastTMXLayer* FastTMXTiledMap::getLayer(std::string_view layerName) 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)
{

View File

@ -40,7 +40,7 @@ FontCharMap* FontCharMap::create(std::string_view plistFile)
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();

View File

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

View File

@ -149,7 +149,7 @@ void GridBase::updateBlendState()
GridBase::~GridBase()
{
CCLOGINFO("deallocing GridBase: %p", this);
AXLOGINFO("deallocing GridBase: %p", this);
AX_SAFE_RELEASE(_renderTarget);
@ -470,7 +470,7 @@ void Grid3D::calculateVertexPoints()
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;
float* vertArray = (float*)_vertices;
@ -482,7 +482,7 @@ Vec3 Grid3D::getVertex(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;
float* vertArray = (float*)_originalVertices;
@ -494,7 +494,7 @@ Vec3 Grid3D::getOriginalVertex(const Vec2& pos) const
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;
float* vertArray = (float*)_vertices;
vertArray[index] = vertex.x;
@ -718,7 +718,7 @@ void TiledGrid3D::calculateVertexPoints()
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;
float* vertArray = (float*)_vertices;
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
{
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;
float* vertArray = (float*)_originalVertices;
@ -738,7 +738,7 @@ Quad3 TiledGrid3D::getOriginalTile(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;
float* vertArray = (float*)_vertices;

View File

@ -780,7 +780,7 @@ void Label::updateShaderProgram()
void Label::updateBatchCommand(Label::BatchCommand& batch)
{
CCASSERT(_programState, "programState should be set!");
AXASSERT(_programState, "programState should be set!");
batch.setProgramState(_programState);
}
@ -1398,7 +1398,7 @@ void Label::enableGlow(const Color4B& glowColor)
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!");
if (outlineSize > 0 || _currLabelEffect == LabelEffect::OUTLINE)
@ -2197,7 +2197,7 @@ Sprite* Label::getLetter(int letterIndex)
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)
{
@ -2208,7 +2208,7 @@ void Label::setLineHeight(float height)
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;
}
@ -2238,12 +2238,12 @@ void Label::setAdditionalKerning(float space)
}
}
else
CCLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
AXLOG("Label::setAdditionalKerning not supported on LabelType::STRING_TEXTURE");
}
float Label::getAdditionalKerning() const
{
CCASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
AXASSERT(_currentLabelType != LabelType::STRING_TEXTURE, "Not supported system font!");
return _additionalKerning;
}
@ -2356,7 +2356,7 @@ void Label::updateDisplayedOpacity(uint8_t parentOpacity)
// that's fine but it should be documented
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!");
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 (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;
#endif

View File

@ -124,7 +124,7 @@ bool LabelAtlas::initWithString(std::string_view theString, std::string_view fnt
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();
@ -160,7 +160,7 @@ void LabelAtlas::updateAtlasValues()
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();
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))
{
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);
continue;
}

View File

@ -732,7 +732,7 @@ void LayerMultiplex::switchTo(int n)
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);
@ -743,7 +743,7 @@ void LayerMultiplex::switchTo(int n, bool cleanup)
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);
#if AX_ENABLE_GC_FOR_NATIVE_OBJECTS

View File

@ -50,7 +50,7 @@ enum
Menu::~Menu()
{
CCLOGINFO("In the destructor of Menu. %p", this);
AXLOGINFO("In the destructor of Menu. %p", this);
}
Menu* Menu::create()
@ -171,13 +171,13 @@ void Menu::addChild(Node* child, int zOrder)
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);
}
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);
}
@ -204,7 +204,7 @@ void Menu::onExit()
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)
{
@ -247,7 +247,7 @@ bool Menu::onTouchBegan(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();
if (_selectedItem)
{
@ -261,7 +261,7 @@ void Menu::onTouchEnded(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();
if (_selectedItem)
{
@ -273,7 +273,7 @@ void Menu::onTouchCancelled(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);
if (currentItem != _selectedItem)
{
@ -343,7 +343,7 @@ void Menu::alignItemsInColumns(int columns, ...)
void Menu::alignItemsInColumns(int columns, va_list args)
{
CCASSERT(columns >= 0, "Columns must be >= 0");
AXASSERT(columns >= 0, "Columns must be >= 0");
ValueVector rows;
while (columns)
{
@ -363,11 +363,11 @@ void Menu::alignItemsInColumnsWithArray(const ValueVector& rows)
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();
// 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;
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
CCASSERT(!columnsOccupied, "columnsOccupied should be 0.");
AXASSERT(!columnsOccupied, "columnsOccupied should be 0.");
Vec2 winSize = getContentSize();
@ -460,11 +460,11 @@ void Menu::alignItemsInRowsWithArray(const ValueVector& columns)
for (const auto& child : _children)
{
// 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();
// 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);
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.
CCASSERT(!rowsOccupied, "rowsOccupied should be 0.");
AXASSERT(!rowsOccupied, "rowsOccupied should be 0.");
Vec2 winSize = getContentSize();

View File

@ -289,7 +289,7 @@ bool MenuItemAtlasFont::initWithString(std::string_view value,
char startCharMap,
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);
if (MenuItemLabel::initWithLabel(label, callback))
{
@ -347,12 +347,12 @@ MenuItemFont::MenuItemFont() : _fontSize(0), _fontName("") {}
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)
{
CCASSERT(!value.empty(), "Value length must be greater than 0");
AXASSERT(!value.empty(), "Value length must be greater than 0");
_fontName = _globalFontName;
_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)
{
CCASSERT(!path.empty(), "Invalid filename");
AXASSERT(!path.empty(), "Invalid filename");
Texture2D* texture = _director->getTextureCache()->addImage(path);
return initWithFade(fade, minSeg, stroke, color, texture);
@ -227,7 +227,7 @@ bool MotionStreak::setProgramState(backend::ProgramState* programState, bool nee
{
if (Node::setProgramState(programState, needsRetain))
{
CCASSERT(programState, "argument should not be nullptr");
AXASSERT(programState, "argument should not be nullptr");
auto& pipelineDescriptor = _customCommand.getPipelineDescriptor();
pipelineDescriptor.programState = _programState;
@ -273,12 +273,12 @@ const BlendFunc& MotionStreak::getBlendFunc() const
void MotionStreak::setOpacity(uint8_t /*opacity*/)
{
CCASSERT(false, "Set opacity no supported");
AXASSERT(false, "Set opacity no supported");
}
uint8_t MotionStreak::getOpacity() const
{
CCASSERT(false, "Opacity no supported");
AXASSERT(false, "Opacity no supported");
return 0;
}

View File

@ -155,7 +155,7 @@ Node* Node::create()
Node::~Node()
{
CCLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
AXLOGINFO("deallocing Node: %p - tag: %i", this, _tag);
AX_SAFE_DELETE(_childrenIndexer);
@ -187,11 +187,11 @@ Node::~Node()
_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);
#endif
CCASSERT(!_running,
AXASSERT(!_running,
"Node still marked as running on node destruction! Was base class onExit() called in derived class "
"onExit() implementations?");
AX_SAFE_RELEASE(_eventDispatcher);
@ -310,7 +310,7 @@ void Node::setGlobalZOrder(float globalZOrder)
/// rotation getter
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;
}
@ -350,7 +350,7 @@ void Node::setRotation3D(const Vec3& rotation)
Vec3 Node::getRotation3D() const
{
// 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);
}
@ -427,7 +427,7 @@ void Node::setRotationSkewY(float rotationY)
/// scale getter
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;
}
@ -808,7 +808,7 @@ void Node::childrenAlloc()
Node* Node::getChildByTag(int tag) const
{
CCASSERT(tag != Node::INVALID_TAG, "Invalid tag");
AXASSERT(tag != Node::INVALID_TAG, "Invalid tag");
if (_childrenIndexer)
{
@ -827,7 +827,7 @@ Node* Node::getChildByTag(int tag) 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);
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
{
CCASSERT(!name.empty(), "Invalid name");
CCASSERT(callback != nullptr, "Invalid callback function");
AXASSERT(!name.empty(), "Invalid name");
AXASSERT(callback != nullptr, "Invalid callback function");
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)
{
CCASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again");
AXASSERT(child != nullptr, "Argument must be non-nil");
AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
addChildHelper(child, localZOrder, tag, "", true);
}
void Node::addChild(Node* child, int localZOrder, std::string_view name)
{
CCASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->_parent == nullptr, "child already added. It can't be added again");
AXASSERT(child != nullptr, "Argument must be non-nil");
AXASSERT(child->_parent == nullptr, "child already added. It can't be added again");
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;
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())
{
@ -1046,13 +1046,13 @@ void Node::addChildHelper(Node* child, int localZOrder, int tag, std::string_vie
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);
}
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);
}
@ -1088,13 +1088,13 @@ void Node::removeChild(Node* child, 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);
if (child == nullptr)
{
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
}
else
{
@ -1104,13 +1104,13 @@ void Node::removeChildByTag(int tag, bool cleanup /* = true */)
void Node::removeChildByName(std::string_view name, bool cleanup)
{
CCASSERT(!name.empty(), "Invalid name");
AXASSERT(!name.empty(), "Invalid name");
Node* child = this->getChildByName(name);
if (child == nullptr)
{
CCLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data());
AXLOG("cocos2d: removeChildByName(name = %s): child not found!", name.data());
}
else
{
@ -1193,7 +1193,7 @@ void Node::insertChild(Node* child, int z)
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;
child->updateOrderOfArrival();
child->_setLocalZOrder(zOrder);
@ -1230,7 +1230,7 @@ uint32_t Node::processParentFlags(const Mat4& parentTransform, uint32_t parentFl
{
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)
{
auto& s = _parent->getContentSize();
@ -1435,7 +1435,7 @@ void Node::setActionManager(ActionManager* actionManager)
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);
return action;
}
@ -1452,13 +1452,13 @@ void Node::stopAction(Action* action)
void Node::stopActionByTag(int tag)
{
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
_actionManager->removeActionByTag(tag, this);
}
void Node::stopAllActionsByTag(int tag)
{
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
_actionManager->removeAllActionsByTag(tag, this);
}
@ -1472,7 +1472,7 @@ void Node::stopActionsByFlags(unsigned int flags)
Action* Node::getActionByTag(int tag)
{
CCASSERT(tag != Action::INVALID_TAG, "Invalid tag");
AXASSERT(tag != Action::INVALID_TAG, "Invalid tag");
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)
{
CCASSERT(selector, "Argument must be non-nil");
CCASSERT(interval >= 0, "Argument must be positive");
AXASSERT(selector, "Argument must be non-nil");
AXASSERT(interval >= 0, "Argument must be positive");
_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*/)
{
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*/)
{
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)
{
CCASSERT(child != nullptr, "Argument must be non-nil");
AXASSERT(child != nullptr, "Argument must be non-nil");
PointObject* obj = PointObject::create(ratio, offset);
obj->setChild(child);
ccArrayAppendObjectWithResize(_parallaxArray, (Ref*)obj);

View File

@ -183,11 +183,11 @@ void ParticleBatchNode::visit(Renderer* renderer, const Mat4& parentTransform, u
// override addChild:
void ParticleBatchNode::addChild(Node* aChild, int zOrder, int tag)
{
CCASSERT(aChild != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children");
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");
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)
{
CCASSERT(aChild != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
AXASSERT(aChild != nullptr, "Argument must be non-nullptr");
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"CCParticleBatchNode only supports QuadParticleSystems as children");
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");
addChildByTagOrName(child, zOrder, 0, name, false);
@ -217,7 +217,7 @@ void ParticleBatchNode::addChildByTagOrName(ParticleSystem* child,
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");
// 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
int ParticleBatchNode::addChildHelper(ParticleSystem* child, int z, int aTag, std::string_view name, bool setTag)
{
CCASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
AXASSERT(child != nullptr, "Argument must be non-nil");
AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
_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
void ParticleBatchNode::reorderChild(Node* aChild, int zOrder)
{
CCASSERT(aChild != nullptr, "Child must be non-nullptr");
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
AXASSERT(aChild != nullptr, "Child must be non-nullptr");
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"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);
@ -411,9 +411,9 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup)
if (aChild == nullptr)
return;
CCASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
AXASSERT(dynamic_cast<ParticleSystem*>(aChild) != nullptr,
"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);
@ -481,14 +481,14 @@ void ParticleBatchNode::draw(Renderer* renderer, const Mat4& transform, uint32_t
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);
if (!_textureAtlas->resizeCapacity(quantity))
{
// serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "XXX: ParticleBatchNode #increaseAtlasCapacity SHALL handle this assert");
AXLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
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);
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
auto listFilePath = plistFile;
@ -573,7 +573,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
}
else
{
CCASSERT(false, "Invalid emitterType in config file");
AXASSERT(false, "Invalid emitterType in config file");
AX_BREAK_IF(true);
}
@ -630,7 +630,7 @@ bool ParticleSystem::initWithDictionary(const ValueMap& dictionary, std::string_
else if (dictionary.find("textureImageData") != dictionary.end())
{
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();
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
int decodeLen =
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);
unsigned char* deflated = nullptr;
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);
// For android, we should retain it in VolatileTexture::addImage which invoked in
// Director::getInstance()->getTextureCache()->addUIImage()
image = new Image();
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);
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);
if (!this->_texture)
CCLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
AXLOGWARN("cocos2d: Warning: ParticleSystemQuad system without a texture");
}
ret = true;
}
@ -679,7 +679,7 @@ bool ParticleSystem::initWithTotalParticles(int numberOfParticles)
if (!_particleData.init(_totalParticles))
{
CCLOG("Particle system: not enough memory");
AXLOG("Particle system: not enough memory");
this->release();
return false;
}
@ -1386,12 +1386,12 @@ void ParticleSystem::setAnimationIndicesAtlas()
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)
{
CCASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
AXASSERT(unifiedCellSize > 0, "A cell cannot have a size of zero.");
resetAnimationIndices();
@ -1870,7 +1870,7 @@ void ParticleSystem::setTexture(Texture2D* var)
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)
{
@ -1921,170 +1921,170 @@ bool ParticleSystem::isBlendAdditive() const
// ParticleSystem - Properties of Gravity Mode
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
// ParticleSystem - Properties of Radius Mode
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
@ -2141,7 +2141,7 @@ int ParticleSystem::getTotalParticles() const
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;
}
@ -2286,7 +2286,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
img->Image::initWithImageFile(texturePath);
img->autorelease();
CCASSERT(img, "image texture was nullptr.");
AXASSERT(img, "image texture was nullptr.");
bakeEmissionMask(maskId, img, alphaThreshold, inverted, inbetweenSamples);
}
@ -2297,8 +2297,8 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
int inbetweenSamples)
{
auto img = imageTexture;
CCASSERT(img, "image texture was nullptr.");
CCASSERT(img->hasAlpha(), "image data should contain an alpha channel.");
AXASSERT(img, "image texture was nullptr.");
AXASSERT(img->hasAlpha(), "image data should contain an alpha channel.");
vector<Vec2> points;
@ -2341,7 +2341,7 @@ void ParticleEmissionMaskCache::bakeEmissionMask(std::string_view maskId,
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);
}

View File

@ -106,7 +106,7 @@ ParticleSystemQuad* ParticleSystemQuad::create(std::string_view filename)
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 "
"U_SHORT (uint16_t)");
@ -257,7 +257,7 @@ void ParticleSystemQuad::setTexture(Texture2D* texture)
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());
}
@ -731,7 +731,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
_particleData.release();
if (!_particleData.init(tp))
{
CCLOG("Particle system: not enough memory");
AXLOG("Particle system: not enough memory");
return;
}
V3F_C4B_T2F_Quad* quadsNew = (V3F_C4B_T2F_Quad*)realloc(_quads, quadsSize);
@ -757,7 +757,7 @@ void ParticleSystemQuad::setTotalParticles(int tp)
if (indicesNew)
_indices = indicesNew;
CCLOG("Particle system: out of memory");
AXLOG("Particle system: out of memory");
return;
}
@ -809,7 +809,7 @@ void ParticleSystemQuad::listenRendererRecreated(EventCustom* /*event*/)
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(_indices);
@ -819,7 +819,7 @@ bool ParticleSystemQuad::allocMemory()
if (!_quads || !_indices)
{
CCLOG("cocos2d: Particle system: not enough memory");
AXLOG("cocos2d: Particle system: not enough memory");
AX_SAFE_FREE(_quads);
AX_SAFE_FREE(_indices);

View File

@ -20,13 +20,13 @@ NS_AX_BEGIN
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);
if (fullPath.empty())
{
// 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;
}
@ -61,7 +61,7 @@ void PlistSpriteSheetLoader::load(std::string_view filePath, SpriteFrameCache& c
// 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);
}
@ -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)
{
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);
auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
addSpriteFramesWithDictionary(dict, textureFileName, filePath, cache);
@ -143,7 +143,7 @@ void PlistSpriteSheetLoader::reload(std::string_view filePath, SpriteFrameCache&
}
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
CCASSERT(format >= 0 && format <= 3,
AXASSERT(format >= 0 && format <= 3,
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
std::vector<std::string> frameAliases;
@ -219,7 +219,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
// check ow/oh
if (!ow || !oh)
{
CCLOGWARN(
AXLOGWARN(
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
"expected. Regenerate the .plist");
}
@ -268,7 +268,7 @@ void PlistSpriteSheetLoader::addSpriteFramesWithDictionary(ValueMap& dictionary,
}
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
{
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
CCASSERT(format >= 0 && format <= 3,
AXASSERT(format >= 0 && format <= 3,
"format is not supported for SpriteFrameCache addSpriteFramesWithDictionary:textureFilename:");
auto spriteSheet = std::make_shared<SpriteSheet>();
@ -417,7 +417,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
// check ow/oh
if (!ow || !oh)
{
CCLOGWARN(
AXLOGWARN(
"cocos2d: WARNING: originalWidth/Height not found on the SpriteFrame. AnchorPoint won't work as "
"expected. Regenerate the .plist");
}
@ -466,7 +466,7 @@ void PlistSpriteSheetLoader::reloadSpriteFramesWithDictionary(ValueMap& dict,
}
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()
{
CCLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag);
AXLOGINFO("deallocing ProtectedNode: %p - tag: %i", this, _tag);
removeAllProtectedChildren();
}
@ -80,8 +80,8 @@ void ProtectedNode::addProtectedChild(axis::Node* child, int localZOrder)
*/
void ProtectedNode::addProtectedChild(Node* child, int zOrder, int tag)
{
CCASSERT(child != nullptr, "Argument must be non-nil");
CCASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
AXASSERT(child != nullptr, "Argument must be non-nil");
AXASSERT(child->getParent() == nullptr, "child already added. It can't be added again");
if (_protectedChildren.empty())
{
@ -118,7 +118,7 @@ void ProtectedNode::addProtectedChild(Node* child, int zOrder, 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)
{
@ -213,13 +213,13 @@ void ProtectedNode::removeAllProtectedChildrenWithCleanup(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);
if (child == nullptr)
{
CCLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
AXLOG("cocos2d: removeChildByTag(tag = %d): child not found!", tag);
}
else
{
@ -253,7 +253,7 @@ void ProtectedNode::sortAllProtectedChildren()
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;
child->updateOrderOfArrival();
child->setLocalZOrder(localZOrder);

View File

@ -84,7 +84,7 @@ void RenderTexture::listenToBackground(EventCustom* /*event*/)
}
else
{
CCLOG("Cache rendertexture failed!");
AXLOG("Cache rendertexture failed!");
}
AX_SAFE_RELEASE(uiTextureImage);
};
@ -158,7 +158,7 @@ bool RenderTexture::initWithWidthAndHeight(int w,
PixelFormat depthStencilFormat,
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;
do
@ -379,12 +379,12 @@ bool RenderTexture::saveToFileAsNonPMA(std::string_view filename, bool isRGBA, S
else if (basename.find(".jpg") != std::string::npos)
{
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);
}
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);
@ -402,12 +402,12 @@ bool RenderTexture::saveToFile(std::string_view filename, bool isRGBA, SaveFileC
else if (basename.find(".jpg") != std::string::npos)
{
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);
}
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);
@ -418,10 +418,10 @@ bool RenderTexture::saveToFileAsNonPMA(std::string_view fileName,
bool isRGBA,
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");
if (isRGBA && format == Image::Format::JPG)
CCLOG("RGBA is not supported for JPG format");
AXLOG("RGBA is not supported for JPG format");
_saveFileCallback = callback;
@ -441,10 +441,10 @@ bool RenderTexture::saveToFile(std::string_view fileName,
bool isRGBA,
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");
if (isRGBA && format == Image::Format::JPG)
CCLOG("RGBA is not supported for JPG format");
AXLOG("RGBA is not supported for JPG format");
_saveFileCallback = callback;
@ -481,7 +481,7 @@ void RenderTexture::onSaveToFile(std::string_view filename, bool isRGBA, bool fo
/* get buffer as Image */
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))
{

View File

@ -130,10 +130,10 @@ Sprite* Sprite::createWithSpriteFrameName(std::string_view spriteFrameName)
{
SpriteFrame* frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(spriteFrameName);
#if COCOS2D_DEBUG > 0
#if AXIS_DEBUG > 0
char msg[256] = {0};
sprintf(msg, "Invalid spriteFrameName: %s", spriteFrameName.data());
CCASSERT(frame != nullptr, msg);
AXASSERT(frame != nullptr, msg);
#endif
return createWithSpriteFrame(frame);
@ -159,7 +159,7 @@ bool Sprite::init()
bool Sprite::initWithTexture(Texture2D* texture)
{
CCASSERT(texture != nullptr, "Invalid texture for sprite");
AXASSERT(texture != nullptr, "Invalid texture for sprite");
Rect rect = Rect::ZERO;
if (texture)
@ -182,7 +182,7 @@ bool Sprite::initWithFile(std::string_view filename, PixelFormat format)
{
if (filename.empty())
{
CCLOG("Call Sprite::initWithFile with blank resource filename.");
AXLOG("Call Sprite::initWithFile with blank resource filename.");
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)
{
CCASSERT(!filename.empty(), "Invalid filename");
AXASSERT(!filename.empty(), "Invalid filename");
if (filename.empty())
return false;
@ -222,7 +222,7 @@ bool Sprite::initWithFile(std::string_view filename, const Rect& rect)
bool Sprite::initWithSpriteFrameName(std::string_view spriteFrameName)
{
CCASSERT(!spriteFrameName.empty(), "Invalid spriteFrameName");
AXASSERT(!spriteFrameName.empty(), "Invalid spriteFrameName");
if (spriteFrameName.empty())
return false;
@ -235,7 +235,7 @@ bool Sprite::initWithSpriteFrameName(std::string_view spriteFrameName)
bool Sprite::initWithSpriteFrame(SpriteFrame* spriteFrame)
{
CCASSERT(spriteFrame != nullptr, "spriteFrame can't be nullptr!");
AXASSERT(spriteFrame != nullptr, "spriteFrame can't be nullptr!");
if (spriteFrame == nullptr)
return false;
@ -383,7 +383,7 @@ void Sprite::setProgramState(uint32_t type)
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))
{
auto& pipelineDescriptor = _trianglesCommand.getPipelineDescriptor();
@ -401,10 +401,10 @@ bool Sprite::setProgramState(backend::ProgramState* programState, bool needsReta
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");
// 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)
{
@ -416,7 +416,7 @@ void Sprite::setTexture(Texture2D* texture)
{
Image* image = new Image();
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);
AX_SAFE_RELEASE(image);
@ -709,7 +709,7 @@ void Sprite::setCenterRectNormalized(const axis::Rect& rectTopLeft)
{
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;
}
@ -765,7 +765,7 @@ void Sprite::setCenterRect(const axis::Rect& rectInPoints)
{
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;
}
@ -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)
{
CCASSERT(quadIndex < 9, "Invalid quadIndex");
AXASSERT(quadIndex < 9, "Invalid quadIndex");
// convert Quad intro Triangle since it takes less memory
// Triangles are ordered like the following:
@ -986,7 +986,7 @@ void Sprite::populateTriangle(int quadIndex, const V3F_C4B_T2F_Quad& quad)
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");
// recalculate matrix only if it is dirty
@ -1009,7 +1009,7 @@ void Sprite::updateTransform()
_transformToBatch = getNodeToParentTransform();
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();
Mat4& parentTransform = static_cast<Sprite*>(_parent)->_transformToBatch;
_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)
{
CCASSERT(child != nullptr, "Argument must be non-nullptr");
AXASSERT(child != nullptr, "Argument must be non-nullptr");
if (child == nullptr)
return;
if (_renderMode == RenderMode::QUAD_BATCHNODE)
{
Sprite* childSprite = dynamic_cast<Sprite*>(child);
CCASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
CCASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
AXASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
AXASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
"childSprite's texture name should be equal to _textureAtlas's texture name!");
// put it in descendants array of batch node
_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)
{
CCASSERT(child != nullptr, "Argument must be non-nullptr");
AXASSERT(child != nullptr, "Argument must be non-nullptr");
if (child == nullptr)
return;
if (_renderMode == RenderMode::QUAD_BATCHNODE)
{
Sprite* childSprite = dynamic_cast<Sprite*>(child);
CCASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
CCASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
AXASSERT(childSprite, "CCSprite only supports Sprites as children when using SpriteBatchNode");
AXASSERT(childSprite->getTexture() == _textureAtlas->getTexture(),
"childSprite's texture name should be equal to _textureAtlas's texture name.");
// put it in descendants array of batch node
_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)
{
CCASSERT(child != nullptr, "child must be non null");
CCASSERT(_children.contains(child), "child does not belong to this");
AXASSERT(child != nullptr, "child must be non null");
AXASSERT(_children.contains(child), "child does not belong to this");
if ((_renderMode == RenderMode::QUAD_BATCHNODE) && !_reorderChildDirty)
{
@ -1350,7 +1350,7 @@ void Sprite::setAnchorPoint(const Vec2& anchor)
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);
}
@ -1363,7 +1363,7 @@ void Sprite::setVisible(bool bVisible)
void Sprite::setContentSize(const Vec2& size)
{
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");
Node::setContentSize(size);
@ -1552,14 +1552,14 @@ bool Sprite::isOpacityModifyRGB() const
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())
return;
SpriteFrameCache* cache = SpriteFrameCache::getInstance();
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);
}
@ -1603,17 +1603,17 @@ void Sprite::setSpriteFrame(SpriteFrame* spriteFrame)
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())
return;
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);
CCASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
AXASSERT(frame, "CCSprite#setDisplayFrame. Invalid frame");
setSpriteFrame(frame->getSpriteFrame());
}
@ -1677,7 +1677,7 @@ void Sprite::setBatchNode(SpriteBatchNode* spriteBatchNode)
// MARK: Texture protocol
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");
// 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;
}
CCASSERT(capacity >= 0, "Capacity must be >= 0");
AXASSERT(capacity >= 0, "Capacity must be >= 0");
_blendFunc = BlendFunc::ALPHA_PREMULTIPLIED;
if (!tex->hasPremultipliedAlpha())
@ -116,14 +116,14 @@ bool SpriteBatchNode::initWithTexture(Texture2D* tex, ssize_t capacity /* = DEFA
void SpriteBatchNode::setUniformLocation()
{
CCASSERT(_programState, "programState should not be nullptr");
AXASSERT(_programState, "programState should not be nullptr");
_mvpMatrixLocaiton = _programState->getUniformLocation("u_MVPMatrix");
_textureLocation = _programState->getUniformLocation("u_tex0");
}
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
auto vertexLayout = _programState->getVertexLayout();
/// a_position
@ -144,7 +144,7 @@ void SpriteBatchNode::setVertexLayout()
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))
{
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)
{
CCASSERT(child != nullptr, "child should not be null");
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
AXASSERT(child != nullptr, "child should not be null");
AXASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
Sprite* sprite = static_cast<Sprite*>(child);
// 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");
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)
{
CCASSERT(child != nullptr, "child should not be null");
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
AXASSERT(child != nullptr, "child should not be null");
AXASSERT(dynamic_cast<Sprite*>(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
Sprite* sprite = static_cast<Sprite*>(child);
// 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);
@ -252,8 +252,8 @@ void SpriteBatchNode::addChild(Node* child, int zOrder, std::string_view name)
// override reorderChild
void SpriteBatchNode::reorderChild(Node* child, int zOrder)
{
CCASSERT(child != nullptr, "the child should not be null");
CCASSERT(_children.contains(child), "Child doesn't belong to Sprite");
AXASSERT(child != nullptr, "the child should not be null");
AXASSERT(_children.contains(child), "Child doesn't belong to Sprite");
if (zOrder == child->getLocalZOrder())
{
@ -275,7 +275,7 @@ void SpriteBatchNode::removeChild(Node* child, bool cleanup)
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
removeSpriteFromAtlas(sprite);
@ -285,7 +285,7 @@ void SpriteBatchNode::removeChild(Node* child, bool cleanup)
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);
}
@ -407,7 +407,7 @@ void SpriteBatchNode::updateAtlasIndex(Sprite* sprite, ssize_t* curIndex)
void SpriteBatchNode::swap(ssize_t oldIndex, ssize_t newIndex)
{
CCASSERT(
AXASSERT(
oldIndex >= 0 && oldIndex < (int)_descendants.size() && newIndex >= 0 && newIndex < (int)_descendants.size(),
"Invalid index");
@ -458,14 +458,14 @@ void SpriteBatchNode::increaseAtlasCapacity()
// this is likely computationally expensive
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));
if (!_textureAtlas->resizeCapacity(quantity))
{
// serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "Not enough memory to resize the atlas");
AXLOGWARN("cocos2d: WARNING: 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))
{
// serious problems
CCLOGWARN("cocos2d: WARNING: Not enough memory to resize the atlas");
CCASSERT(false, "Not enough memory to resize the atlas");
AXLOGWARN("cocos2d: WARNING: 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)
{
CCASSERT(index >= 0 && index < _children.size(), "Invalid index");
AXASSERT(index >= 0 && index < _children.size(), "Invalid index");
auto& children = parent->getChildren();
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
CCASSERT(0, "should not run here");
AXASSERT(0, "should not run here");
return 0;
}
@ -640,7 +640,7 @@ void SpriteBatchNode::appendChild(Sprite* sprite)
continue;
}
#endif
CCASSERT(dynamic_cast<Sprite*>(child) != nullptr,
AXASSERT(dynamic_cast<Sprite*>(child) != nullptr,
"You can only add Sprites (or subclass of Sprite) to SpriteBatchNode");
appendChild(static_cast<Sprite*>(child));
++iter;
@ -724,8 +724,8 @@ void SpriteBatchNode::setTexture(Texture2D* texture)
void SpriteBatchNode::insertQuadFromSprite(Sprite* sprite, ssize_t index)
{
CCASSERT(sprite != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<Sprite*>(sprite), "CCSpriteBatchNode only supports Sprites as children");
AXASSERT(sprite != nullptr, "Argument must be non-nullptr");
AXASSERT(dynamic_cast<Sprite*>(sprite), "CCSpriteBatchNode only supports Sprites as children");
// make needed room
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)
{
CCASSERT(sprite != nullptr, "Argument must be non-nil");
CCASSERT(dynamic_cast<Sprite*>(sprite) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
AXASSERT(sprite != nullptr, "Argument must be non-nil");
AXASSERT(dynamic_cast<Sprite*>(sprite) != nullptr, "CCSpriteBatchNode only supports Sprites as children");
// make needed room
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)
{
CCASSERT(child != nullptr, "Argument must be non-nullptr");
CCASSERT(dynamic_cast<Sprite*>(child), "CCSpriteBatchNode only supports Sprites as children");
AXASSERT(child != nullptr, "Argument must be non-nullptr");
AXASSERT(dynamic_cast<Sprite*>(child), "CCSpriteBatchNode only supports Sprites as children");
// quad index is Z
child->setAtlasIndex(z);

View File

@ -152,7 +152,7 @@ bool SpriteFrame::initWithTextureFilename(std::string_view filename,
SpriteFrame::~SpriteFrame()
{
CCLOGINFO("deallocing SpriteFrame: %p", this);
AXLOGINFO("deallocing SpriteFrame: %p", this);
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)
{
CCASSERT(frame, "frame should not be nil");
AXASSERT(frame, "frame should not be nil");
const std::string name = "by#addSpriteFrame()";
auto&& itr = _spriteSheets.find(name);
@ -158,7 +158,7 @@ void SpriteFrameCache::removeUnusedSpriteFrames()
{
toRemoveFrames.push_back(iter.first);
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;
}
}
@ -184,7 +184,7 @@ void SpriteFrameCache::removeSpriteFramesFromFile(std::string_view atlasPath)
// auto dict = FileUtils::getInstance()->getValueMapFromFile(fullPath);
// 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;
// }
// 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()));
if (dict.empty())
{
CCLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFileContent: create dict by fail.");
AXLOG("cocos2d:SpriteFrameCache:removeSpriteFramesFromFileContent: create dict by fail.");
return;
}
removeSpriteFramesFromDictionary(dict);
@ -246,14 +246,14 @@ SpriteFrame* SpriteFrameCache::getSpriteFrameByName(std::string_view name)
auto* frame = findFrame(name);
if (!frame)
{
CCLOG("cocos2d: SpriteFrameCache: Frame '%s' isn't found", name.data());
AXLOG("cocos2d: SpriteFrameCache: Frame '%s' isn't found", name.data());
}
return frame;
}
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);
if (spriteSheetItr == _spriteSheets.end())

View File

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

View File

@ -45,7 +45,7 @@ TMXLayerInfo::TMXLayerInfo() : _name(""), _tiles(nullptr), _ownTiles(true) {}
TMXLayerInfo::~TMXLayerInfo()
{
CCLOGINFO("deallocing TMXLayerInfo: %p", this);
AXLOGINFO("deallocing TMXLayerInfo: %p", this);
if (_ownTiles && _tiles)
{
free(_tiles);
@ -69,7 +69,7 @@ TMXTilesetInfo::TMXTilesetInfo() : _firstGid(0), _tileSize(Vec2::ZERO), _spacing
TMXTilesetInfo::~TMXTilesetInfo()
{
CCLOGINFO("deallocing TMXTilesetInfo: %p", this);
AXLOGINFO("deallocing TMXTilesetInfo: %p", this);
}
Rect TMXTilesetInfo::getRectForGID(uint32_t gid)
@ -168,7 +168,7 @@ TMXMapInfo::TMXMapInfo()
TMXMapInfo::~TMXMapInfo()
{
CCLOGINFO("deallocing TMXMapInfo: %p", this);
AXLOGINFO("deallocing TMXMapInfo: %p", this);
}
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")
{
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();
if (orientationStr == "orthogonal")
@ -242,7 +242,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
}
else
{
CCLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
AXLOG("cocos2d: TMXFomat: Unsupported orientation: %d", tmxMapInfo->getOrientation());
}
std::string staggerAxisStr = attributeDict["staggeraxis"].asString();
@ -467,7 +467,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
layerAttribs = tmxMapInfo->getLayerAttribs();
tmxMapInfo->setLayerAttribs(layerAttribs | TMXLayerAttribZlib);
}
CCASSERT(compression == "" || compression == "gzip" || compression == "zlib",
AXASSERT(compression == "" || compression == "gzip" || compression == "zlib",
"TMX: unsupported compression method");
}
else if (encoding == "csv")
@ -525,7 +525,7 @@ void TMXMapInfo::startElement(void* /*ctx*/, const char* name, const char** atts
{
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());
}
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);
if (!buffer)
{
CCLOG("cocos2d: TiledMap: decode data error");
AXLOG("cocos2d: TiledMap: decode data error");
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 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);
buffer = nullptr;
if (!deflated)
{
CCLOG("cocos2d: TiledMap: inflate data error");
AXLOG("cocos2d: TiledMap: inflate data error");
return;
}
@ -753,7 +753,7 @@ void TMXMapInfo::endElement(void* /*ctx*/, const char* name)
buffer = (unsigned char*)malloc(gidTokens.size() * 4);
if (!buffer)
{
CCLOG("cocos2d: TiledMap: CSV buffer not allocated.");
AXLOG("cocos2d: TiledMap: CSV buffer not allocated.");
return;
}

View File

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

View File

@ -67,7 +67,7 @@ TransitionScene* TransitionScene::create(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())
{
@ -93,7 +93,7 @@ bool TransitionScene::initWithDuration(float t, Scene* scene)
}
_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();

View File

@ -117,7 +117,7 @@ void TransitionProgress::setupTransition()
ProgressTimer* TransitionProgress::progressTimerNodeWithRenderTexture(RenderTexture* /*texture*/)
{
CCASSERT(false, "override me - abstract class");
AXASSERT(false, "override me - abstract class");
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]);
auto idx = static_cast<int>(key);
CCASSERT(idx >= 0 && idx < max, "invalid key ");
AXASSERT(idx >= 0 && idx < max, "invalid key ");
return s_attributeNames[idx];
}
}; // namespace shaderinfos

View File

@ -224,7 +224,7 @@ void Animate3D::startWithTarget(Node* target)
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)
{
CCASSERT(weight >= 0.0f, "invalid weight");
AXASSERT(weight >= 0.0f, "invalid weight");
_weight = fabsf(weight);
}

View File

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

View File

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

View File

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

View File

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

View File

@ -188,7 +188,7 @@ inline bool BundleReader::read<char>(char* ptr)
template <>
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;
}

View File

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

View File

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

View File

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

View File

@ -47,7 +47,7 @@ MeshSkin* MeshSkin::create(Skeleton3D* skeleton,
skin->_skeleton = skeleton;
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)
{
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)
{
CCASSERT(!path.empty(), "Invalid filename");
AXASSERT(!path.empty(), "Invalid filename");
Texture2D* texture = _director->getTextureCache()->addImage(path);
return initWithFade(fade, minSeg, stroke, color, texture);
@ -293,12 +293,12 @@ const BlendFunc& MotionStreak3D::getBlendFunc() const
void MotionStreak3D::setOpacity(uint8_t /*opacity*/)
{
CCASSERT(false, "Set opacity no supported");
AXASSERT(false, "Set opacity no supported");
}
uint8_t MotionStreak3D::getOpacity() const
{
CCASSERT(false, "Opacity no supported");
AXASSERT(false, "Opacity no supported");
return 0;
}

View File

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

View File

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

View File

@ -246,7 +246,7 @@ bool Terrain::initHeightMap(std::string_view heightMap)
}
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;
}
}
@ -267,7 +267,7 @@ Terrain::Terrain()
#ifdef AX_USE_METAL
auto image = new Image();
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->initWithImage(image);
AX_SAFE_RELEASE(image);
@ -683,7 +683,7 @@ void Terrain::setDetailMap(unsigned int index, DetailMap detailMap)
{
if (index > 4)
{
CCLOG("invalid DetailMap index %d\n", index);
AXLOG("invalid DetailMap index %d\n", index);
}
_terrainData._detailMaps[index] = detailMap;
if (_detailMapTextures[index])
@ -971,7 +971,7 @@ void Terrain::Chunk::bindAndDraw()
}
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.setVertexBuffer(_buffer);
_command.getPipelineDescriptor().programState = _terrain->_programState;

View File

@ -50,7 +50,7 @@ VertexAttribBinding::~VertexAttribBinding()
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.
VertexAttribBinding* b;
@ -78,7 +78,7 @@ VertexAttribBinding* VertexAttribBinding::create(MeshIndexData* meshIndexData, P
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();
@ -105,7 +105,7 @@ bool VertexAttribBinding::init(MeshIndexData* meshIndexData, Pass* pass, MeshCom
_vertexLayout->setLayout(offset);
CCASSERT(offset == meshVertexData->getSizePerVertex(), "vertex layout mismatch!");
AXASSERT(offset == meshVertexData->getSizePerVertex(), "vertex layout mismatch!");
return true;
}
@ -117,7 +117,7 @@ uint32_t VertexAttribBinding::getVertexAttribsFlags() const
void VertexAttribBinding::parseAttributes()
{
CCASSERT(_programState, "invalid glprogram");
AXASSERT(_programState, "invalid glprogram");
_attributes.clear();
_vertexAttribsFlags = 0;
@ -149,13 +149,13 @@ void VertexAttribBinding::setVertexAttribPointer(std::string_view name,
auto v = getVertexAttribValue(name);
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);
_vertexAttribsFlags |= flag;
}
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) 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.
#if AX_TARGET_PLATFORM == AX_PLATFORM_WIN32
# include "base/ccUTF8.h" // for StringUtils::format
@ -49,7 +49,7 @@
# define AUDIO_LOG(fmt, ...) printf(fmt "\n", ##__VA_ARGS__)
#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__)
#else
# define ALOGV(fmt, ...) \
@ -62,7 +62,7 @@
#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__)
#if defined(COCOS2D_DEBUG) && COCOS2D_DEBUG > 0
#if defined(AXIS_DEBUG) && AXIS_DEBUG > 0
# define CHECK_AL_ERROR_DEBUG() \
do \
{ \

View File

@ -30,7 +30,7 @@ NS_AX_BEGIN
AutoreleasePool::AutoreleasePool()
: _name("")
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
, _isClearing(false)
#endif
{
@ -40,7 +40,7 @@ AutoreleasePool::AutoreleasePool()
AutoreleasePool::AutoreleasePool(std::string_view name)
: _name(name)
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
, _isClearing(false)
#endif
{
@ -50,7 +50,7 @@ AutoreleasePool::AutoreleasePool(std::string_view name)
AutoreleasePool::~AutoreleasePool()
{
CCLOGINFO("deallocing AutoreleasePool: %p", this);
AXLOGINFO("deallocing AutoreleasePool: %p", this);
clear();
PoolManager::getInstance()->pop();
@ -63,7 +63,7 @@ void AutoreleasePool::addObject(Ref* object)
void AutoreleasePool::clear()
{
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
_isClearing = true;
#endif
std::vector<Ref*> releasings;
@ -72,7 +72,7 @@ void AutoreleasePool::clear()
{
obj->release();
}
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
_isClearing = false;
#endif
}
@ -89,12 +89,12 @@ bool AutoreleasePool::contains(Ref* object) const
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()));
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)
{
CCLOG("%20p%20u\n", obj, obj->getReferenceCount());
AXLOG("%20p%20u\n", obj, obj->getReferenceCount());
}
}
@ -130,7 +130,7 @@ PoolManager::PoolManager()
PoolManager::~PoolManager()
{
CCLOGINFO("deallocing PoolManager: %p", this);
AXLOGINFO("deallocing PoolManager: %p", this);
while (!_releasePoolStack.empty())
{

View File

@ -89,7 +89,7 @@ public:
*/
void clear();
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
/**
* Whether the autorelease pool is doing `clear` operation.
*
@ -135,7 +135,7 @@ private:
std::vector<Ref*> _managedObjectArray;
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.
*/

View File

@ -80,7 +80,7 @@ bool Configuration::init()
_valueDict["axis.compiled_with_gl_state_cache"] = Value(true);
#endif
#if COCOS2D_DEBUG
#if AXIS_DEBUG
_valueDict["axis.build_type"] = Value("DEBUG");
#else
_valueDict["axis.build_type"] = Value("RELEASE");
@ -98,13 +98,13 @@ std::string Configuration::getInfo() const
{
// And Dump some warnings as well
#if AX_ENABLE_PROFILERS
CCLOG(
AXLOG(
"cocos2d: **** WARNING **** AX_ENABLE_PROFILERS is defined. Disable it when you finish profiling (from "
"ccConfig.h)\n");
#endif
#if AX_ENABLE_GL_STATE_CACHE == 0
CCLOG(
AXLOG(
"cocos2d: **** WARNING **** AX_ENABLE_GL_STATE_CACHE is disabled. To improve performance, enable it (from "
"ccConfig.h)\n");
#endif
@ -117,7 +117,7 @@ std::string Configuration::getInfo() const
void Configuration::gatherGPUInfo()
{
auto _deviceInfo = backend::Device::getInstance()->getDeviceInfo();
CCLOG("Supported extensions: %s", _deviceInfo->getExtension());
AXLOG("Supported extensions: %s", _deviceInfo->getExtension());
_valueDict["vendor"] = Value(_deviceInfo->getVendor());
_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)
{
ValueMap dict = FileUtils::getInstance()->getValueMapFromFile(filename);
CCASSERT(!dict.empty(), "cannot create dictionary");
AXASSERT(!dict.empty(), "cannot create dictionary");
// search for metadata
bool validMetadata = false;
@ -360,14 +360,14 @@ void Configuration::loadConfigFile(std::string_view filename)
if (!validMetadata)
{
CCLOG("Invalid config format for file: %s", filename.data());
AXLOG("Invalid config format for file: %s", filename.data());
return;
}
auto dataIter = dict.find("data");
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;
}
@ -379,7 +379,7 @@ void Configuration::loadConfigFile(std::string_view filename)
if (_valueDict.find(dataMapIter.first) == _valueDict.cend())
_valueDict[dataMapIter.first] = dataMapIter.second;
else
CCLOG("Key already present. Ignoring '%s'", dataMapIter.first.c_str());
AXLOG("Key already present. Ignoring '%s'", dataMapIter.first.c_str());
}
// 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)
void SendLogToWindow(const char* log)
{
static const int CCLOG_STRING_TAG = 1;
static const int AXLOG_STRING_TAG = 1;
// Send data as a message
COPYDATASTRUCT myCDS;
myCDS.dwData = CCLOG_STRING_TAG;
myCDS.dwData = AXLOG_STRING_TAG;
myCDS.cbData = (DWORD)strlen(log) + 1;
myCDS.lpData = (PVOID)log;
if (Director::getInstance()->getOpenGLView())

View File

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

View File

@ -4222,14 +4222,14 @@ public:
if (deviceName.compare(it.first) == 0)
{
// 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->_axisInputMap = it.second.second;
// 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
// above.
# ifdef COCOS2D_DEBUG
# ifdef AXIS_DEBUG
int count;
glfwGetJoystickButtons(deviceId, &count);
for (int i = 0; i < count; ++i)
@ -4238,7 +4238,7 @@ public:
const auto& it = controller->_buttonInputMap.find(i);
if (it == controller->_buttonInputMap.end())
{
CCLOG(
AXLOG(
"ControllerImpl: Could not find a button input mapping for controller \"%s\", and keyCode "
"\"%d\". This keyCode will not match any from Controller::Key",
controller->getDeviceName().data(), i);
@ -4252,7 +4252,7 @@ public:
const auto& it = controller->_axisInputMap.find(i);
if (it == controller->_axisInputMap.end())
{
CCLOG(
AXLOG(
"ControllerImpl: Could not find an axis input mapping for controller \"%s\", and keyCode "
"\"%d\". This keyCode will not match any from Controller::Key",
controller->getDeviceName().data(), i);
@ -4265,15 +4265,15 @@ public:
}
// Show a warning if the controller input profile is non-existent:
# ifdef COCOS2D_DEBUG
# ifdef AXIS_DEBUG
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())
{
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
@ -4286,7 +4286,7 @@ public:
auto iter = findController(deviceId);
if (iter == Controller::s_allController.end())
{
CCLOGERROR("ControllerImpl Error: Could not find the controller!");
AXLOGERROR("ControllerImpl Error: Could not find the controller!");
return;
}
@ -4299,7 +4299,7 @@ public:
auto iter = findController(deviceId);
if (iter == Controller::s_allController.end())
{
CCLOG("ControllerImpl::onButtonEvent: new controller detected. Registering...");
AXLOG("ControllerImpl::onButtonEvent: new controller detected. Registering...");
onConnected(glfwGetJoystickName(deviceId), deviceId);
iter = findController(deviceId);
}
@ -4312,7 +4312,7 @@ public:
auto iter = findController(deviceId);
if (iter == Controller::s_allController.end())
{
CCLOG("ControllerImpl::onAxisEvent: new controller detected. Registering...");
AXLOG("ControllerImpl::onAxisEvent: new controller detected. Registering...");
onConnected(glfwGetJoystickName(deviceId), deviceId);
iter = findController(deviceId);
}
@ -4332,10 +4332,10 @@ public:
{
ControllerImpl::getInstance()->onDisconnected(deviceId);
}
# ifdef COCOS2D_DEBUG
# ifdef AXIS_DEBUG
else
{
CCLOG("ControllerImpl: Unhandled GLFW joystick event: %d", event);
AXLOG("ControllerImpl: Unhandled GLFW joystick event: %d", event);
}
# endif
}

View File

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

View File

@ -92,7 +92,7 @@ Director* Director::getInstance()
if (!s_SharedDirector)
{
s_SharedDirector = new Director;
CCASSERT(s_SharedDirector, "FATAL: Not enough memory");
AXASSERT(s_SharedDirector, "FATAL: Not enough memory");
s_SharedDirector->init();
}
@ -148,7 +148,7 @@ bool Director::init()
Director::~Director()
{
CCLOGINFO("deallocing Director: %p", this);
AXLOGINFO("deallocing Director: %p", this);
AX_SAFE_RELEASE(_FPSLabel);
AX_SAFE_RELEASE(_drawnVerticesLabel);
@ -208,7 +208,7 @@ void Director::setDefaultValues()
else if (projection == "custom")
_projection = Projection::CUSTOM;
else
CCASSERT(false, "Invalid projection value");
AXASSERT(false, "Invalid projection value");
// Default pixel format for PNG images with alpha
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()
{
// 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->setDepthCompareFunction(backend::CompareFunction::LESS_EQUAL);
@ -358,7 +358,7 @@ void Director::calculateDeltaTime()
_deltaTime = MAX(0, _deltaTime);
}
#if COCOS2D_DEBUG
#if AXIS_DEBUG
// If we are debugging our code, prevent big delta time
if (_deltaTime > 0.2f)
{
@ -373,14 +373,14 @@ float Director::getDeltaTime() const
}
void Director::setOpenGLView(GLView* openGLView)
{
CCASSERT(openGLView, "opengl view should not be null");
AXASSERT(openGLView, "opengl view should not be null");
if (_openGLView != openGLView)
{
// Configuration. Gather GPU info
Configuration* conf = Configuration::getInstance();
conf->gatherGPUInfo();
CCLOG("%s\n", conf->getInfo().c_str());
AXLOG("%s\n", conf->getInfo().c_str());
if (_openGLView)
_openGLView->release();
@ -487,7 +487,7 @@ void Director::popMatrix(MATRIX_STACK_TYPE type)
}
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
{
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
{
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
{
CCASSERT(false, "unknown matrix stack type");
AXASSERT(false, "unknown matrix stack type");
}
}
@ -567,7 +567,7 @@ void Director::pushMatrix(MATRIX_STACK_TYPE type)
}
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();
}
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();
}
@ -596,7 +596,7 @@ void Director::setProjection(Projection projection)
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;
}
@ -638,7 +638,7 @@ void Director::setProjection(Projection projection)
break;
default:
CCLOG("cocos2d: Director: unrecognized projection");
AXLOG("cocos2d: Director: unrecognized projection");
break;
}
@ -680,7 +680,7 @@ static void GLToClipTransform(Mat4* transformOut)
return;
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& modelview = director->getMatrix(MATRIX_STACK_TYPE::MATRIX_STACK_MODELVIEW);
@ -785,9 +785,9 @@ Rect Director::getSafeAreaRect() const
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.");
CCASSERT(_runningScene == nullptr, "_runningScene should be null");
AXASSERT(_runningScene == nullptr, "_runningScene should be null");
pushScene(scene);
startAnimation();
@ -795,8 +795,8 @@ void Director::runWithScene(Scene* scene)
void Director::replaceScene(Scene* scene)
{
// CCASSERT(_runningScene, "Use runWithScene: instead to start the director");
CCASSERT(scene != nullptr, "the scene should not be null");
// AXASSERT(_runningScene, "Use runWithScene: instead to start the director");
AXASSERT(scene != nullptr, "the scene should not be null");
if (_runningScene == nullptr)
{
@ -835,7 +835,7 @@ void Director::replaceScene(Scene* scene)
void Director::pushScene(Scene* scene)
{
CCASSERT(scene, "the scene should not null");
AXASSERT(scene, "the scene should not null");
_sendCleanupToScene = false;
@ -852,7 +852,7 @@ void Director::pushScene(Scene* scene)
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
auto sEngine = ScriptEngineManager::getInstance()->getScriptEngine();
@ -882,7 +882,7 @@ void Director::popToRootScene()
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();
// level 0? -> end
@ -1271,7 +1271,7 @@ void Director::createStatsLabel()
{
if (image)
delete image;
CCLOGERROR("%s", "Fails: init fps_images");
AXLOGERROR("%s", "Fails: init fps_images");
return;
}

View File

@ -88,7 +88,7 @@ static EventListener::ListenerID __getListenerID(Event* event)
case Event::Type::TOUCH:
// Touch listener is very special, it contains two kinds of listeners, EventListenerTouchOneByOne and
// 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;
#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 || \
@ -98,7 +98,7 @@ static EventListener::ListenerID __getListenerID(Event* event)
break;
#endif
default:
CCASSERT(false, "Invalid type!");
AXASSERT(false, "Invalid type!");
break;
}
@ -135,11 +135,11 @@ bool EventDispatcher::EventListenerVector::empty() const
void EventDispatcher::EventListenerVector::push_back(EventListener* listener)
{
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS
CCASSERT(_sceneGraphListeners == nullptr ||
AXASSERT(_sceneGraphListeners == nullptr ||
std::count(_sceneGraphListeners->begin(), _sceneGraphListeners->end(), listener) == 0,
"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!");
#endif
@ -472,7 +472,7 @@ void EventDispatcher::forceAddEventListener(EventListener* listener)
setDirty(listenerID, DirtyFlag::SCENE_GRAPH_PRIORITY);
auto node = listener->getAssociatedNode();
CCASSERT(node != nullptr, "Invalid scene graph priority!");
AXASSERT(node != nullptr, "Invalid scene graph priority!");
associateNodeAndEventListener(node, listener);
@ -489,8 +489,8 @@ void EventDispatcher::forceAddEventListener(EventListener* listener)
void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* listener, Node* node)
{
CCASSERT(listener && node, "Invalid parameters.");
CCASSERT(!listener->isRegistered(), "The listener has been registered.");
AXASSERT(listener && node, "Invalid parameters.");
AXASSERT(!listener->isRegistered(), "The listener has been registered.");
if (!listener->checkAvailable())
return;
@ -502,7 +502,7 @@ void EventDispatcher::addEventListenerWithSceneGraphPriority(EventListener* list
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)
{
@ -517,7 +517,7 @@ void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
{
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!");
}
}
@ -527,13 +527,13 @@ void EventDispatcher::debugCheckNodeHasNoEventListenersOnDestruction(Node* node)
// Check the node listeners map
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)
{
for (EventListener* listener : *keyValuePair.second)
{
CCASSERT(listener->getAssociatedNode() != node,
AXASSERT(listener->getAssociatedNode() != node,
"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
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
for (EventListener* listener : _toAddedListeners)
{
CCASSERT(listener->getAssociatedNode() != node,
AXASSERT(listener->getAssociatedNode() != node,
"Node should have no event listeners registered for it upon destruction!");
}
// Check the dirty nodes set
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)
{
CCASSERT(listener, "Invalid parameters.");
CCASSERT(!listener->isRegistered(), "The listener has been registered.");
CCASSERT(fixedPriority != 0,
AXASSERT(listener, "Invalid parameters.");
AXASSERT(!listener->isRegistered(), "The listener has been registered.");
AXASSERT(fixedPriority != 0,
"0 priority is forbidden for fixed priority since it's used for scene graph based priority.");
if (!listener->checkAvailable())
@ -654,12 +654,12 @@ void EventDispatcher::removeEventListener(EventListener* listener)
}
#if AX_NODE_DEBUG_VERIFY_EVENT_LISTENERS
CCASSERT(
AXASSERT(
_inDispatch != 0 || !sceneGraphPriorityListeners ||
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.");
CCASSERT(_inDispatch != 0 || !fixedPriorityListeners ||
AXASSERT(_inDispatch != 0 || !fixedPriorityListeners ||
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.");
#endif
@ -712,7 +712,7 @@ void EventDispatcher::setPriority(EventListener* listener, int fixedPriority)
auto found = std::find(fixedPriorityListeners->begin(), fixedPriorityListeners->end(), listener);
if (found != fixedPriorityListeners->end())
{
CCASSERT(listener->getAssociatedNode() == nullptr,
AXASSERT(listener->getAssociatedNode() == nullptr,
"Can't set fixed priority with scene graph based listener.");
if (listener->getFixedPriority() != fixedPriority)
@ -737,7 +737,7 @@ void EventDispatcher::dispatchEventToListeners(EventListenerVector* listeners,
// priority < 0
if (fixedPriorityListeners)
{
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
AXASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
"Out of range exception!");
if (!fixedPriorityListeners->empty())
@ -801,7 +801,7 @@ void EventDispatcher::dispatchTouchEventToListeners(EventListenerVector* listene
// priority < 0
if (fixedPriorityListeners)
{
CCASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
AXASSERT(listeners->getGt0Index() <= static_cast<ssize_t>(fixedPriorityListeners->size()),
"Out of range exception!");
if (!fixedPriorityListeners->empty())
@ -1032,7 +1032,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
}
break;
default:
CCASSERT(false, "The eventcode is invalid.");
AXASSERT(false, "The eventcode is invalid.");
break;
}
}
@ -1044,7 +1044,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
return true;
}
CCASSERT(touches->getID() == (*mutableTouchesIter)->getID(),
AXASSERT(touches->getID() == (*mutableTouchesIter)->getID(),
"touches ID should be equal to mutableTouchesIter's ID.");
if (isClaimed && listener->_isRegistered && listener->_needSwallow)
@ -1113,7 +1113,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* event)
}
break;
default:
CCASSERT(false, "The eventcode is invalid.");
AXASSERT(false, "The eventcode is invalid.");
break;
}
@ -1139,7 +1139,7 @@ void EventDispatcher::dispatchTouchEvent(EventTouch* 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)
return;
@ -1217,7 +1217,7 @@ void EventDispatcher::updateListeners(Event* 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();)
{
@ -1474,7 +1474,7 @@ void EventDispatcher::removeEventListenersForType(EventListener::Type listenerTy
}
else
{
CCASSERT(false, "Invalid listener type!");
AXASSERT(false, "Invalid listener type!");
}
}

View File

@ -196,7 +196,7 @@ public:
*/
~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.

View File

@ -32,7 +32,7 @@ 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)

View File

@ -35,7 +35,7 @@ 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)
@ -87,7 +87,7 @@ EventListenerAcceleration* EventListenerAcceleration::clone()
bool EventListenerAcceleration::checkAvailable()
{
CCASSERT(onAccelerationEvent, "onAccelerationEvent can't be nullptr!");
AXASSERT(onAccelerationEvent, "onAccelerationEvent can't be nullptr!");
return true;
}

View File

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

View File

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

View File

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

View File

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

View File

@ -90,14 +90,14 @@ public:
Map() : _data()
{
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. */
explicit Map(ssize_t capacity) : _data()
{
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);
}
@ -105,7 +105,7 @@ public:
Map(const Map& other)
{
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;
addRefForAllObjects();
}
@ -114,7 +114,7 @@ public:
Map(Map&& other)
{
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);
}
@ -124,7 +124,7 @@ public:
*/
~Map()
{
CCLOGINFO("In the destructor of Map!");
AXLOGINFO("In the destructor of Map!");
clear();
}
@ -273,7 +273,7 @@ public:
template <typename K2>
void insert(const K2& key, V object)
{
CCASSERT(object != nullptr, "Object is nullptr!");
AXASSERT(object != nullptr, "Object is nullptr!");
object->retain();
erase(key);
_data.emplace(key, object);
@ -287,14 +287,14 @@ public:
*/
iterator erase(const_iterator position)
{
CCASSERT(position != _data.cend(), "Invalid iterator!");
AXASSERT(position != _data.cend(), "Invalid iterator!");
position->second->release();
return _data.erase(position);
}
iterator erase(iterator position)
{
CCASSERT(position != _data.cend(), "Invalid iterator!");
AXASSERT(position != _data.cend(), "Invalid iterator!");
position->second->release();
return _data.erase(position);
}
@ -379,25 +379,25 @@ public:
// Don't uses operator since we could not decide whether it needs 'retain'/'release'.
// V& operator[] ( const K& key )
// {
// CCLOG("copy: [] ref");
// AXLOG("copy: [] ref");
// return _data[key];
// }
//
// V& operator[] ( K&& key )
// {
// CCLOG("move [] ref");
// AXLOG("move [] ref");
// return _data[key];
// }
// const V& operator[] ( const K& key ) const
// {
// CCLOG("const copy []");
// AXLOG("const copy []");
// return _data.at(key);
// }
//
// const V& operator[] ( K&& key ) const
// {
// CCLOG("const move []");
// AXLOG("const move []");
// return _data.at(key);
// }
@ -406,7 +406,7 @@ public:
{
if (this != &other)
{
CCLOGINFO("In the copy assignment operator of Map!");
AXLOGINFO("In the copy assignment operator of Map!");
clear();
_data = other._data;
addRefForAllObjects();
@ -419,7 +419,7 @@ public:
{
if (this != &other)
{
CCLOGINFO("In the move assignment operator of Map!");
AXLOGINFO("In the move assignment operator of Map!");
clear();
_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)
{
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");
}
NinePatchImageParser::NinePatchImageParser(Image* image, const Rect& frame, bool 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");
}
@ -173,7 +173,7 @@ Rect NinePatchImageParser::parseCapInset() const
void NinePatchImageParser::setSpriteFrameInfo(Image* image, const axis::Rect& frameRect, bool rotated)
{
this->_image = image;
CCASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8,
AXASSERT(image->getPixelFormat() == backend::PixelFormat::RGBA8,
"unsupported format, currently only supports rgba8888");
this->_imageFrame = frameRect;
this->_isRotated = rotated;

View File

@ -142,7 +142,7 @@ void ProfilingEndTimingBlock(const char* timerName)
Profiler* p = Profiler::getInstance();
ProfilingTimer* timer = p->_activeTimers.at(timerName);
CCASSERT(timer, "CCProfilingTimer not found");
AXASSERT(timer, "CCProfilingTimer not found");
int32_t duration =
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();
ProfilingTimer* timer = p->_activeTimers.at(timerName);
CCASSERT(timer, "CCProfilingTimer not found");
AXASSERT(timer, "CCProfilingTimer not found");
timer->reset();
}

View File

@ -101,7 +101,7 @@ Properties* Properties::createNonRefCounted(std::string_view url)
{
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;
}
@ -122,7 +122,7 @@ Properties* Properties::createNonRefCounted(std::string_view url)
Properties* p = getPropertiesFromNamespacePath(properties, namespacePath);
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);
return nullptr;
}
@ -159,7 +159,7 @@ static bool isVariable(const char* str, char* outName, size_t outSize)
void Properties::readProperties()
{
CCASSERT(_data->getSize() > 0, "Invalid data");
AXASSERT(_data->getSize() > 0, "Invalid data");
char line[2048];
char variable[256];
@ -185,7 +185,7 @@ void Properties::readProperties()
rc = readLine(line, 2048);
if (rc == NULL)
{
CCLOGERROR("Error reading line from file.");
AXLOGERROR("Error reading line from file.");
return;
}
@ -219,7 +219,7 @@ void Properties::readProperties()
name = strtok(line, "=");
if (name == NULL)
{
CCLOGERROR("Error parsing properties file: attribute without name.");
AXLOGERROR("Error parsing properties file: attribute without name.");
return;
}
@ -230,7 +230,7 @@ void Properties::readProperties()
value = strtok(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;
}
@ -272,7 +272,7 @@ void Properties::readProperties()
name = trimWhiteSpace(name);
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;
}
else if (name[0] == '}')
@ -299,20 +299,20 @@ void Properties::readProperties()
{
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;
}
while (readChar() != '}')
{
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;
}
}
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;
}
}
@ -326,7 +326,7 @@ void Properties::readProperties()
{
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;
}
}
@ -341,20 +341,20 @@ void Properties::readProperties()
{
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;
}
while (readChar() != '}')
{
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;
}
}
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;
}
}
@ -368,7 +368,7 @@ void Properties::readProperties()
{
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;
}
}
@ -388,7 +388,7 @@ void Properties::readProperties()
{
// Back up from fgetc()
if (seekFromCurrent(-1) == false)
CCLOGERROR(
AXLOGERROR(
"Failed to seek backwards a single character after testing if the next line starts "
"with '{'.");
@ -481,7 +481,7 @@ void Properties::skipWhiteSpace()
{
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)
{
CCASSERT(overrides, "Invalid overrides");
AXASSERT(overrides, "Invalid overrides");
// Overwrite or add each property found in child.
overrides->rewind();
@ -674,7 +674,7 @@ void Properties::rewind()
Properties* Properties::getNamespace(const char* id, bool searchNames, bool recurse) const
{
CCASSERT(id, "invalid id");
AXASSERT(id, "invalid id");
for (const auto& it : _namespaces)
{
@ -720,7 +720,7 @@ bool Properties::exists(const char* name) const
static bool isStringNumeric(const char* str)
{
CCASSERT(str, "invalid str");
AXASSERT(str, "invalid str");
// The first character may be '-'
if (*str == '-')
@ -879,7 +879,7 @@ int Properties::getInt(const char* name) const
scanned = sscanf(valueString, "%d", &value);
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 value;
@ -898,7 +898,7 @@ float Properties::getFloat(const char* name) const
scanned = sscanf(valueString, "%f", &value);
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 value;
@ -909,7 +909,7 @@ float Properties::getFloat(const char* name) const
bool Properties::getMat4(const char* name, Mat4* out) const
{
CCASSERT(out, "Invalid out");
AXASSERT(out, "Invalid out");
const char* valueString = getString(name);
if (valueString)
@ -921,7 +921,7 @@ bool Properties::getMat4(const char* name, Mat4* out) const
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();
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
{
CCASSERT(name && path, "Invalid name or path");
AXASSERT(name && path, "Invalid name or path");
const char* valueString = getString(name);
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)
{
CCASSERT(name, "Invalid name");
AXASSERT(name, "Invalid name");
Property* prop = NULL;
@ -1071,7 +1071,7 @@ Properties* Properties::clone()
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();
p->_namespaces.push_back(child);
child->_parent = p;
@ -1144,7 +1144,7 @@ Properties* getPropertiesFromNamespacePath(Properties* properties, const std::ve
{
if (iter == NULL)
{
CCLOGWARN("Failed to load properties object from url.");
AXLOGWARN("Failed to load properties object from url.");
return nullptr;
}
@ -1185,7 +1185,7 @@ bool Properties::parseVec2(const char* str, Vec2* out)
}
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
{
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
{
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
{
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
{
// 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
{
// 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
{
// 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
{
// 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()
{
CCASSERT(_referenceCount > 0, "reference count should be greater than 0");
AXASSERT(_referenceCount > 0, "reference count should be greater than 0");
++_referenceCount;
}
void Ref::release()
{
CCASSERT(_referenceCount > 0, "reference count should be greater than 0");
AXASSERT(_referenceCount > 0, "reference count should be greater than 0");
--_referenceCount;
if (_referenceCount == 0)
{
#if defined(COCOS2D_DEBUG) && (COCOS2D_DEBUG > 0)
#if defined(AXIS_DEBUG) && (AXIS_DEBUG > 0)
auto poolManager = PoolManager::getInstance();
if (!poolManager->getCurrentPool()->isClearing() && poolManager->isObjectInPools(this))
{
@ -123,7 +123,7 @@ void Ref::release()
// auto obj = Node::create();
// obj->retain();
// 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
@ -175,7 +175,7 @@ void Ref::printLeaks()
static void trackRef(Ref* ref)
{
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.
__refAllocationList.push_back(ref);

View File

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

View File

@ -296,8 +296,8 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
bool paused,
std::string_view key)
{
CCASSERT(target, "Argument target must be non-nullptr");
CCASSERT(!key.empty(), "key should not be empty!");
AXASSERT(target, "Argument target must be non-nullptr");
AXASSERT(!key.empty(), "key should not be empty!");
tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
@ -314,7 +314,7 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
}
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)
@ -329,7 +329,7 @@ void Scheduler::schedule(const ccSchedulerFunc& callback,
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);
timer->setupTimerWithInterval(interval, repeat, delay);
return;
@ -352,8 +352,8 @@ void Scheduler::unschedule(std::string_view key, void* target)
return;
}
// CCASSERT(target);
// CCASSERT(selector);
// AXASSERT(target);
// AXASSERT(selector);
tHashTimerEntry* element = nullptr;
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
{
CCASSERT(!key.empty(), "Argument key must not be empty");
CCASSERT(target, "Argument target must be non-nullptr");
AXASSERT(!key.empty(), "Argument key must not be empty");
AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
@ -688,7 +688,7 @@ void Scheduler::unscheduleScriptEntry(unsigned int scheduleScriptEntryID)
void Scheduler::resumeTarget(void* target)
{
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(target != nullptr, "target can't be nullptr!");
// custom selectors
tHashTimerEntry* element = nullptr;
@ -703,14 +703,14 @@ void Scheduler::resumeTarget(void* target)
HASH_FIND_PTR(_hashForUpdates, &target, 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;
}
}
void Scheduler::pauseTarget(void* target)
{
CCASSERT(target != nullptr, "target can't be nullptr!");
AXASSERT(target != nullptr, "target can't be nullptr!");
// custom selectors
tHashTimerEntry* element = nullptr;
@ -725,14 +725,14 @@ void Scheduler::pauseTarget(void* target)
HASH_FIND_PTR(_hashForUpdates, &target, 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;
}
}
bool Scheduler::isTargetPaused(void* target)
{
CCASSERT(target != nullptr, "target must be non nil");
AXASSERT(target != nullptr, "target must be non nil");
// Custom selectors
tHashTimerEntry* element = nullptr;
@ -880,7 +880,7 @@ void Scheduler::update(float dt)
for (elt->timerIndex = 0; elt->timerIndex < elt->timers->num; ++(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);
@ -966,7 +966,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
float delay,
bool paused)
{
CCASSERT(target, "Argument target must be non-nullptr");
AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr;
HASH_FIND_PTR(_hashForTimers, &target, element);
@ -983,7 +983,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
}
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)
@ -998,7 +998,7 @@ void Scheduler::schedule(SEL_SCHEDULE selector,
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);
timer->setupTimerWithInterval(interval, repeat, delay);
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
{
CCASSERT(selector, "Argument selector must be non-nullptr");
CCASSERT(target, "Argument target must be non-nullptr");
AXASSERT(selector, "Argument selector must be non-nullptr");
AXASSERT(target, "Argument target must be non-nullptr");
tHashTimerEntry* element = nullptr;
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
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");
switch (_type)
@ -491,7 +491,7 @@ unsigned char Value::asByte(unsigned char 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");
switch (_type)
{
@ -523,7 +523,7 @@ int Value::asInt(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");
switch (_type)
{
@ -556,7 +556,7 @@ unsigned int Value::asUint(unsigned int 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");
switch (_type)
{
@ -589,7 +589,7 @@ int64_t Value::asInt64(int64_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");
switch (_type)
{
@ -622,7 +622,7 @@ uint64_t Value::asUint64(uint64_t 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");
switch (_type)
{
@ -654,7 +654,7 @@ float Value::asFloat(float 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");
switch (_type)
{
@ -686,7 +686,7 @@ double Value::asDouble(double 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");
switch (_type)
{
@ -718,7 +718,7 @@ bool Value::asBool(bool defaultValue) 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");
if (_type == Type::STRING)
@ -778,37 +778,37 @@ std::string_view Value::asStringRef() const
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;
}
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;
}
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;
}
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;
}
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;
}
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;
}
@ -892,7 +892,7 @@ static std::string visit(const Value& v, int depth)
ret << visitMap(v.asIntKeyMap(), depth);
break;
default:
CCASSERT(false, "Invalid type!");
AXASSERT(false, "Invalid type!");
break;
}

View File

@ -120,7 +120,7 @@ public:
explicit Vector<T>(ssize_t capacity) : _data()
{
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);
}
@ -136,7 +136,7 @@ public:
/** Destructor. */
~Vector<T>()
{
CCLOGINFO("In the destructor of Vector.");
AXLOGINFO("In the destructor of Vector.");
clear();
}
@ -144,7 +144,7 @@ public:
Vector<T>(const Vector<T>& other)
{
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;
addRefForAllObjects();
}
@ -153,7 +153,7 @@ public:
Vector<T>(Vector<T>&& other)
{
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);
}
@ -162,7 +162,7 @@ public:
{
if (this != &other)
{
CCLOGINFO("In the copy assignment operator!");
AXLOGINFO("In the copy assignment operator!");
clear();
_data = other._data;
addRefForAllObjects();
@ -175,7 +175,7 @@ public:
{
if (this != &other)
{
CCLOGINFO("In the move assignment operator!");
AXLOGINFO("In the move assignment operator!");
clear();
_data = std::move(other._data);
}
@ -251,7 +251,7 @@ public:
/** Returns the element at position 'index' in the Vector. */
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];
}
@ -305,7 +305,7 @@ public:
/** Adds a new element at the end of the Vector. */
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);
object->retain();
}
@ -327,8 +327,8 @@ public:
*/
void insert(ssize_t index, T object)
{
CCASSERT(index >= 0 && index <= size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr");
AXASSERT(index >= 0 && index <= size(), "Invalid index!");
AXASSERT(object != nullptr, "The object should not be nullptr");
_data.insert((std::begin(_data) + index), object);
object->retain();
}
@ -338,7 +338,7 @@ public:
/** Removes the last element in the Vector. */
void popBack()
{
CCASSERT(!_data.empty(), "no objects added");
AXASSERT(!_data.empty(), "no objects added");
auto last = _data.back();
_data.pop_back();
last->release();
@ -351,7 +351,7 @@ public:
*/
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)
{
@ -386,7 +386,7 @@ public:
*/
iterator erase(iterator position)
{
CCASSERT(position >= _data.begin() && position < _data.end(), "Invalid position!");
AXASSERT(position >= _data.begin() && position < _data.end(), "Invalid position!");
(*position)->release();
return _data.erase(position);
}
@ -413,7 +413,7 @@ public:
*/
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);
(*it)->release();
return _data.erase(it);
@ -439,7 +439,7 @@ public:
ssize_t idx1 = getIndex(object1);
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]);
}
@ -447,7 +447,7 @@ public:
/** Swap two elements by indexes. */
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]);
}
@ -455,8 +455,8 @@ public:
/** Replace value at index with given object. */
void replace(ssize_t index, T object)
{
CCASSERT(index >= 0 && index < size(), "Invalid index!");
CCASSERT(object != nullptr, "The object should not be nullptr");
AXASSERT(index >= 0 && index < size(), "Invalid index!");
AXASSERT(object != nullptr, "The object should not be nullptr");
_data[index]->release();
_data[index] = object;

View File

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

View File

@ -64,7 +64,7 @@ void ccArrayDoubleCapacity(ccArray* arr)
arr->max *= 2;
Ref** newArr = (Ref**)realloc(arr->arr, arr->max * sizeof(Ref*));
// 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;
}
@ -72,7 +72,7 @@ void ccArrayEnsureExtraCapacity(ccArray* arr, ssize_t 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);
}
@ -97,7 +97,7 @@ void ccArrayShrink(ccArray* arr)
}
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. */
void ccArrayAppendObject(ccArray* arr, Ref* object)
{
CCASSERT(object != nullptr, "Invalid parameter!");
AXASSERT(object != nullptr, "Invalid parameter!");
object->retain();
arr->arr[arr->num] = object;
arr->num++;
@ -157,8 +157,8 @@ void ccArrayAppendArrayWithResize(ccArray* arr, ccArray* plusArr)
/** Inserts an object at index */
void ccArrayInsertObjectAtIndex(ccArray* arr, Ref* object, ssize_t index)
{
CCASSERT(index <= arr->num, "Invalid index. Out of bounds");
CCASSERT(object != nullptr, "Invalid parameter!");
AXASSERT(index <= arr->num, "Invalid index. Out of bounds");
AXASSERT(object != nullptr, "Invalid parameter!");
ccArrayEnsureExtraCapacity(arr, 1);
@ -176,8 +176,8 @@ void ccArrayInsertObjectAtIndex(ccArray* arr, Ref* object, ssize_t index)
/** Swaps two objects */
void ccArraySwapObjectsAtIndexes(ccArray* arr, ssize_t index1, ssize_t index2)
{
CCASSERT(index1 >= 0 && index1 < arr->num, "(1) Invalid index. Out of bounds");
CCASSERT(index2 >= 0 && index2 < arr->num, "(2) Invalid index. Out of bounds");
AXASSERT(index1 >= 0 && index1 < arr->num, "(1) Invalid index. Out of bounds");
AXASSERT(index2 >= 0 && index2 < arr->num, "(2) Invalid index. Out of bounds");
Ref* object1 = arr->arr[index1];
@ -198,7 +198,7 @@ void ccArrayRemoveAllObjects(ccArray* arr)
Behavior undefined if index outside [0, num-1]. */
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)
{
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 */
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;
// make sure it has enough capacity

View File

@ -36,11 +36,11 @@ THE SOFTWARE.
#include "base/CCConsole.h"
#include "platform/CCStdC.h"
#ifndef CCASSERT
# if COCOS2D_DEBUG > 0
#ifndef AXASSERT
# if AXIS_DEBUG > 0
# if AX_ENABLE_SCRIPT_BINDING
extern bool AX_DLL cc_assert_script_compatible(const char* msg);
# define CCASSERT(cond, msg) \
# define AXASSERT(cond, msg) \
do \
{ \
if (!(cond)) \
@ -51,17 +51,17 @@ extern bool AX_DLL cc_assert_script_compatible(const char* msg);
} \
} while (0)
# else
# define CCASSERT(cond, msg) AX_ASSERT(cond)
# define AXASSERT(cond, msg) AX_ASSERT(cond)
# endif
# else
# define CCASSERT(cond, msg)
# define AXASSERT(cond, msg)
# endif
# define GP_ASSERT(cond) CCASSERT(cond, "")
# define GP_ASSERT(cond) AXASSERT(cond, "")
// FIXME:: Backward compatible
# define CCAssert CCASSERT
#endif // CCASSERT
# define CCAssert AXASSERT
#endif // AXASSERT
#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)
/** @def CCRANDOM_MINUS1_1
/** @def AXRANDOM_MINUS1_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
*/
#define CCRANDOM_0_1() axis::rand_0_1()
#define AXRANDOM_0_1() axis::rand_0_1()
/** @def AX_DEGREES_TO_RADIANS
converts degrees to radians

View File

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

View File

@ -82,7 +82,7 @@ void captureScreen(std::function<void(RefPtr<Image>)> imageCallback)
{
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;
}
@ -119,7 +119,7 @@ void captureNode(Node* startNode, std::function<void(RefPtr<Image>)> imageCallba
{
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;
}
@ -305,7 +305,7 @@ Sprite* createSpriteFromBase64Cached(const char* base64String, const char* key)
Image* image = new Image();
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)
{
@ -329,7 +329,7 @@ Sprite* createSpriteFromBase64(const char* base64String)
Image* image = new Image();
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)
{
@ -609,7 +609,7 @@ backend::SamplerFilter toBackendSamplerFilter(int mode)
case GLTexParamConst::NEAREST_MIPMAP_NEAREST:
return backend::SamplerFilter::NEAREST;
default:
CCASSERT(false, "invalid GL sampler filter!");
AXASSERT(false, "invalid GL sampler filter!");
return backend::SamplerFilter::LINEAR;
}
}
@ -626,7 +626,7 @@ backend::SamplerAddressMode toBackendAddressMode(int mode)
case GLTexParamConst::MIRROR_REPEAT:
return backend::SamplerAddressMode::MIRROR_REPEAT;
default:
CCASSERT(false, "invalid GL address mode");
AXASSERT(false, "invalid GL address mode");
return backend::SamplerAddressMode::REPEAT;
}
}
@ -671,7 +671,7 @@ std::vector<int> parseIntegerList(std::string_view intsString)
if (errno == ERANGE)
{
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));
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;
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);
return;
}

View File

@ -63,7 +63,7 @@ Rect& Rect::operator=(const Rect& other)
void Rect::setRect(float x, float y, float width, float height)
{
// 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.y = y;

View File

@ -75,15 +75,15 @@ void HttpClient::destroyInstance()
{
if (nullptr == _httpClient)
{
CCLOG("HttpClient singleton is nullptr");
AXLOG("HttpClient singleton is nullptr");
return;
}
CCLOG("HttpClient::destroyInstance begin");
AXLOG("HttpClient::destroyInstance begin");
delete _httpClient;
_httpClient = nullptr;
CCLOG("HttpClient::destroyInstance() finished!");
AXLOG("HttpClient::destroyInstance() finished!");
}
void HttpClient::enableCookies(const char* cookieFile)
@ -119,7 +119,7 @@ HttpClient::HttpClient()
, _cookie(nullptr)
, _clearResponsePredicate(nullptr)
{
CCLOG("In the constructor of HttpClient!");
AXLOG("In the constructor of HttpClient!");
_scheduler = Director::getInstance()->getScheduler();
_service = new yasio::io_service(HttpClient::MAX_CHANNELS);
@ -151,7 +151,7 @@ HttpClient::~HttpClient()
delete _cookie;
}
CCLOG("HttpClient destructor");
AXLOG("HttpClient destructor");
}
void HttpClient::setDispatchOnWorkThread(bool bVal)
@ -408,7 +408,7 @@ void HttpClient::handleNetworkEOF(HttpResponse* response, yasio::io_channel* cha
{
if (responseCode == 302)
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());
processResponse(response, iter->second);
response->release();

View File

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

View File

@ -84,12 +84,12 @@ public:
/**
* 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.
*/
axis::Ref* autorelease()
{
CCASSERT(false,
AXASSERT(false,
"HttpResponse is used between network thread and ui thread \
therefore, autorelease is forbidden here");
return nullptr;

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