From c0a437187924492e597ba9d39f71c0023b18c050 Mon Sep 17 00:00:00 2001 From: halx99 Date: Sat, 16 Jul 2022 10:43:05 +0800 Subject: [PATCH] Migrate more macors --- APPENDIX.md | 2 +- core/2d/CCAction.cpp | 10 +- core/2d/CCActionCatmullRom.cpp | 4 +- core/2d/CCActionEase.cpp | 4 +- core/2d/CCActionGrid.cpp | 10 +- core/2d/CCActionGrid3D.cpp | 4 +- core/2d/CCActionInterval.cpp | 42 +-- core/2d/CCActionManager.cpp | 22 +- core/2d/CCActionProgressTimer.cpp | 2 +- core/2d/CCActionTween.cpp | 2 +- core/2d/CCAnimation.cpp | 4 +- core/2d/CCAnimationCache.cpp | 22 +- core/2d/CCAtlasNode.cpp | 4 +- core/2d/CCAutoPolygon.cpp | 22 +- core/2d/CCCamera.cpp | 12 +- core/2d/CCClippingNode.cpp | 4 +- core/2d/CCComponentContainer.cpp | 6 +- core/2d/CCDrawNode.cpp | 8 +- core/2d/CCFastTMXLayer.cpp | 26 +- core/2d/CCFastTMXTiledMap.cpp | 12 +- core/2d/CCFontCharMap.cpp | 2 +- core/2d/CCFontFNT.cpp | 26 +- core/2d/CCFontFreeType.cpp | 2 +- core/2d/CCGrid.cpp | 14 +- core/2d/CCLabel.cpp | 16 +- core/2d/CCLabelAtlas.cpp | 4 +- core/2d/CCLabelTextFormatter.cpp | 2 +- core/2d/CCLayer.cpp | 4 +- core/2d/CCMenu.cpp | 28 +- core/2d/CCMenuItem.cpp | 6 +- core/2d/CCMotionStreak.cpp | 8 +- core/2d/CCNode.cpp | 58 ++-- core/2d/CCParallaxNode.cpp | 6 +- core/2d/CCParticleBatchNode.cpp | 34 +-- core/2d/CCParticleSystem.cpp | 88 +++--- core/2d/CCParticleSystemQuad.cpp | 12 +- core/2d/CCPlistSpriteSheetLoader.cpp | 24 +- core/2d/CCProtectedNode.cpp | 14 +- core/2d/CCRenderTexture.cpp | 22 +- core/2d/CCSprite.cpp | 64 ++--- core/2d/CCSpriteBatchNode.cpp | 58 ++-- core/2d/CCSpriteFrame.cpp | 2 +- core/2d/CCSpriteFrameCache.cpp | 12 +- core/2d/CCTMXObjectGroup.cpp | 2 +- core/2d/CCTMXXMLParser.cpp | 22 +- core/2d/CCTileMapAtlas.cpp | 24 +- core/2d/CCTransition.cpp | 4 +- core/2d/CCTransitionProgress.cpp | 2 +- core/3d/CC3DProgramInfo.cpp | 2 +- core/3d/CCAnimate3D.cpp | 4 +- core/3d/CCBillBoard.cpp | 2 +- core/3d/CCBundle3D.cpp | 142 +++++----- core/3d/CCBundle3DData.cpp | 2 +- core/3d/CCBundleReader.cpp | 4 +- core/3d/CCBundleReader.h | 2 +- core/3d/CCMesh.cpp | 8 +- core/3d/CCMeshMaterial.cpp | 6 +- core/3d/CCMeshRenderer.cpp | 14 +- core/3d/CCMeshSkin.cpp | 2 +- core/3d/CCMotionStreak3D.cpp | 6 +- core/3d/CCOBB.cpp | 4 +- core/3d/CCSkybox.cpp | 2 +- core/3d/CCTerrain.cpp | 8 +- core/3d/CCVertexAttribBinding.cpp | 12 +- core/audio/AudioMacros.h | 6 +- core/base/CCAutoreleasePool.cpp | 18 +- core/base/CCAutoreleasePool.h | 4 +- core/base/CCConfiguration.cpp | 16 +- core/base/CCConsole.cpp | 4 +- core/base/CCController-android.cpp | 14 +- core/base/CCController-linux-win32.cpp | 24 +- core/base/CCData.cpp | 20 +- core/base/CCDirector.cpp | 48 ++-- core/base/CCEventDispatcher.cpp | 58 ++-- core/base/CCEventDispatcher.h | 2 +- core/base/CCEventListener.cpp | 2 +- core/base/CCEventListenerAcceleration.cpp | 4 +- core/base/CCEventListenerController.cpp | 2 +- core/base/CCEventListenerFocus.cpp | 4 +- core/base/CCEventListenerKeyboard.cpp | 2 +- core/base/CCEventListenerTouch.cpp | 8 +- core/base/CCMap.h | 28 +- core/base/CCNinePatchImageParser.cpp | 6 +- core/base/CCProfiling.cpp | 4 +- core/base/CCProperties.cpp | 72 ++--- core/base/CCRef.cpp | 10 +- core/base/CCRefPtr.h | 4 +- core/base/CCScheduler.cpp | 38 +-- core/base/CCValue.cpp | 32 +-- core/base/CCVector.h | 36 +-- core/base/ZipUtils.cpp | 68 ++--- core/base/ccCArray.cpp | 20 +- core/base/ccMacros.h | 24 +- core/base/ccUTF8.cpp | 2 +- core/base/ccUtils.cpp | 14 +- core/math/Mat4.cpp | 2 +- core/math/Rect.cpp | 2 +- core/network/HttpClient.cpp | 12 +- core/network/HttpRequest.h | 2 +- core/network/HttpResponse.h | 4 +- core/network/Uri.cpp | 8 +- core/physics/CCPhysicsBody.cpp | 6 +- core/physics/CCPhysicsContact.cpp | 2 +- core/physics/CCPhysicsJoint.cpp | 6 +- core/physics/CCPhysicsShape.cpp | 2 +- core/physics/CCPhysicsWorld.cpp | 18 +- core/physics3d/CCPhysics3DDebugDrawer.cpp | 2 +- core/physics3d/CCPhysics3DObject.cpp | 4 +- core/platform/CCFileUtils.cpp | 50 ++-- core/platform/CCGLView.cpp | 28 +- core/platform/CCImage.cpp | 80 +++--- core/platform/CCPlatformMacros.h | 36 +-- core/platform/CCSAXParser.cpp | 2 +- core/platform/android/CCDevice-android.cpp | 2 +- core/platform/android/CCFileUtils-android.cpp | 8 +- core/platform/apple/CCFileUtils-apple.mm | 8 +- .../platform/desktop/CCGLViewImpl-desktop.cpp | 6 +- core/platform/ios/CCEAGLView-ios.mm | 14 +- core/platform/ios/CCES2Renderer-ios.m | 4 +- core/platform/ios/CCGLViewImpl-ios.mm | 6 +- core/platform/ios/CCImage-ios.mm | 2 +- core/platform/ios/CCInputView-ios.mm | 38 +-- core/platform/linux/CCFileUtils-linux.cpp | 2 +- core/platform/mac/CCApplication-mac.mm | 6 +- core/platform/mac/CCDevice-mac.mm | 4 +- core/platform/mac/CCGLViewImpl-mac.mm | 8 +- core/platform/win32/CCFileUtils-win32.cpp | 20 +- core/renderer/CCMaterial.cpp | 18 +- core/renderer/CCPass.cpp | 2 +- core/renderer/CCQuadCommand.cpp | 2 +- core/renderer/CCRenderCommandPool.h | 4 +- core/renderer/CCRenderState.cpp | 10 +- core/renderer/CCRenderer.cpp | 16 +- core/renderer/CCTexture2D.cpp | 40 +-- core/renderer/CCTextureAtlas.cpp | 48 ++-- core/renderer/CCTextureCache.cpp | 16 +- core/renderer/CCTextureCache.h | 2 +- core/renderer/CCTextureCube.cpp | 8 +- core/renderer/CCTrianglesCommand.cpp | 2 +- core/renderer/backend/PixelFormatUtils.cpp | 18 +- core/renderer/backend/ProgramCache.cpp | 4 +- core/renderer/backend/ShaderCache.cpp | 4 +- core/renderer/backend/metal/DeviceMTL.mm | 2 +- core/renderer/backend/metal/ProgramMTL.mm | 8 +- core/renderer/backend/metal/TextureMTL.mm | 2 +- core/renderer/backend/opengl/BufferGL.cpp | 4 +- .../backend/opengl/CommandBufferGL.cpp | 2 +- core/renderer/backend/opengl/MacrosGL.h | 2 +- core/renderer/backend/opengl/ProgramGL.cpp | 2 +- .../backend/opengl/ShaderModuleGL.cpp | 2 +- core/renderer/backend/opengl/UtilsGL.cpp | 4 +- core/ui/UIEditBox/Mac/CCUIEditBoxMac.mm | 12 +- core/ui/UIEditBox/UIEditBox.cpp | 16 +- core/ui/UIEditBox/UIEditBoxImpl-android.cpp | 2 +- core/ui/UIEditBox/UIEditBoxImpl-common.cpp | 2 +- core/ui/UIEditBox/UIEditBoxImpl-ios.mm | 2 +- core/ui/UIEditBox/UIEditBoxImpl-linux.cpp | 2 +- core/ui/UIEditBox/UIEditBoxImpl-mac.mm | 2 +- core/ui/UIEditBox/UIEditBoxImpl-win32.cpp | 2 +- core/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm | 8 +- core/ui/UIHelper.cpp | 6 +- core/ui/UIImageView.cpp | 2 +- core/ui/UILayout.cpp | 20 +- core/ui/UIListView.cpp | 10 +- core/ui/UIPageView.cpp | 14 +- core/ui/UIRadioButton.cpp | 10 +- core/ui/UIRichText.cpp | 2 +- core/ui/UIScale9Sprite.cpp | 4 +- core/ui/UIScrollView.cpp | 52 ++-- core/ui/UIScrollViewBar.cpp | 4 +- core/ui/UITabControl.cpp | 4 +- core/ui/UITextAtlas.cpp | 4 +- core/ui/UITextFieldEx.cpp | 8 +- core/ui/UIWebView/UIWebViewImpl-win32.cpp | 2 +- core/ui/UIWidget.cpp | 2 +- docs/CODING_STYLE.md | 24 +- examples/SimpleSnake/Classes/AppDelegate.cpp | 4 +- .../SimpleSnake/Classes/SimpleSnakeScene.cpp | 4 +- .../CCControlExtension/CCControlButton.cpp | 6 +- .../CCControlExtension/CCControlSlider.cpp | 8 +- .../CCControlExtension/CCControlStepper.cpp | 10 +- .../CCControlExtension/CCControlSwitch.cpp | 10 +- extensions/GUI/CCScrollView/CCScrollView.cpp | 4 +- extensions/ImGui/ImGuiPresenter.cpp | 2 +- extensions/Particle3D/CCParticle3DRender.cpp | 6 +- extensions/Particle3D/CCParticleSystem3D.cpp | 4 +- extensions/Particle3D/PU/CCPUBaseCollider.cpp | 2 +- extensions/Particle3D/PU/CCPUBeamRender.cpp | 2 +- .../Particle3D/PU/CCPUBillboardChain.cpp | 18 +- extensions/Particle3D/PU/CCPUBoxEmitter.cpp | 6 +- .../PU/CCPUCollisionAvoidanceAffector.cpp | 2 +- extensions/Particle3D/PU/CCPUEmitter.cpp | 4 +- .../Particle3D/PU/CCPUGeometryRotator.cpp | 14 +- .../PU/CCPUInterParticleCollider.cpp | 2 +- extensions/Particle3D/PU/CCPULineAffector.cpp | 6 +- extensions/Particle3D/PU/CCPULineEmitter.cpp | 8 +- .../Particle3D/PU/CCPUMaterialManager.cpp | 8 +- .../Particle3D/PU/CCPUMeshSurfaceEmitter.cpp | 16 +- extensions/Particle3D/PU/CCPUObserver.cpp | 4 +- .../Particle3D/PU/CCPUOnRandomObserver.cpp | 2 +- .../Particle3D/PU/CCPUPositionEmitter.cpp | 2 +- extensions/Particle3D/PU/CCPURandomiser.cpp | 10 +- extensions/Particle3D/PU/CCPURender.cpp | 14 +- extensions/Particle3D/PU/CCPURibbonTrail.cpp | 22 +- .../Particle3D/PU/CCPURibbonTrailRender.cpp | 2 +- .../Particle3D/PU/CCPUScriptTranslator.cpp | 2 +- extensions/Particle3D/PU/CCPUSimpleSpline.cpp | 6 +- .../PU/CCPUSphereSurfaceEmitter.cpp | 2 +- extensions/Particle3D/PU/CCPUUtil.cpp | 2 +- extensions/assets-manager/AssetsManager.cpp | 32 +-- extensions/assets-manager/AssetsManagerEx.cpp | 48 ++-- extensions/assets-manager/Manifest.cpp | 4 +- .../ActionTimeline/CCActionTimeline.cpp | 10 +- .../ActionTimeline/CCActionTimelineCache.cpp | 4 +- .../cocostudio/ActionTimeline/CCBoneNode.cpp | 4 +- .../cocostudio/ActionTimeline/CCFrame.cpp | 8 +- .../cocostudio/ActionTimeline/CSLoader.cpp | 26 +- extensions/cocostudio/CCArmature.cpp | 14 +- extensions/cocostudio/CCArmatureAnimation.cpp | 10 +- extensions/cocostudio/CCBone.cpp | 6 +- extensions/cocostudio/CCDataReaderHelper.cpp | 6 +- extensions/cocostudio/CCDisplayManager.cpp | 2 +- extensions/cocostudio/CCSGUIReader.cpp | 28 +- extensions/cocostudio/CCSSceneReader.cpp | 2 +- extensions/cocostudio/CCSkin.cpp | 2 +- .../cocostudio/FlatBuffersSerialize.cpp | 26 +- extensions/cocostudio/TriggerMng.cpp | 4 +- extensions/cocostudio/TriggerObj.cpp | 10 +- .../TextAtlasReader/TextAtlasReader.cpp | 4 +- .../TextBMFontReader/TextBMFontReader.cpp | 2 +- .../cocostudio/WidgetReader/WidgetReader.cpp | 6 +- extensions/fairygui/Controller.cpp | 2 +- extensions/fairygui/GComboBox.cpp | 4 +- extensions/fairygui/GComponent.cpp | 38 +-- extensions/fairygui/GList.cpp | 16 +- extensions/fairygui/GRoot.cpp | 2 +- extensions/fairygui/GScrollBar.cpp | 4 +- extensions/fairygui/GTree.cpp | 2 +- extensions/fairygui/GTreeNode.cpp | 26 +- extensions/fairygui/PopupMenu.cpp | 4 +- extensions/fairygui/Relations.cpp | 2 +- extensions/fairygui/ScrollPane.cpp | 8 +- extensions/fairygui/UIObjectFactory.cpp | 2 +- extensions/fairygui/UIPackage.cpp | 14 +- extensions/fairygui/display/FUIContainer.cpp | 2 +- extensions/fairygui/display/FUIRichText.cpp | 8 +- extensions/fairygui/display/FUISprite.cpp | 4 +- extensions/fairygui/utils/html/HtmlObject.cpp | 6 +- .../physics-nodes/CCPhysicsDebugNode.cpp | 2 +- .../CCPhysicsDebugNodeChipmunk2D.cpp | 2 +- extensions/physics-nodes/CCPhysicsSprite.cpp | 12 +- .../lua-bindings/manual/AxisLuaLoader.cpp | 2 +- .../lua-bindings/manual/CCComponentLua.cpp | 8 +- .../lua-bindings/manual/CCLuaBridge.cpp | 12 +- .../lua-bindings/manual/CCLuaEngine.cpp | 2 +- .../lua-bindings/manual/CCLuaStack.cpp | 36 +-- .../manual/LuaBasicConversions.cpp | 38 +-- .../lua-bindings/manual/LuaBasicConversions.h | 2 +- .../controller/lua_axis_controller_manual.cpp | 6 +- .../manual/network/lua_xml_http_request.cpp | 6 +- extensions/spine/SkeletonAnimation.cpp | 2 +- extensions/spine/SkeletonBatch.cpp | 2 +- extensions/spine/SkeletonRenderer.cpp | 12 +- extensions/spine/SkeletonTwoColorBatch.cpp | 4 +- extensions/spine/spine-cocos2dx.cpp | 2 +- .../ActionsEaseTest/ActionsEaseTest.cpp | 6 +- .../Classes/ActionsTest/ActionsTest.cpp | 10 +- .../Classes/BillBoardTest/BillBoardTest.cpp | 14 +- .../cpp-tests/Classes/Box2DTest/Box2dTest.cpp | 8 +- .../Classes/Box2DTestBed/Box2DTestBed.cpp | 4 +- tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp | 28 +- tests/cpp-tests/Classes/BugsTest/Bug-422.cpp | 4 +- .../cpp-tests/Classes/BugsTest/Bug-Child.cpp | 4 +- .../Classes/ChipmunkTest/ChipmunkTest.cpp | 4 +- .../Classes/ChipmunkTestBed/demo/Bench.c | 2 +- .../ClippingNodeTest/ClippingNodeTest.cpp | 6 +- .../Classes/ConsoleTest/ConsoleTest.cpp | 6 +- .../CurrentLanguageTest.cpp | 2 +- .../DrawPrimitivesTest/DrawPrimitivesTest.cpp | 36 +-- .../AssetsManagerExTest.cpp | 20 +- .../TableViewTest/TableViewTestScene.cpp | 2 +- .../Classes/FileUtilsTest/FileUtilsTest.cpp | 18 +- .../Classes/LabelTest/LabelTestNew.cpp | 12 +- .../cpp-tests/Classes/LayerTest/LayerTest.cpp | 10 +- .../MaterialSystemTest/MaterialSystemTest.cpp | 12 +- tests/cpp-tests/Classes/MenuTest/MenuTest.cpp | 6 +- .../Classes/MeshRendererTest/DrawNode3D.cpp | 2 +- .../MeshRendererTest/MeshRendererTest.cpp | 28 +- .../HttpClientTest/HttpClientTest.cpp | 2 +- .../NewAudioEngineTest/NewAudioEngineTest.cpp | 4 +- .../NewEventDispatcherTest.cpp | 26 +- .../NewRendererTest/NewRendererTest.cpp | 8 +- tests/cpp-tests/Classes/NodeTest/NodeTest.cpp | 12 +- .../Classes/ParticleTest/ParticleTest.cpp | 6 +- .../Classes/Physics3DTest/Physics3DTest.cpp | 12 +- .../Classes/PhysicsTest/PhysicsTest.cpp | 54 ++-- .../ReleasePoolTest/ReleasePoolTest.cpp | 4 +- .../RenderTextureTest/RenderTextureTest.cpp | 20 +- .../cpp-tests/Classes/SceneTest/SceneTest.cpp | 6 +- .../Classes/SchedulerTest/SchedulerTest.cpp | 70 ++--- .../cpp-tests/Classes/SpineTest/SpineTest.cpp | 4 +- .../SpriteFrameCacheTest.cpp | 22 +- .../SpritePolygonTest/SpritePolygonTest.cpp | 4 +- .../Classes/SpriteTest/SpriteTest.cpp | 46 +-- .../Classes/TextInputTest/TextInputTest.cpp | 22 +- .../Classes/Texture2dTest/Texture2dTest.cpp | 12 +- .../Classes/TileMapTest/TileMapTest2.cpp | 72 ++--- .../cpp-tests/Classes/TouchesTest/Paddle.cpp | 10 +- .../UIButtonTest/UIButtonTest.cpp | 26 +- .../UICheckBoxTest/UICheckBoxTest.cpp | 10 +- .../UIFocusTest/UIFocusTest.cpp | 2 +- .../UIImageViewTest/UIImageViewTest.cpp | 8 +- .../UILayoutTest/UILayoutTest.cpp | 4 +- .../UIListViewTest/UIListViewTest.cpp | 20 +- .../UILoadingBarTest/UILoadingBarTest.cpp | 2 +- .../UIPageViewTest/UIPageViewTest.cpp | 26 +- .../UIRadioButtonTest/UIRadioButtonTest.cpp | 4 +- .../UIRichTextTest/UIRichTextTest.cpp | 4 +- .../CocoStudioGUITest/UIScale9SpriteTest.cpp | 22 +- .../UIScrollViewTest/UIScrollViewTest.cpp | 6 +- .../UISliderTest/UISliderTest.cpp | 16 +- .../UITextAtlasTest/UITextAtlasTest.cpp | 4 +- .../UITextBMFontTest/UITextBMFontTest.cpp | 2 +- .../UITextFieldTest/UITextFieldTest.cpp | 2 +- .../UITextTest/UITextTest.cpp | 6 +- .../UIWebViewTest/UIWebViewTest.cpp | 6 +- tests/cpp-tests/Classes/UnitTest/UnitTest.cpp | 268 +++++++++--------- .../UserDefaultTest/UserDefaultTest.cpp | 2 +- tests/cpp-tests/Classes/ZipTest/ZipTests.cpp | 8 +- tests/fairygui-tests/Classes/BasicsScene.cpp | 2 +- .../fairygui-tests/Classes/TreeViewScene.cpp | 2 +- .../Classes/lua_assetsmanager_test_sample.cpp | 8 +- .../project/Classes/lua_test_bindings.cpp | 20 +- .../NewEventDispatcherTest.lua | 2 +- .../targets/lua/templates/public_field.c | 2 +- 335 files changed, 2169 insertions(+), 2169 deletions(-) diff --git a/APPENDIX.md b/APPENDIX.md index 7d16c6645f..a42f246370 100644 --- a/APPENDIX.md +++ b/APPENDIX.md @@ -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: diff --git a/core/2d/CCAction.cpp b/core/2d/CCAction.cpp index 8f9f1eb846..a61424172a 100644 --- a/core/2d/CCAction.cpp +++ b/core/2d/CCAction.cpp @@ -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!"); diff --git a/core/2d/CCActionCatmullRom.cpp b/core/2d/CCActionCatmullRom.cpp index 84059238d9..f4c05889d3 100644 --- a/core/2d/CCActionCatmullRom.cpp +++ b/core/2d/CCActionCatmullRom.cpp @@ -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)) { diff --git a/core/2d/CCActionEase.cpp b/core/2d/CCActionEase.cpp index e1b7b77137..a924fae365 100644 --- a/core/2d/CCActionEase.cpp +++ b/core/2d/CCActionEase.cpp @@ -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)) diff --git a/core/2d/CCActionGrid.cpp b/core/2d/CCActionGrid.cpp index ac8c667ab3..e576180d32 100644 --- a/core/2d/CCActionGrid.cpp +++ b/core/2d/CCActionGrid.cpp @@ -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(_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(_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(_target); - CCASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); + AXASSERT(_gridNodeTarget, "GridActions can only used on NodeGrid"); } ReuseGrid* ReuseGrid::clone() const diff --git a/core/2d/CCActionGrid3D.cpp b/core/2d/CCActionGrid3D.cpp index b188d41a11..d273132c55 100644 --- a/core/2d/CCActionGrid3D.cpp +++ b/core/2d/CCActionGrid3D.cpp @@ -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; } diff --git a/core/2d/CCActionInterval.cpp b/core/2d/CCActionInterval.cpp index 733c6716bb..5601d748f9 100644 --- a/core/2d/CCActionInterval.cpp +++ b/core/2d/CCActionInterval.cpp @@ -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& 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& 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"); diff --git a/core/2d/CCActionManager.cpp b/core/2d/CCActionManager.cpp index e350879610..5772c7cdc0 100644 --- a/core/2d/CCActionManager.cpp +++ b/core/2d/CCActionManager.cpp @@ -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& 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); diff --git a/core/2d/CCActionProgressTimer.cpp b/core/2d/CCActionProgressTimer.cpp index 70b5a31b8c..5f09932abf 100644 --- a/core/2d/CCActionProgressTimer.cpp +++ b/core/2d/CCActionProgressTimer.cpp @@ -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; } diff --git a/core/2d/CCActionTween.cpp b/core/2d/CCActionTween.cpp index 9fcb6d9418..299401c42b 100644 --- a/core/2d/CCActionTween.cpp +++ b/core/2d/CCActionTween.cpp @@ -62,7 +62,7 @@ ActionTween* ActionTween::clone() const void ActionTween::startWithTarget(Node* target) { - CCASSERT(dynamic_cast(target), "target must implement ActionTweenDelegate"); + AXASSERT(dynamic_cast(target), "target must implement ActionTweenDelegate"); ActionInterval::startWithTarget(target); _delta = _to - _from; } diff --git a/core/2d/CCAnimation.cpp b/core/2d/CCAnimation.cpp index d667671a24..ab38c7e707 100644 --- a/core/2d/CCAnimation.cpp +++ b/core/2d/CCAnimation.cpp @@ -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) diff --git a/core/2d/CCAnimationCache.cpp b/core/2d/CCAnimationCache.cpp index efb18e971d..8b2e1c1921 100644 --- a/core/2d/CCAnimationCache.cpp +++ b/core/2d/CCAnimationCache.cpp @@ -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()); diff --git a/core/2d/CCAtlasNode.cpp b/core/2d/CCAtlasNode.cpp index 9185e2ff31..dbae27c2f5 100644 --- a/core/2d/CCAtlasNode.cpp +++ b/core/2d/CCAtlasNode.cpp @@ -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 diff --git a/core/2d/CCAutoPolygon.cpp b/core/2d/CCAutoPolygon.cpp index bdf0ca293f..085dc6d17b 100644 --- a/core/2d/CCAutoPolygon.cpp +++ b/core/2d/CCAutoPolygon.cpp @@ -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 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 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 diff --git a/core/2d/CCCamera.cpp b/core/2d/CCCamera.cpp index d0573caae0..6c650c5196 100644 --- a/core/2d/CCCamera.cpp +++ b/core/2d/CCCamera.cpp @@ -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; diff --git a/core/2d/CCClippingNode.cpp b/core/2d/CCClippingNode.cpp index c0e0b25881..9feabc2976 100644 --- a/core/2d/CCClippingNode.cpp +++ b/core/2d/CCClippingNode.cpp @@ -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); diff --git a/core/2d/CCComponentContainer.cpp b/core/2d/CCComponentContainer.cpp index ebaf27e470..ee61eac8c2 100644 --- a/core/2d/CCComponentContainer.cpp +++ b/core/2d/CCComponentContainer.cpp @@ -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; diff --git a/core/2d/CCDrawNode.cpp b/core/2d/CCDrawNode.cpp index 73f32ac113..dc3fb85ffe 100644 --- a/core/2d/CCDrawNode.cpp +++ b/core/2d/CCDrawNode.cpp @@ -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); diff --git a/core/2d/CCFastTMXLayer.cpp b/core/2d/CCFastTMXLayer.cpp index af2c574468..2cd59291b1 100644 --- a/core/2d/CCFastTMXLayer.cpp +++ b/core/2d/CCFastTMXLayer.cpp @@ -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)tileCoordinate.x + (int)tileCoordinate.y * _layerSize.width)); @@ -737,10 +737,10 @@ int FastTMXLayer::getVertexZForPos(const Vec2& pos) ret = static_cast(-(_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, ¤tFlags); diff --git a/core/2d/CCFastTMXTiledMap.cpp b/core/2d/CCFastTMXTiledMap.cpp index fadf34e839..e9894f1ee2 100644 --- a/core/2d/CCFastTMXTiledMap.cpp +++ b/core/2d/CCFastTMXTiledMap.cpp @@ -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) { diff --git a/core/2d/CCFontCharMap.cpp b/core/2d/CCFontCharMap.cpp index aba79dbd22..04bd453218 100644 --- a/core/2d/CCFontCharMap.cpp +++ b/core/2d/CCFontCharMap.cpp @@ -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(); diff --git a/core/2d/CCFontFNT.cpp b/core/2d/CCFontFNT.cpp index 1555dabc2d..8473d118db 100644 --- a/core/2d/CCFontFNT.cpp +++ b/core/2d/CCFontFNT.cpp @@ -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* 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* 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* 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* 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 { diff --git a/core/2d/CCFontFreeType.cpp b/core/2d/CCFontFreeType.cpp index 4645aae952..6edebfb04d 100644 --- a/core/2d/CCFontFreeType.cpp +++ b/core/2d/CCFontFreeType.cpp @@ -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(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}; diff --git a/core/2d/CCGrid.cpp b/core/2d/CCGrid.cpp index bd8d7cd270..52174efb6e 100644 --- a/core/2d/CCGrid.cpp +++ b/core/2d/CCGrid.cpp @@ -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; diff --git a/core/2d/CCLabel.cpp b/core/2d/CCLabel.cpp index f7d36f2387..3768bc4ef9 100644 --- a/core/2d/CCLabel.cpp +++ b/core/2d/CCLabel.cpp @@ -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 diff --git a/core/2d/CCLabelAtlas.cpp b/core/2d/CCLabelAtlas.cpp index 977ca04a0c..7fd4211d14 100644 --- a/core/2d/CCLabelAtlas.cpp +++ b/core/2d/CCLabelAtlas.cpp @@ -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(_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++) { diff --git a/core/2d/CCLabelTextFormatter.cpp b/core/2d/CCLabelTextFormatter.cpp index 25ad9c77d7..5652f741d2 100644 --- a/core/2d/CCLabelTextFormatter.cpp +++ b/core/2d/CCLabelTextFormatter.cpp @@ -212,7 +212,7 @@ bool Label::multilineTextWrap(const std::functionremoveChild(_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 diff --git a/core/2d/CCMenu.cpp b/core/2d/CCMenu.cpp index 5e53c882eb..06511422ff 100644 --- a/core/2d/CCMenu.cpp +++ b/core/2d/CCMenu.cpp @@ -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(child) != nullptr, "Menu only supports MenuItem objects as children"); + AXASSERT(dynamic_cast(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(child) != nullptr, "Menu only supports MenuItem objects as children"); + AXASSERT(dynamic_cast(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(child) != nullptr, "Menu only supports MenuItem objects as children"); + AXASSERT(dynamic_cast(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(); diff --git a/core/2d/CCMenuItem.cpp b/core/2d/CCMenuItem.cpp index f94e27e3c2..51fe37f93e 100644 --- a/core/2d/CCMenuItem.cpp +++ b/core/2d/CCMenuItem.cpp @@ -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; diff --git a/core/2d/CCMotionStreak.cpp b/core/2d/CCMotionStreak.cpp index 8f5b0b4b1b..8ef758dbf8 100644 --- a/core/2d/CCMotionStreak.cpp +++ b/core/2d/CCMotionStreak.cpp @@ -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; } diff --git a/core/2d/CCNode.cpp b/core/2d/CCNode.cpp index e93b167d5a..e52045abd3 100644 --- a/core/2d/CCNode.cpp +++ b/core/2d/CCNode.cpp @@ -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 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 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); } diff --git a/core/2d/CCParallaxNode.cpp b/core/2d/CCParallaxNode.cpp index a03edf9153..cdf2d973e5 100644 --- a/core/2d/CCParallaxNode.cpp +++ b/core/2d/CCParallaxNode.cpp @@ -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); diff --git a/core/2d/CCParticleBatchNode.cpp b/core/2d/CCParticleBatchNode.cpp index 1c9129bfc5..7791579382 100644 --- a/core/2d/CCParticleBatchNode.cpp +++ b/core/2d/CCParticleBatchNode.cpp @@ -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(aChild) != nullptr, + AXASSERT(aChild != nullptr, "Argument must be non-nullptr"); + AXASSERT(dynamic_cast(aChild) != nullptr, "CCParticleBatchNode only supports QuadParticleSystems as children"); ParticleSystem* child = static_cast(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(aChild) != nullptr, + AXASSERT(aChild != nullptr, "Argument must be non-nullptr"); + AXASSERT(dynamic_cast(aChild) != nullptr, "CCParticleBatchNode only supports QuadParticleSystems as children"); ParticleSystem* child = static_cast(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(aChild) != nullptr, + AXASSERT(aChild != nullptr, "Child must be non-nullptr"); + AXASSERT(dynamic_cast(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(aChild); @@ -411,9 +411,9 @@ void ParticleBatchNode::removeChild(Node* aChild, bool cleanup) if (aChild == nullptr) return; - CCASSERT(dynamic_cast(aChild) != nullptr, + AXASSERT(dynamic_cast(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(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"); } } diff --git a/core/2d/CCParticleSystem.cpp b/core/2d/CCParticleSystem.cpp index 5a540076d6..404892db51 100644 --- a/core/2d/CCParticleSystem.cpp +++ b/core/2d/CCParticleSystem.cpp @@ -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 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); } diff --git a/core/2d/CCParticleSystemQuad.cpp b/core/2d/CCParticleSystemQuad.cpp index dfff526ed0..19fc4469d3 100644 --- a/core/2d/CCParticleSystemQuad.cpp +++ b/core/2d/CCParticleSystemQuad.cpp @@ -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); diff --git a/core/2d/CCPlistSpriteSheetLoader.cpp b/core/2d/CCPlistSpriteSheetLoader.cpp index b7415db851..a3c848e7c8 100644 --- a/core/2d/CCPlistSpriteSheetLoader.cpp +++ b/core/2d/CCPlistSpriteSheetLoader.cpp @@ -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 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(); @@ -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()); } } diff --git a/core/2d/CCProtectedNode.cpp b/core/2d/CCProtectedNode.cpp index ab18a6cfa0..c0a97b63e3 100644 --- a/core/2d/CCProtectedNode.cpp +++ b/core/2d/CCProtectedNode.cpp @@ -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); diff --git a/core/2d/CCRenderTexture.cpp b/core/2d/CCRenderTexture.cpp index 14da71e21b..df1f2b15bd 100644 --- a/core/2d/CCRenderTexture.cpp +++ b/core/2d/CCRenderTexture.cpp @@ -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)> 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)) { diff --git a/core/2d/CCSprite.cpp b/core/2d/CCSprite.cpp index 89ec39279e..48f222eafd 100644 --- a/core/2d/CCSprite.cpp +++ b/core/2d/CCSprite.cpp @@ -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(texture), "setTexture expects a Texture2D. Invalid argument"); + AXASSERT(!texture || dynamic_cast(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(_parent), "Logic error in Sprite. Parent must be a Sprite"); + AXASSERT(dynamic_cast(_parent), "Logic error in Sprite. Parent must be a Sprite"); const Mat4& nodeToParent = getNodeToParentTransform(); Mat4& parentTransform = static_cast(_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(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(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 diff --git a/core/2d/CCSpriteBatchNode.cpp b/core/2d/CCSpriteBatchNode.cpp index d0d6e43ae1..ef670a2eb6 100644 --- a/core/2d/CCSpriteBatchNode.cpp +++ b/core/2d/CCSpriteBatchNode.cpp @@ -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(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); + AXASSERT(child != nullptr, "child should not be null"); + AXASSERT(dynamic_cast(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); Sprite* sprite = static_cast(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(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); + AXASSERT(child != nullptr, "child should not be null"); + AXASSERT(dynamic_cast(child) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); Sprite* sprite = static_cast(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(_textureAtlas->getCapacity()), static_cast(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(child) != nullptr, + AXASSERT(dynamic_cast(child) != nullptr, "You can only add Sprites (or subclass of Sprite) to SpriteBatchNode"); appendChild(static_cast(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), "CCSpriteBatchNode only supports Sprites as children"); + AXASSERT(sprite != nullptr, "Argument must be non-nullptr"); + AXASSERT(dynamic_cast(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) != nullptr, "CCSpriteBatchNode only supports Sprites as children"); + AXASSERT(sprite != nullptr, "Argument must be non-nil"); + AXASSERT(dynamic_cast(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(child), "CCSpriteBatchNode only supports Sprites as children"); + AXASSERT(child != nullptr, "Argument must be non-nullptr"); + AXASSERT(dynamic_cast(child), "CCSpriteBatchNode only supports Sprites as children"); // quad index is Z child->setAtlasIndex(z); diff --git a/core/2d/CCSpriteFrame.cpp b/core/2d/CCSpriteFrame.cpp index c162563da3..680fce797f 100644 --- a/core/2d/CCSpriteFrame.cpp +++ b/core/2d/CCSpriteFrame.cpp @@ -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); } diff --git a/core/2d/CCSpriteFrameCache.cpp b/core/2d/CCSpriteFrameCache.cpp index dfe4fcbeae..ab80c61c24 100644 --- a/core/2d/CCSpriteFrameCache.cpp +++ b/core/2d/CCSpriteFrameCache.cpp @@ -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(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()) diff --git a/core/2d/CCTMXObjectGroup.cpp b/core/2d/CCTMXObjectGroup.cpp index 3f1e99cf6b..978da8a880 100644 --- a/core/2d/CCTMXObjectGroup.cpp +++ b/core/2d/CCTMXObjectGroup.cpp @@ -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 diff --git a/core/2d/CCTMXXMLParser.cpp b/core/2d/CCTMXXMLParser.cpp index 9a4bc34f15..aae7df86a6 100644 --- a/core/2d/CCTMXXMLParser.cpp +++ b/core/2d/CCTMXXMLParser.cpp @@ -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; } diff --git a/core/2d/CCTileMapAtlas.cpp b/core/2d/CCTileMapAtlas.cpp index 5b658d9b60..cbff475df4 100644 --- a/core/2d/CCTileMapAtlas.cpp +++ b/core/2d/CCTileMapAtlas.cpp @@ -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; diff --git a/core/2d/CCTransition.cpp b/core/2d/CCTransition.cpp index b466102185..53d88f27e6 100644 --- a/core/2d/CCTransition.cpp +++ b/core/2d/CCTransition.cpp @@ -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(); diff --git a/core/2d/CCTransitionProgress.cpp b/core/2d/CCTransitionProgress.cpp index 4d22024edb..ed67207f0d 100644 --- a/core/2d/CCTransitionProgress.cpp +++ b/core/2d/CCTransitionProgress.cpp @@ -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; } diff --git a/core/3d/CC3DProgramInfo.cpp b/core/3d/CC3DProgramInfo.cpp index 6dd455893d..09a11be901 100644 --- a/core/3d/CC3DProgramInfo.cpp +++ b/core/3d/CC3DProgramInfo.cpp @@ -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(key); - CCASSERT(idx >= 0 && idx < max, "invalid key "); + AXASSERT(idx >= 0 && idx < max, "invalid key "); return s_attributeNames[idx]; } }; // namespace shaderinfos diff --git a/core/3d/CCAnimate3D.cpp b/core/3d/CCAnimate3D.cpp index ea1d6761e0..12d3a269dc 100644 --- a/core/3d/CCAnimate3D.cpp +++ b/core/3d/CCAnimate3D.cpp @@ -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); } diff --git a/core/3d/CCBillBoard.cpp b/core/3d/CCBillBoard.cpp index 925cfb34bd..de8828c31d 100644 --- a/core/3d/CCBillBoard.cpp +++ b/core/3d/CCBillBoard.cpp @@ -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; diff --git a/core/3d/CCBundle3D.cpp b/core/3d/CCBundle3D.cpp index 0bdb3e875b..ab24f34ef2 100644 --- a/core/3d/CCBundle3D.cpp +++ b/core/3d/CCBundle3D.cpp @@ -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; diff --git a/core/3d/CCBundle3DData.cpp b/core/3d/CCBundle3DData.cpp index e181389e1e..6fdc93ff7d 100644 --- a/core/3d/CCBundle3DData.cpp +++ b/core/3d/CCBundle3DData.cpp @@ -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; } diff --git a/core/3d/CCBundleReader.cpp b/core/3d/CCBundleReader.cpp index 066b55f7e3..8d5d9c2a1e 100644 --- a/core/3d/CCBundleReader.cpp +++ b/core/3d/CCBundleReader.cpp @@ -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 { diff --git a/core/3d/CCBundleReader.h b/core/3d/CCBundleReader.h index 57159c766d..cc3e458614 100644 --- a/core/3d/CCBundleReader.h +++ b/core/3d/CCBundleReader.h @@ -188,7 +188,7 @@ inline bool BundleReader::read(char* ptr) template <> inline bool BundleReader::read(std::string* /*ptr*/) { - CCLOG("can not read std::string, use readString() instead"); + AXLOG("can not read std::string, use readString() instead"); return false; } diff --git a/core/3d/CCMesh.cpp b/core/3d/CCMesh.cpp index 1090ae62cb..7750752e5b 100644 --- a/core/3d/CCMesh.cpp +++ b/core/3d/CCMesh.cpp @@ -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(); diff --git a/core/3d/CCMeshMaterial.cpp b/core/3d/CCMeshMaterial.cpp index 4ccf6ba504..ad6b174d60 100644 --- a/core/3d/CCMeshMaterial.cpp +++ b/core/3d/CCMeshMaterial.cpp @@ -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); diff --git a/core/3d/CCMeshRenderer.cpp b/core/3d/CCMeshRenderer.cpp index 297cfef339..84fbf5ef8d 100644 --- a/core/3d/CCMeshRenderer.cpp +++ b/core/3d/CCMeshRenderer.cpp @@ -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); } diff --git a/core/3d/CCMeshSkin.cpp b/core/3d/CCMeshSkin.cpp index df25bc23a6..3fb45fefd3 100644 --- a/core/3d/CCMeshSkin.cpp +++ b/core/3d/CCMeshSkin.cpp @@ -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); diff --git a/core/3d/CCMotionStreak3D.cpp b/core/3d/CCMotionStreak3D.cpp index 964d680f9f..1c11e6cd53 100644 --- a/core/3d/CCMotionStreak3D.cpp +++ b/core/3d/CCMotionStreak3D.cpp @@ -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; } diff --git a/core/3d/CCOBB.cpp b/core/3d/CCOBB.cpp index 63dcc7fc9d..106abab202 100644 --- a/core/3d/CCOBB.cpp +++ b/core/3d/CCOBB.cpp @@ -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; diff --git a/core/3d/CCSkybox.cpp b/core/3d/CCSkybox.cpp index 07926f50eb..842d0a237f 100644 --- a/core/3d/CCSkybox.cpp +++ b/core/3d/CCSkybox.cpp @@ -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; diff --git a/core/3d/CCTerrain.cpp b/core/3d/CCTerrain.cpp index c72375ee7f..4106bac62a 100644 --- a/core/3d/CCTerrain.cpp +++ b/core/3d/CCTerrain.cpp @@ -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; diff --git a/core/3d/CCVertexAttribBinding.cpp b/core/3d/CCVertexAttribBinding.cpp index 9db0148f41..664a0037e4 100644 --- a/core/3d/CCVertexAttribBinding.cpp +++ b/core/3d/CCVertexAttribBinding.cpp @@ -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()); } } diff --git a/core/audio/AudioMacros.h b/core/audio/AudioMacros.h index 2498535b15..4a182f5ef4 100644 --- a/core/audio/AudioMacros.h +++ b/core/audio/AudioMacros.h @@ -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 \ { \ diff --git a/core/base/CCAutoreleasePool.cpp b/core/base/CCAutoreleasePool.cpp index d288326b3d..62595abc4e 100644 --- a/core/base/CCAutoreleasePool.cpp +++ b/core/base/CCAutoreleasePool.cpp @@ -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 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(_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()) { diff --git a/core/base/CCAutoreleasePool.h b/core/base/CCAutoreleasePool.h index 1e310b1d70..d1b308729e 100644 --- a/core/base/CCAutoreleasePool.h +++ b/core/base/CCAutoreleasePool.h @@ -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 _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. */ diff --git a/core/base/CCConfiguration.cpp b/core/base/CCConfiguration.cpp index 6876585dfe..dad5d69a12 100644 --- a/core/base/CCConfiguration.cpp +++ b/core/base/CCConfiguration.cpp @@ -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 diff --git a/core/base/CCConsole.cpp b/core/base/CCConsole.cpp index cee6f9a13e..996603cd6a 100644 --- a/core/base/CCConsole.cpp +++ b/core/base/CCConsole.cpp @@ -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()) diff --git a/core/base/CCController-android.cpp b/core/base/CCController-android.cpp index 306895de6d..6c7f72ce83 100644 --- a/core/base/CCController-android.cpp +++ b/core/base/CCController-android.cpp @@ -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); } diff --git a/core/base/CCController-linux-win32.cpp b/core/base/CCController-linux-win32.cpp index 1bf9f42bfe..ef47c412b5 100644 --- a/core/base/CCController-linux-win32.cpp +++ b/core/base/CCController-linux-win32.cpp @@ -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 } diff --git a/core/base/CCData.cpp b/core/base/CCData.cpp index 2e369c184a..497689eadc 100644 --- a/core/base/CCData.cpp +++ b/core/base/CCData.cpp @@ -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; } diff --git a/core/base/CCDirector.cpp b/core/base/CCDirector.cpp index 0ead658042..cc507ce8ed 100644 --- a/core/base/CCDirector.cpp +++ b/core/base/CCDirector.cpp @@ -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; } diff --git a/core/base/CCEventDispatcher.cpp b/core/base/CCEventDispatcher.cpp index a3aeb7f85d..4a5de99334 100644 --- a/core/base/CCEventDispatcher.cpp +++ b/core/base/CCEventDispatcher.cpp @@ -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(fixedPriorityListeners->size()), + AXASSERT(listeners->getGt0Index() <= static_cast(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(fixedPriorityListeners->size()), + AXASSERT(listeners->getGt0Index() <= static_cast(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!"); } } diff --git a/core/base/CCEventDispatcher.h b/core/base/CCEventDispatcher.h index 4a36dc636a..3d61943f6c 100644 --- a/core/base/CCEventDispatcher.h +++ b/core/base/CCEventDispatcher.h @@ -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. diff --git a/core/base/CCEventListener.cpp b/core/base/CCEventListener.cpp index 8a35be5ac2..3cfbdaa7a8 100644 --- a/core/base/CCEventListener.cpp +++ b/core/base/CCEventListener.cpp @@ -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& callback) diff --git a/core/base/CCEventListenerAcceleration.cpp b/core/base/CCEventListenerAcceleration.cpp index 2e2ee39de2..5dae00c4b8 100644 --- a/core/base/CCEventListenerAcceleration.cpp +++ b/core/base/CCEventListenerAcceleration.cpp @@ -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& 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; } diff --git a/core/base/CCEventListenerController.cpp b/core/base/CCEventListenerController.cpp index 380b011f33..3eba65bf50 100644 --- a/core/base/CCEventListenerController.cpp +++ b/core/base/CCEventListenerController.cpp @@ -93,7 +93,7 @@ bool EventListenerController::init() } break; default: - CCASSERT(false, "Invalid EventController type"); + AXASSERT(false, "Invalid EventController type"); break; } }; diff --git a/core/base/CCEventListenerFocus.cpp b/core/base/CCEventListenerFocus.cpp index ba56eed15b..34604a0186 100644 --- a/core/base/CCEventListenerFocus.cpp +++ b/core/base/CCEventListenerFocus.cpp @@ -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; } diff --git a/core/base/CCEventListenerKeyboard.cpp b/core/base/CCEventListenerKeyboard.cpp index a19d338b7c..057a378cf7 100644 --- a/core/base/CCEventListenerKeyboard.cpp +++ b/core/base/CCEventListenerKeyboard.cpp @@ -35,7 +35,7 @@ bool EventListenerKeyboard::checkAvailable() { if (onKeyPressed == nullptr && onKeyReleased == nullptr) { - CCASSERT(false, "Invalid EventListenerKeyboard!"); + AXASSERT(false, "Invalid EventListenerKeyboard!"); return false; } diff --git a/core/base/CCEventListenerTouch.cpp b/core/base/CCEventListenerTouch.cpp index 6140914cfc..27b71f75fd 100644 --- a/core/base/CCEventListenerTouch.cpp +++ b/core/base/CCEventListenerTouch.cpp @@ -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; } diff --git a/core/base/CCMap.h b/core/base/CCMap.h index 2366ed8ac5..690d6c45a1 100644 --- a/core/base/CCMap.h +++ b/core/base/CCMap.h @@ -90,14 +90,14 @@ public: Map() : _data() { static_assert(std::is_convertible::value, "Invalid Type for axis::Map!"); - 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::value, "Invalid Type for axis::Map!"); - 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::value, "Invalid Type for axis::Map!"); - 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::value, "Invalid Type for axis::Map!"); - 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 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); } diff --git a/core/base/CCNinePatchImageParser.cpp b/core/base/CCNinePatchImageParser.cpp index 3d765e4e39..acdb538b19 100644 --- a/core/base/CCNinePatchImageParser.cpp +++ b/core/base/CCNinePatchImageParser.cpp @@ -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; diff --git a/core/base/CCProfiling.cpp b/core/base/CCProfiling.cpp index 75dcce055e..6e43641922 100644 --- a/core/base/CCProfiling.cpp +++ b/core/base/CCProfiling.cpp @@ -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(chrono::duration_cast(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(); } diff --git a/core/base/CCProperties.cpp b/core/base/CCProperties.cpp index dbaacfcb88..5dfa96edd5 100644 --- a/core/base/CCProperties.cpp +++ b/core/base/CCProperties.cpp @@ -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); } } diff --git a/core/base/CCRef.cpp b/core/base/CCRef.cpp index 9b01d0123a..9a0a66e842 100644 --- a/core/base/CCRef.cpp +++ b/core/base/CCRef.cpp @@ -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 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); diff --git a/core/base/CCRefPtr.h b/core/base/CCRefPtr.h index 4b78ee6637..89ba5449ff 100644 --- a/core/base/CCRefPtr.h +++ b/core/base/CCRefPtr.h @@ -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; } diff --git a/core/base/CCScheduler.cpp b/core/base/CCScheduler.cpp index 8f79c23985..9ae3d570c4 100644 --- a/core/base/CCScheduler.cpp +++ b/core/base/CCScheduler.cpp @@ -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); diff --git a/core/base/CCValue.cpp b/core/base/CCValue.cpp index bb582c6816..3326394444 100644 --- a/core/base/CCValue.cpp +++ b/core/base/CCValue.cpp @@ -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; } diff --git a/core/base/CCVector.h b/core/base/CCVector.h index 6dc3028e3d..4902db18aa 100644 --- a/core/base/CCVector.h +++ b/core/base/CCVector.h @@ -120,7 +120,7 @@ public: explicit Vector(ssize_t capacity) : _data() { static_assert(std::is_convertible::value, "Invalid Type for axis::Vector!"); - 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() { - CCLOGINFO("In the destructor of Vector."); + AXLOGINFO("In the destructor of Vector."); clear(); } @@ -144,7 +144,7 @@ public: Vector(const Vector& other) { static_assert(std::is_convertible::value, "Invalid Type for axis::Vector!"); - CCLOGINFO("In the copy constructor!"); + AXLOGINFO("In the copy constructor!"); _data = other._data; addRefForAllObjects(); } @@ -153,7 +153,7 @@ public: Vector(Vector&& other) { static_assert(std::is_convertible::value, "Invalid Type for axis::Vector!"); - 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; diff --git a/core/base/ZipUtils.cpp b/core/base/ZipUtils.cpp index d460530fbf..46a9daafd8 100644 --- a/core/base/ZipUtils.cpp +++ b/core/base/ZipUtils.cpp @@ -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(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(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(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); diff --git a/core/base/ccCArray.cpp b/core/base/ccCArray.cpp index e8668c2177..2e6cca335e 100644 --- a/core/base/ccCArray.cpp +++ b/core/base/ccCArray.cpp @@ -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 diff --git a/core/base/ccMacros.h b/core/base/ccMacros.h index 544d28ea50..016e2b3248 100644 --- a/core/base/ccMacros.h +++ b/core/base/ccMacros.h @@ -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 diff --git a/core/base/ccUTF8.cpp b/core/base/ccUTF8.cpp index 8a9a4fd1a8..793f06b247 100644 --- a/core/base/ccUTF8.cpp +++ b/core/base/ccUTF8.cpp @@ -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; } diff --git a/core/base/ccUtils.cpp b/core/base/ccUtils.cpp index d5ec1e2273..cecc77290b 100644 --- a/core/base/ccUtils.cpp +++ b/core/base/ccUtils.cpp @@ -82,7 +82,7 @@ void captureScreen(std::function)> 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)> 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 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(i)); cStr = endptr; diff --git a/core/math/Mat4.cpp b/core/math/Mat4.cpp index 0ab9228c2b..096794a2bb 100644 --- a/core/math/Mat4.cpp +++ b/core/math/Mat4.cpp @@ -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; } diff --git a/core/math/Rect.cpp b/core/math/Rect.cpp index 5d19e82c0e..fe78673ca5 100644 --- a/core/math/Rect.cpp +++ b/core/math/Rect.cpp @@ -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; diff --git a/core/network/HttpClient.cpp b/core/network/HttpClient.cpp index 18a15688bb..c8d0f3d6db 100644 --- a/core/network/HttpClient.cpp +++ b/core/network/HttpClient.cpp @@ -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(); diff --git a/core/network/HttpRequest.h b/core/network/HttpRequest.h index 77cfc7eb18..31935e8d1e 100644 --- a/core/network/HttpRequest.h +++ b/core/network/HttpRequest.h @@ -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; diff --git a/core/network/HttpResponse.h b/core/network/HttpResponse.h index f3c185ea02..1013a0cf94 100644 --- a/core/network/HttpResponse.h +++ b/core/network/HttpResponse.h @@ -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; diff --git a/core/network/Uri.cpp b/core/network/Uri.cpp index 4513751ac2..bc8661a5e4 100644 --- a/core/network/Uri.cpp +++ b/core/network/Uri.cpp @@ -19,7 +19,7 @@ */ #include "network/Uri.h" -#include "base/CCConsole.h" // For CCLOGERROR macro +#include "base/CCConsole.h" // For AXLOGERROR macro #include #include @@ -169,7 +169,7 @@ bool Uri::doParse(std::string_view str) if (str.empty()) { - CCLOGERROR("%s", "Empty URI is invalid!"); + AXLOGERROR("%s", "Empty URI is invalid!"); return false; } @@ -185,7 +185,7 @@ bool Uri::doParse(std::string_view str) std::smatch match; if (UNLIKELY(!std::regex_match(copied.cbegin(), copied.cend(), match, uriRegex))) { - CCLOGERROR("Invalid URI: %s", str.data()); + AXLOGERROR("Invalid URI: %s", str.data()); return false; } @@ -211,7 +211,7 @@ bool Uri::doParse(std::string_view str) if (!std::regex_match(authority.first, authority.second, authorityMatch, authorityRegex)) { std::string invalidAuthority(authority.first, authority.second); - CCLOGERROR("Invalid URI authority: %s", invalidAuthority.c_str()); + AXLOGERROR("Invalid URI authority: %s", invalidAuthority.c_str()); return false; } diff --git a/core/physics/CCPhysicsBody.cpp b/core/physics/CCPhysicsBody.cpp index b7ceaa6f32..0a5de00c8c 100644 --- a/core/physics/CCPhysicsBody.cpp +++ b/core/physics/CCPhysicsBody.cpp @@ -601,7 +601,7 @@ void PhysicsBody::setVelocity(const Vec2& velocity) { if (cpBodyGetType(_cpBody) == CP_BODY_TYPE_STATIC) { - CCLOG("physics warning: you can't set velocity for a static body."); + AXLOG("physics warning: you can't set velocity for a static body."); return; } @@ -627,7 +627,7 @@ void PhysicsBody::setAngularVelocity(float velocity) { if (cpBodyGetType(_cpBody) == CP_BODY_TYPE_STATIC) { - CCLOG("physics warning: you can't set angular velocity for a static body."); + AXLOG("physics warning: you can't set angular velocity for a static body."); return; } @@ -982,7 +982,7 @@ void PhysicsBody::onAdd() void PhysicsBody::onRemove() { - CCASSERT(_owner != nullptr, "_owner can't be nullptr"); + AXASSERT(_owner != nullptr, "_owner can't be nullptr"); removeFromPhysicsWorld(); diff --git a/core/physics/CCPhysicsContact.cpp b/core/physics/CCPhysicsContact.cpp index 2eb2f9b5fc..a83a1c2caf 100644 --- a/core/physics/CCPhysicsContact.cpp +++ b/core/physics/CCPhysicsContact.cpp @@ -259,7 +259,7 @@ bool EventListenerPhysicsContact::checkAvailable() if (onContactBegin == nullptr && onContactPreSolve == nullptr && onContactPostSolve == nullptr && onContactSeparate == nullptr) { - CCASSERT(false, "Invalid PhysicsContactListener."); + AXASSERT(false, "Invalid PhysicsContactListener."); return false; } diff --git a/core/physics/CCPhysicsJoint.cpp b/core/physics/CCPhysicsJoint.cpp index 9dd3efbb63..1027880ff1 100644 --- a/core/physics/CCPhysicsJoint.cpp +++ b/core/physics/CCPhysicsJoint.cpp @@ -49,7 +49,7 @@ public: T get() const { - CCASSERT(_isSet, "data should be set!"); + AXASSERT(_isSet, "data should be set!"); return _data; } void set(T d) @@ -149,8 +149,8 @@ bool PhysicsJoint::init(axis::PhysicsBody* a, axis::PhysicsBody* b) { do { - CCASSERT(a != nullptr && b != nullptr, "the body passed in is nil"); - CCASSERT(a != b, "the two bodies are equal"); + AXASSERT(a != nullptr && b != nullptr, "the body passed in is nil"); + AXASSERT(a != b, "the two bodies are equal"); _bodyA = a; _bodyB = b; diff --git a/core/physics/CCPhysicsShape.cpp b/core/physics/CCPhysicsShape.cpp index 79f4039abe..77dab22b80 100644 --- a/core/physics/CCPhysicsShape.cpp +++ b/core/physics/CCPhysicsShape.cpp @@ -117,7 +117,7 @@ void PhysicsShape::setScale(float scaleX, float scaleY) { if (_type == Type::CIRCLE && scaleX != scaleY) { - CCLOG("PhysicsShapeCircle WARNING: CANNOT support setScale with different x and y"); + AXLOG("PhysicsShapeCircle WARNING: CANNOT support setScale with different x and y"); return; } _newScaleX = scaleX; diff --git a/core/physics/CCPhysicsWorld.cpp b/core/physics/CCPhysicsWorld.cpp index db59f92dfe..f1793f3133 100644 --- a/core/physics/CCPhysicsWorld.cpp +++ b/core/physics/CCPhysicsWorld.cpp @@ -445,7 +445,7 @@ void PhysicsWorld::collisionSeparateCallback(PhysicsContact& contact) void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, const Vec2& point2, void* data) { - CCASSERT(func != nullptr, "func shouldn't be nullptr"); + AXASSERT(func != nullptr, "func shouldn't be nullptr"); if (func != nullptr) { @@ -464,7 +464,7 @@ void PhysicsWorld::rayCast(PhysicsRayCastCallbackFunc func, const Vec2& point1, void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect, void* data) { - CCASSERT(func != nullptr, "func shouldn't be nullptr"); + AXASSERT(func != nullptr, "func shouldn't be nullptr"); if (func != nullptr) { @@ -482,7 +482,7 @@ void PhysicsWorld::queryRect(PhysicsQueryRectCallbackFunc func, const Rect& rect void PhysicsWorld::queryPoint(PhysicsQueryPointCallbackFunc func, const Vec2& point, void* data) { - CCASSERT(func != nullptr, "func shouldn't be nullptr"); + AXASSERT(func != nullptr, "func shouldn't be nullptr"); if (func != nullptr) { @@ -543,7 +543,7 @@ bool PhysicsWorld::init() void PhysicsWorld::addBody(PhysicsBody* body) { - CCASSERT(body != nullptr, "the body can not be nullptr"); + AXASSERT(body != nullptr, "the body can not be nullptr"); if (body->getWorld() == this) { @@ -633,7 +633,7 @@ void PhysicsWorld::removeBody(PhysicsBody* body) { if (body->getWorld() != this) { - CCLOG("Physics Warning: this body doesn't belong to this world"); + AXLOG("Physics Warning: this body doesn't belong to this world"); return; } @@ -677,7 +677,7 @@ void PhysicsWorld::removeJoint(PhysicsJoint* joint, bool destroy) { if (joint->getWorld() != this && destroy) { - CCLOG( + AXLOG( "physics warning: the joint is not in this world, it won't be destroyed until the body it connects is " "destroyed"); return; @@ -760,7 +760,7 @@ void PhysicsWorld::addJoint(PhysicsJoint* joint) { if (joint) { - CCASSERT(joint->getWorld() == nullptr, "Can not add joint already add to other world!"); + AXASSERT(joint->getWorld() == nullptr, "Can not add joint already add to other world!"); joint->_world = this; auto it = std::find(_delayRemoveJoints.begin(), _delayRemoveJoints.end(), joint); @@ -799,7 +799,7 @@ void PhysicsWorld::addShape(PhysicsShape* physicsShape) void PhysicsWorld::doRemoveBody(PhysicsBody* body) { - CCASSERT(body != nullptr, "the body can not be nullptr"); + AXASSERT(body != nullptr, "the body can not be nullptr"); // remove shapes for (auto& shape : body->getShapes()) @@ -901,7 +901,7 @@ void PhysicsWorld::step(float delta) { if (_autoStep) { - CCLOG("Physics Warning: You need to close auto step( setAutoStep(false) ) first"); + AXLOG("Physics Warning: You need to close auto step( setAutoStep(false) ) first"); } else { diff --git a/core/physics3d/CCPhysics3DDebugDrawer.cpp b/core/physics3d/CCPhysics3DDebugDrawer.cpp index 926e1c27aa..1cebeeff3f 100644 --- a/core/physics3d/CCPhysics3DDebugDrawer.cpp +++ b/core/physics3d/CCPhysics3DDebugDrawer.cpp @@ -67,7 +67,7 @@ void Physics3DDebugDrawer::drawContactPoint(const btVector3& PointOnB, void Physics3DDebugDrawer::reportErrorWarning(const char* warningString) { - CCLOG("%s", warningString); + AXLOG("%s", warningString); } void Physics3DDebugDrawer::draw3dText(const btVector3& /*location*/, const char* /*textString*/) {} diff --git a/core/physics3d/CCPhysics3DObject.cpp b/core/physics3d/CCPhysics3DObject.cpp index 81ae7c3214..1843a70637 100644 --- a/core/physics3d/CCPhysics3DObject.cpp +++ b/core/physics3d/CCPhysics3DObject.cpp @@ -326,13 +326,13 @@ void Physics3DRigidBody::removeConstraint(Physics3DConstraint* constraint) void Physics3DRigidBody::removeConstraint(unsigned int idx) { - CCASSERT(idx < _constraintList.size(), "idx < _constraintList.size()"); + AXASSERT(idx < _constraintList.size(), "idx < _constraintList.size()"); removeConstraint(_constraintList[idx]); } Physics3DConstraint* Physics3DRigidBody::getConstraint(unsigned int idx) const { - CCASSERT(idx < _constraintList.size(), "idx < _constraintList.size()"); + AXASSERT(idx < _constraintList.size(), "idx < _constraintList.size()"); return _constraintList[idx]; } diff --git a/core/platform/CCFileUtils.cpp b/core/platform/CCFileUtils.cpp index 813918be96..8e927f59c2 100644 --- a/core/platform/CCFileUtils.cpp +++ b/core/platform/CCFileUtils.cpp @@ -117,7 +117,7 @@ public: _resultType = SAX_RESULT_DICT; SAXParser parser; - CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); + AXASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(fileName); @@ -129,7 +129,7 @@ public: _resultType = SAX_RESULT_DICT; SAXParser parser; - CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); + AXASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(filedata, filesize); @@ -141,7 +141,7 @@ public: _resultType = SAX_RESULT_ARRAY; SAXParser parser; - CCASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); + AXASSERT(parser.init("UTF-8"), "The file format isn't UTF-8"); parser.setDelegator(this); parser.parse(fileName); @@ -175,7 +175,7 @@ public: else if (SAX_DICT == preState) { // add a new dictionary into the pre dictionary - CCASSERT(!_dictStack.empty(), "The state is wrong!"); + AXASSERT(!_dictStack.empty(), "The state is wrong!"); ValueMap* preDict = _dictStack.top(); auto& curVal = hlookup::set_item(*preDict, _curKey, Value(ValueMap()))->second; _curDict = &curVal.asValueMap(); @@ -222,7 +222,7 @@ public: } else if (preState == SAX_ARRAY) { - CCASSERT(!_arrayStack.empty(), "The state is wrong!"); + AXASSERT(!_arrayStack.empty(), "The state is wrong!"); ValueVector* preArray = _arrayStack.top(); preArray->push_back(Value(ValueVector())); _curArray = &(_curArray->rbegin())->asValueVector(); @@ -329,7 +329,7 @@ public: { if (curState == SAX_DICT) { - CCASSERT(!_curKey.empty(), "key not found : "); + AXASSERT(!_curKey.empty(), "key not found : "); } _curValue.append(text); @@ -512,7 +512,7 @@ void FileUtils::writeDataToFile(Data data, std::string_view fullPath, std::funct bool FileUtils::writeBinaryToFile(const void* data, size_t dataSize, std::string_view fullPath) { - CCASSERT(!fullPath.empty() && dataSize > 0, "Invalid parameters."); + AXASSERT(!fullPath.empty() && dataSize > 0, "Invalid parameters."); auto* fileUtils = FileUtils::getInstance(); do @@ -711,7 +711,7 @@ std::string FileUtils::fullPathForFilename(std::string_view filename) const if (isPopupNotify()) { - CCLOG("cocos2d: fullPathForFilename: No file found at %s. Possible missing file.", filename.data()); + AXLOG("cocos2d: fullPathForFilename: No file found at %s. Possible missing file.", filename.data()); } // The file wasn't found, return empty string. @@ -762,7 +762,7 @@ std::string FileUtils::fullPathForDirectory(std::string_view dir) const if (isPopupNotify()) { - CCLOG("cocos2d: fullPathForDirectory: No directory found at %s. Possible missing directory.", dir.data()); + AXLOG("cocos2d: fullPathForDirectory: No directory found at %s. Possible missing directory.", dir.data()); } // The file wasn't found, return empty string. @@ -910,7 +910,7 @@ void FileUtils::setSearchPaths(const std::vector& searchPaths) if (!existDefaultRootPath) { - // CCLOG("Default root path doesn't exist, adding it."); + // AXLOG("Default root path doesn't exist, adding it."); _searchPathArray.push_back(_defaultResRootPath); } } @@ -1002,7 +1002,7 @@ bool FileUtils::isAbsolutePathInternal(std::string_view path) bool FileUtils::isDirectoryExist(std::string_view dirPath) const { - CCASSERT(!dirPath.empty(), "Invalid path"); + AXASSERT(!dirPath.empty(), "Invalid path"); DECLARE_GUARD; @@ -1019,7 +1019,7 @@ bool FileUtils::isDirectoryExist(std::string_view dirPath) const void FileUtils::isDirectoryExist(std::string_view fullPath, std::function callback) const { - CCASSERT(isAbsolutePath(fullPath), "Async isDirectoryExist only accepts absolute file paths"); + AXASSERT(isAbsolutePath(fullPath), "Async isDirectoryExist only accepts absolute file paths"); performOperationOffthread( [path = std::string{fullPath}]() -> bool { return FileUtils::getInstance()->isDirectoryExist(path); }, std::move(callback)); @@ -1181,43 +1181,43 @@ void FileUtils::listFilesRecursively(std::string_view dirPath, std::vectorsetTouchInfo(unusedIndex, (x - _viewPortRect.origin.x) / _scaleX, (y - _viewPortRect.origin.y) / _scaleY); - CCLOGINFO("x = %f y = %f", touch->getLocationInView().x, touch->getLocationInView().y); + AXLOGINFO("x = %f y = %f", touch->getLocationInView().x, touch->getLocationInView().y); g_touchIdReorderMap.emplace(id, unusedIndex); touchEvent._touches.push_back(touch); @@ -330,7 +330,7 @@ void GLView::handleTouchesBegin(int num, intptr_t ids[], float xs[], float ys[]) if (touchEvent._touches.empty()) { - CCLOG("touchesBegan: size = 0"); + AXLOG("touchesBegan: size = 0"); return; } @@ -364,11 +364,11 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[], auto iter = g_touchIdReorderMap.find(id); if (iter == g_touchIdReorderMap.end()) { - CCLOG("if the index doesn't exist, it is an error"); + AXLOG("if the index doesn't exist, it is an error"); continue; } - CCLOGINFO("Moving touches with id: %d, x=%f, y=%f, force=%f, maxFource=%f", (int)id, x, y, force, maxForce); + AXLOGINFO("Moving touches with id: %d, x=%f, y=%f, force=%f, maxFource=%f", (int)id, x, y, force, maxForce); Touch* touch = g_touches[iter->second]; if (touch) { @@ -380,14 +380,14 @@ void GLView::handleTouchesMove(int num, intptr_t ids[], float xs[], float ys[], else { // It is error, should return. - CCLOG("Moving touches with id: %d error", static_cast(id)); + AXLOG("Moving touches with id: %d error", static_cast(id)); return; } } if (touchEvent._touches.empty()) { - CCLOG("touchesMoved: size = 0"); + AXLOG("touchesMoved: size = 0"); return; } @@ -416,7 +416,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, auto iter = g_touchIdReorderMap.find(id); if (iter == g_touchIdReorderMap.end()) { - CCLOG("if the index doesn't exist, it is an error"); + AXLOG("if the index doesn't exist, it is an error"); continue; } @@ -424,7 +424,7 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, Touch* touch = g_touches[iter->second]; if (touch) { - CCLOGINFO("Ending touches with id: %d, x=%f, y=%f", (int)id, x, y); + AXLOGINFO("Ending touches with id: %d, x=%f, y=%f", (int)id, x, y); touch->setTouchInfo(iter->second, (x - _viewPortRect.origin.x) / _scaleX, (y - _viewPortRect.origin.y) / _scaleY); @@ -437,14 +437,14 @@ void GLView::handleTouchesOfEndOrCancel(EventTouch::EventCode eventCode, } else { - CCLOG("Ending touches with id: %d error", static_cast(id)); + AXLOG("Ending touches with id: %d error", static_cast(id)); return; } } if (touchEvent._touches.empty()) { - CCLOG("touchesEnded or touchesCancel: size = 0"); + AXLOG("touchesEnded or touchesCancel: size = 0"); return; } @@ -491,8 +491,8 @@ float GLView::getScaleY() const void GLView::renderScene(Scene* scene, Renderer* renderer) { - CCASSERT(scene, "Invalid Scene"); - CCASSERT(renderer, "Invalid Renderer"); + AXASSERT(scene, "Invalid Scene"); + AXASSERT(renderer, "Invalid Renderer"); scene->render(renderer, Mat4::IDENTITY, nullptr); } diff --git a/core/platform/CCImage.cpp b/core/platform/CCImage.cpp index 208492a8a4..dc758aa2b8 100644 --- a/core/platform/CCImage.cpp +++ b/core/platform/CCImage.cpp @@ -693,7 +693,7 @@ bool Image::initWithImageData(uint8_t* data, ssize_t dataLen, bool ownData) } else { - CCLOG("cocos2d: unsupported image format!"); + AXLOG("cocos2d: unsupported image format!"); } free(tgaData); @@ -950,7 +950,7 @@ myErrorExit(j_common_ptr cinfo) //(*cinfo->err->output_message) (cinfo); char buffer[JMSG_LENGTH_MAX]; (*cinfo->err->format_message)(cinfo, buffer); - CCLOG("jpeg error: %s", buffer); + AXLOG("jpeg error: %s", buffer); /* Return control to the setjmp point */ longjmp(myerr->setjmp_buffer, 1); @@ -1047,7 +1047,7 @@ bool Image::initWithJpgData(uint8_t* data, ssize_t dataLen) return ret; #else - CCLOG("jpeg is not enabled, please enable it in ccConfig.h"); + AXLOG("jpeg is not enabled, please enable it in ccConfig.h"); return false; #endif // AX_USE_JPEG } @@ -1098,7 +1098,7 @@ bool Image::initWithPngData(uint8_t* data, ssize_t dataLen) png_byte bit_depth = png_get_bit_depth(png_ptr, info_ptr); png_uint_32 color_type = png_get_color_type(png_ptr, info_ptr); - // CCLOG("color type %u", color_type); + // AXLOG("color type %u", color_type); // force palette images to be expanded to 24-bit RGB // it may include alpha channel @@ -1204,7 +1204,7 @@ bool Image::initWithPngData(uint8_t* data, ssize_t dataLen) } return ret; #else - CCLOG("png is not enabled, please enable it in ccConfig.h"); + AXLOG("png is not enabled, please enable it in ccConfig.h"); return false; #endif // AX_USE_PNG } @@ -1265,7 +1265,7 @@ bool Image::initWithWebpData(uint8_t* data, ssize_t dataLen) } while (0); return ret; #else - CCLOG("webp is not enabled, please enable it in ccConfig.h"); + AXLOG("webp is not enabled, please enable it in ccConfig.h"); return false; #endif // AX_USE_WEBP } @@ -1297,7 +1297,7 @@ bool Image::initWithTGAData(tImageTGA* tgaData) } else { - CCLOG("Image WARNING: unsupported true color tga data pixel format. FILE: %s", _filePath.c_str()); + AXLOG("Image WARNING: unsupported true color tga data pixel format. FILE: %s", _filePath.c_str()); break; } } @@ -1311,7 +1311,7 @@ bool Image::initWithTGAData(tImageTGA* tgaData) else { // actually this won't happen, if it happens, maybe the image file is not a tga - CCLOG("Image WARNING: unsupported gray tga data pixel format. FILE: %s", _filePath.c_str()); + AXLOG("Image WARNING: unsupported gray tga data pixel format. FILE: %s", _filePath.c_str()); break; } } @@ -1330,7 +1330,7 @@ bool Image::initWithTGAData(tImageTGA* tgaData) { if (FileUtils::getInstance()->getFileExtension(_filePath) != ".tga") { - CCLOG("Image WARNING: the image file suffix is not tga, but parsed as a tga image file. FILE: %s", + AXLOG("Image WARNING: the image file suffix is not tga, but parsed as a tga image file. FILE: %s", _filePath.c_str()); } } @@ -1370,27 +1370,27 @@ bool Image::initWithPVRv2Data(uint8_t* data, ssize_t dataLen, bool ownData) bool flipped = (flags & (unsigned int)PVR2TextureFlag::VerticalFlip) ? true : false; if (flipped) { - CCLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool"); + AXLOG("cocos2d: WARNING: Image is flipped. Regenerate it using PVRTexTool"); } if (!configuration->supportsNPOT() && (static_cast(header->width) != ccNextPOT(header->width) || static_cast(header->height) != ccNextPOT(header->height))) { - CCLOG("cocos2d: ERROR: Loading an NPOT texture (%dx%d) but is not supported on this device", header->width, + AXLOG("cocos2d: ERROR: Loading an NPOT texture (%dx%d) but is not supported on this device", header->width, header->height); return false; } if (!testFormatForPvr2TCSupport(formatFlags)) { - CCLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", + AXLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } if (v2_pixel_formathash.find(formatFlags) == v2_pixel_formathash.end()) { - CCLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", + AXLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } @@ -1400,7 +1400,7 @@ bool Image::initWithPVRv2Data(uint8_t* data, ssize_t dataLen, bool ownData) int bpp = info.bpp; if (!bpp) { - CCLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", + AXLOG("cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%02X. Re-encode it with a OpenGL pixel format variant", (int)formatFlags); return false; } @@ -1430,7 +1430,7 @@ bool Image::initWithPVRv2Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR2TexturePixelFormat::PVRTC2BPP_RGBA: if (!Configuration::getInstance()->supportsPVRTC()) { - CCLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); _unpack = true; _mipmaps[_numberOfMipmaps].len = width * height * 4; _mipmaps[_numberOfMipmaps].address = (uint8_t*)malloc(width * height * 4); @@ -1444,7 +1444,7 @@ bool Image::initWithPVRv2Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR2TexturePixelFormat::PVRTC4BPP_RGBA: if (!Configuration::getInstance()->supportsPVRTC()) { - CCLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); _unpack = true; _mipmaps[_numberOfMipmaps].len = width * height * 4; _mipmaps[_numberOfMipmaps].address = (uint8_t*)malloc(width * height * 4); @@ -1458,7 +1458,7 @@ bool Image::initWithPVRv2Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR2TexturePixelFormat::BGRA8888: if (!Configuration::getInstance()->supportsBGRA8888()) { - CCLOG("cocos2d: Image. BGRA8888 not supported on this device"); + AXLOG("cocos2d: Image. BGRA8888 not supported on this device"); return false; } default: @@ -1522,7 +1522,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) // validate version if (AX_SWAP_INT32_BIG_TO_HOST(header->version) != 0x50565203) { - CCLOG("cocos2d: WARNING: pvr file version mismatch"); + AXLOG("cocos2d: WARNING: pvr file version mismatch"); return false; } @@ -1531,7 +1531,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) if (!testFormatForPvr3TCSupport(pixelFormat)) { - CCLOG( + AXLOG( "cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format " "variant", static_cast(pixelFormat)); @@ -1540,7 +1540,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) if (v3_pixel_formathash.find(pixelFormat) == v3_pixel_formathash.end()) { - CCLOG( + AXLOG( "cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format " "variant", static_cast(pixelFormat)); @@ -1552,7 +1552,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) int bpp = info.bpp; if (!info.bpp) { - CCLOG( + AXLOG( "cocos2d: WARNING: Unsupported PVR Pixel Format: 0x%016llX. Re-encode it with a OpenGL pixel format " "variant", static_cast(pixelFormat)); @@ -1584,7 +1584,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) int blockSize = 0, widthBlocks = 0, heightBlocks = 0; _numberOfMipmaps = header->numberOfMipmaps; - CCASSERT(_numberOfMipmaps < MIPMAP_MAX, + AXASSERT(_numberOfMipmaps < MIPMAP_MAX, "Image: Maximum number of mimpaps reached. Increase the AX_MIPMAP_MAX value"); for (int i = 0; i < _numberOfMipmaps; i++) @@ -1595,7 +1595,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR3TexturePixelFormat::PVRTC2BPP_RGBA: if (!Configuration::getInstance()->supportsPVRTC()) { - CCLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); _unpack = true; _mipmaps[i].len = width * height * 4; _mipmaps[i].address = (uint8_t*)malloc(width * height * 4); @@ -1610,7 +1610,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR3TexturePixelFormat::PVRTC4BPP_RGBA: if (!Configuration::getInstance()->supportsPVRTC()) { - CCLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware PVR decoder not present. Using software decoder"); _unpack = true; _mipmaps[i].len = width * height * 4; _mipmaps[i].address = (uint8_t*)malloc(width * height * 4); @@ -1624,7 +1624,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR3TexturePixelFormat::ETC1: if (!Configuration::getInstance()->supportsETC1()) { - CCLOG("cocos2d: Hardware ETC1 decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware ETC1 decoder not present. Using software decoder"); const int bytePerPixel = 4; _unpack = true; _mipmaps[i].len = width * height * bytePerPixel; @@ -1642,7 +1642,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) case PVR3TexturePixelFormat::BGRA8888: if (!Configuration::getInstance()->supportsBGRA8888()) { - CCLOG("cocos2d: Image. BGRA8888 not supported on this device"); + AXLOG("cocos2d: Image. BGRA8888 not supported on this device"); return false; } default: @@ -1673,7 +1673,7 @@ bool Image::initWithPVRv3Data(uint8_t* data, ssize_t dataLen, bool ownData) } dataOffset += packetLength; - CCASSERT(dataOffset <= pixelLen, "Image: Invalid length"); + AXASSERT(dataOffset <= pixelLen, "Image: Invalid length"); width = MAX(width >> 1, 1); height = MAX(height >> 1, 1); @@ -1735,7 +1735,7 @@ bool Image::initWithETCData(uint8_t* data, ssize_t dataLen, bool ownData) } else { - CCLOG("cocos2d: Hardware ETC1 decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware ETC1 decoder not present. Using software decoder"); _dataLen = _width * _height * 4; _data = static_cast(malloc(_dataLen)); @@ -1800,7 +1800,7 @@ bool Image::initWithETC2Data(uint8_t* data, ssize_t dataLen, bool ownData) } else { - CCLOG("cocos2d: Hardware ETC2 decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware ETC2 decoder not present. Using software decoder"); // if device do not support ETC2, decode texture by software // etc2_decode_image always decode to RGBA8888 @@ -1848,7 +1848,7 @@ bool Image::initWithASTCData(uint8_t* data, ssize_t dataLen, bool ownData) if (block_x < 4 || block_y < 4) { - CCLOG("cocos2d: The ASTC block with and height should be >= 4"); + AXLOG("cocos2d: The ASTC block with and height should be >= 4"); break; } @@ -1887,7 +1887,7 @@ bool Image::initWithASTCData(uint8_t* data, ssize_t dataLen, bool ownData) } else { - CCLOG("cocos2d: Hardware ASTC decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware ASTC decoder not present. Using software decoder"); _dataLen = _width * _height * 4; _data = static_cast(malloc(_dataLen)); @@ -1998,7 +1998,7 @@ bool Image::initWithS3TCData(uint8_t* data, ssize_t dataLen, bool ownData) else { // if it is not gles or device do not support S3TC, decode texture by software - CCLOG("cocos2d: Hardware S3TC decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware S3TC decoder not present. Using software decoder"); int bytePerPixel = 4; unsigned int stride = width * bytePerPixel; @@ -2073,7 +2073,7 @@ bool Image::initWithATITCData(uint8_t* data, ssize_t dataLen, bool ownData) bool hardware = Configuration::getInstance()->supportsATITC(); if (hardware) // compressed data length { - CCLOG("this is atitc H decode"); + AXLOG("this is atitc H decode"); switch (header->glInternalFormat) { @@ -2093,7 +2093,7 @@ bool Image::initWithATITCData(uint8_t* data, ssize_t dataLen, bool ownData) else // decompressed data length { /* if it is not gles or device do not support ATITC, decode texture by software */ - CCLOG("cocos2d: Hardware ATITC decoder not present. Using software decoder"); + AXLOG("cocos2d: Hardware ATITC decoder not present. Using software decoder"); _pixelFormat = backend::PixelFormat::RGBA8; @@ -2203,7 +2203,7 @@ bool Image::saveToFile(std::string_view filename, bool isToRGB) // only support for backend::PixelFormat::RGB8 or backend::PixelFormat::RGBA8 uncompressed data if (isCompressed() || (_pixelFormat != backend::PixelFormat::RGB8 && _pixelFormat != backend::PixelFormat::RGBA8)) { - CCLOG( + AXLOG( "cocos2d: Image: saveToFile is only support for backend::PixelFormat::RGB8 or backend::PixelFormat::RGBA8 " "uncompressed data for now"); return false; @@ -2221,7 +2221,7 @@ bool Image::saveToFile(std::string_view filename, bool isToRGB) } else { - CCLOG("cocos2d: Image: saveToFile no support file extension(only .png or .jpg) for file: %s", filename.data()); + AXLOG("cocos2d: Image: saveToFile no support file extension(only .png or .jpg) for file: %s", filename.data()); return false; } } @@ -2365,7 +2365,7 @@ bool Image::saveImageToPNG(std::string_view filePath, bool isToRGB) } while (0); return ret; #else - CCLOG("png is not enabled, please enable it in ccConfig.h"); + AXLOG("png is not enabled, please enable it in ccConfig.h"); return false; #endif // AX_USE_PNG } @@ -2470,7 +2470,7 @@ bool Image::saveImageToJPG(std::string_view filePath) } while (0); return ret; #else - CCLOG("jpeg is not enabled, please enable it in ccConfig.h"); + AXLOG("jpeg is not enabled, please enable it in ccConfig.h"); return false; #endif // AX_USE_JPEG } @@ -2478,7 +2478,7 @@ bool Image::saveImageToJPG(std::string_view filePath) void Image::premultiplyAlpha() { #if AX_ENABLE_PREMULTIPLIED_ALPHA - CCASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "The pixel format should be RGBA8888!"); + AXASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "The pixel format should be RGBA8888!"); unsigned int* fourBytes = (unsigned int*)_data; for (int i = 0; i < _width * _height; i++) @@ -2500,7 +2500,7 @@ static inline uint8_t clamp(int x) void Image::reversePremultipliedAlpha() { - CCASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "The pixel format should be RGBA8888!"); + AXASSERT(_pixelFormat == backend::PixelFormat::RGBA8, "The pixel format should be RGBA8888!"); unsigned int* fourBytes = (unsigned int*)_data; for (int i = 0; i < _width * _height; i++) diff --git a/core/platform/CCPlatformMacros.h b/core/platform/CCPlatformMacros.h index d67324da52..e8b48d159e 100644 --- a/core/platform/CCPlatformMacros.h +++ b/core/platform/CCPlatformMacros.h @@ -299,47 +299,47 @@ public: \ if (cond) \ break -#define __CCLOGWITHFUNCTION(s, ...) \ +#define __AXLOGWITHFUNCTION(s, ...) \ axis::log("%s : %s", __FUNCTION__, axis::StringUtils::format(s, ##__VA_ARGS__).c_str()) /// @name Cocos2d debug /// @{ -#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 -# define CCLOG(...) \ +#if !defined(AXIS_DEBUG) || AXIS_DEBUG == 0 +# define AXLOG(...) \ do \ { \ } while (0) -# define CCLOGINFO(...) \ +# define AXLOGINFO(...) \ do \ { \ } while (0) -# define CCLOGERROR(...) \ +# define AXLOGERROR(...) \ do \ { \ } while (0) -# define CCLOGWARN(...) \ +# define AXLOGWARN(...) \ do \ { \ } while (0) -#elif COCOS2D_DEBUG == 1 -# define CCLOG(format, ...) axis::log(format, ##__VA_ARGS__) -# define CCLOGERROR(format, ...) axis::log(format, ##__VA_ARGS__) -# define CCLOGINFO(format, ...) \ +#elif AXIS_DEBUG == 1 +# define AXLOG(format, ...) axis::log(format, ##__VA_ARGS__) +# define AXLOGERROR(format, ...) axis::log(format, ##__VA_ARGS__) +# define AXLOGINFO(format, ...) \ do \ { \ } while (0) -# define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__) +# define AXLOGWARN(...) __AXLOGWITHFUNCTION(__VA_ARGS__) -#elif COCOS2D_DEBUG > 1 -# define CCLOG(format, ...) axis::log(format, ##__VA_ARGS__) -# define CCLOGERROR(format, ...) axis::log(format, ##__VA_ARGS__) -# define CCLOGINFO(format, ...) axis::log(format, ##__VA_ARGS__) -# define CCLOGWARN(...) __CCLOGWITHFUNCTION(__VA_ARGS__) -#endif // COCOS2D_DEBUG +#elif AXIS_DEBUG > 1 +# define AXLOG(format, ...) axis::log(format, ##__VA_ARGS__) +# define AXLOGERROR(format, ...) axis::log(format, ##__VA_ARGS__) +# define AXLOGINFO(format, ...) axis::log(format, ##__VA_ARGS__) +# define AXLOGWARN(...) __AXLOGWITHFUNCTION(__VA_ARGS__) +#endif // AXIS_DEBUG /** Lua engine debug */ -#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 || AX_LUA_ENGINE_DEBUG == 0 +#if !defined(AXIS_DEBUG) || AXIS_DEBUG == 0 || AX_LUA_ENGINE_DEBUG == 0 # define LUALOG(...) #else # define LUALOG(format, ...) axis::log(format, ##__VA_ARGS__) diff --git a/core/platform/CCSAXParser.cpp b/core/platform/CCSAXParser.cpp index d2bc715c65..7111f0daec 100644 --- a/core/platform/CCSAXParser.cpp +++ b/core/platform/CCSAXParser.cpp @@ -132,7 +132,7 @@ bool SAXParser::parseIntrusive(char* xmlData, size_t dataLength) } catch (xsxml::parse_error& e) { - CCLOG("cocos2d: SAXParser: Error parsing xml: %s at %s", e.what(), e.where()); + AXLOG("cocos2d: SAXParser: Error parsing xml: %s at %s", e.what(), e.where()); return false; } diff --git a/core/platform/android/CCDevice-android.cpp b/core/platform/android/CCDevice-android.cpp index 4de8d440e4..ec82e189e6 100644 --- a/core/platform/android/CCDevice-android.cpp +++ b/core/platform/android/CCDevice-android.cpp @@ -82,7 +82,7 @@ public: "createTextBitmapShadowStroke", "([BLjava/lang/String;IIIIIIIIZFFFFZIIIIFZI)Z")) { - CCLOG("%s %d: error to get methodInfo", __FILE__, __LINE__); + AXLOG("%s %d: error to get methodInfo", __FILE__, __LINE__); return false; } diff --git a/core/platform/android/CCFileUtils-android.cpp b/core/platform/android/CCFileUtils-android.cpp index b80eda88c7..980358ee3c 100644 --- a/core/platform/android/CCFileUtils-android.cpp +++ b/core/platform/android/CCFileUtils-android.cpp @@ -73,7 +73,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsAndroid"); + AXLOG("ERROR: Could not init CCFileUtilsAndroid"); } } return s_sharedFileUtils; @@ -140,7 +140,7 @@ bool FileUtilsAndroid::isFileExistInternal(std::string_view strFilePath) const } else { - // CCLOG("[AssetManager] ... in APK %s, found = false!", strFilePath.c_str()); + // AXLOG("[AssetManager] ... in APK %s, found = false!", strFilePath.c_str()); } } } @@ -175,7 +175,7 @@ bool FileUtilsAndroid::isDirectoryExistInternal(std::string_view dirPath) const // find absolute path in flash memory if (s[0] == '/') { - CCLOG("find in flash memory dirPath(%s)", s); + AXLOG("find in flash memory dirPath(%s)", s); struct stat st; if (stat(s, &st) == 0) { @@ -187,7 +187,7 @@ bool FileUtilsAndroid::isDirectoryExistInternal(std::string_view dirPath) const // find it in apk's assets dir // Found "assets/" at the beginning of the path and we don't want it - CCLOG("find in apk dirPath(%s)", s); + AXLOG("find in apk dirPath(%s)", s); if (dirPath.find(ASSETS_FOLDER_NAME) == 0) { s += ASSETS_FOLDER_NAME_LENGTH; diff --git a/core/platform/apple/CCFileUtils-apple.mm b/core/platform/apple/CCFileUtils-apple.mm index 1a213ce7c8..13195eb08d 100644 --- a/core/platform/apple/CCFileUtils-apple.mm +++ b/core/platform/apple/CCFileUtils-apple.mm @@ -74,7 +74,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsApple"); + AXLOG("ERROR: Could not init CCFileUtilsApple"); } } return s_sharedFileUtils; @@ -161,7 +161,7 @@ bool FileUtilsApple::removeDirectory(std::string_view path) const { if (path.empty()) { - CCLOGERROR("Fail to remove directory, path is empty!"); + AXLOGERROR("Fail to remove directory, path is empty!"); return false; } @@ -231,7 +231,7 @@ std::string FileUtilsApple::getFullPathForFilenameWithinDirectory(std::string_vi bool FileUtilsApple::createDirectory(std::string_view path) const { - CCASSERT(!path.empty(), "Invalid path"); + AXASSERT(!path.empty(), "Invalid path"); if (isDirectoryExist(path)) return true; @@ -245,7 +245,7 @@ bool FileUtilsApple::createDirectory(std::string_view path) const if (!result && error != nil) { - CCLOGERROR("Fail to create directory \"%s\": %s", path.data(), [error.localizedDescription UTF8String]); + AXLOGERROR("Fail to create directory \"%s\": %s", path.data(), [error.localizedDescription UTF8String]); } return result; diff --git a/core/platform/desktop/CCGLViewImpl-desktop.cpp b/core/platform/desktop/CCGLViewImpl-desktop.cpp index c30378bb83..92c160eea8 100644 --- a/core/platform/desktop/CCGLViewImpl-desktop.cpp +++ b/core/platform/desktop/CCGLViewImpl-desktop.cpp @@ -319,7 +319,7 @@ GLViewImpl::GLViewImpl(bool initglfw) GLViewImpl::~GLViewImpl() { - CCLOGINFO("deallocing GLViewImpl: %p", this); + AXLOGINFO("deallocing GLViewImpl: %p", this); GLFWEventHandler::setGLViewImpl(nullptr); #if defined(_WIN32) glfwxTerminate(); @@ -660,7 +660,7 @@ void GLViewImpl::setCursorVisible(bool isVisible) void GLViewImpl::setFrameZoomFactor(float zoomFactor) { - CCASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0"); + AXASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0"); if (std::abs(_frameZoomFactor - zoomFactor) < FLT_EPSILON) { @@ -890,7 +890,7 @@ void GLViewImpl::onGLFWError(int errorID, const char* errorDesc) { _glfwError.append(StringUtils::format("GLFWError #%d Happen, %s\n", errorID, errorDesc)); } - CCLOGERROR("%s", _glfwError.c_str()); + AXLOGERROR("%s", _glfwError.c_str()); } void GLViewImpl::onGLFWMouseCallBack(GLFWwindow* /*window*/, int button, int action, int /*modify*/) diff --git a/core/platform/ios/CCEAGLView-ios.mm b/core/platform/ios/CCEAGLView-ios.mm index 40ff8f96cc..be2f0acd95 100644 --- a/core/platform/ios/CCEAGLView-ios.mm +++ b/core/platform/ios/CCEAGLView-ios.mm @@ -194,7 +194,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. id device = MTLCreateSystemDefaultDevice(); if (!device) { - CCLOG("Doesn't support metal."); + AXLOG("Doesn't support metal."); return nil; } CAMetalLayer* metalLayer = (CAMetalLayer*)[self layer]; @@ -385,10 +385,10 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. if (![context_ presentRenderbuffer:GL_RENDERBUFFER]) { - // CCLOG(@"cocos2d: Failed to swap renderbuffer in %s\n", __FUNCTION__); + // AXLOG(@"cocos2d: Failed to swap renderbuffer in %s\n", __FUNCTION__); } -# if COCOS2D_DEBUG +# if AXIS_DEBUG CHECK_GL_ERROR(); # endif @@ -454,7 +454,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. { if (i >= IOS_MAX_TOUCHES_COUNT) { - CCLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); + AXLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); break; } @@ -481,7 +481,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. { if (i >= IOS_MAX_TOUCHES_COUNT) { - CCLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); + AXLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); break; } @@ -514,7 +514,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. { if (i >= IOS_MAX_TOUCHES_COUNT) { - CCLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); + AXLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); break; } @@ -539,7 +539,7 @@ Copyright (C) 2008 Apple Inc. All Rights Reserved. { if (i >= IOS_MAX_TOUCHES_COUNT) { - CCLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); + AXLOG("warning: touches more than 10, should adjust IOS_MAX_TOUCHES_COUNT"); break; } diff --git a/core/platform/ios/CCES2Renderer-ios.m b/core/platform/ios/CCES2Renderer-ios.m index f12c53a248..7c6260b530 100644 --- a/core/platform/ios/CCES2Renderer-ios.m +++ b/core/platform/ios/CCES2Renderer-ios.m @@ -36,7 +36,7 @@ // #import "platform/CCPlatformMacros.h" #import "platform/ios/OpenGL_Internal-ios.h" -#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 +#if !defined(AXIS_DEBUG) || AXIS_DEBUG == 0 #define NSLog(...) do {} while (0) #endif @@ -212,7 +212,7 @@ - (void)dealloc { -// CCLOGINFO("deallocing CCES2Renderer: %p", self); +// AXLOGINFO("deallocing CCES2Renderer: %p", self); // Tear down GL if (defaultFramebuffer_) { diff --git a/core/platform/ios/CCGLViewImpl-ios.mm b/core/platform/ios/CCGLViewImpl-ios.mm index e483af0481..f6de3aa70e 100644 --- a/core/platform/ios/CCGLViewImpl-ios.mm +++ b/core/platform/ios/CCGLViewImpl-ios.mm @@ -99,7 +99,7 @@ void GLViewImpl::convertAttrs() } else { - CCASSERT(0, "Unsupported render buffer pixel format. Using default"); + AXASSERT(0, "Unsupported render buffer pixel format. Using default"); } if (_glContextAttrs.depthBits == 24 && _glContextAttrs.stencilBits == 8) @@ -112,7 +112,7 @@ void GLViewImpl::convertAttrs() } else { - CCASSERT(0, "Unsupported format for depth and stencil buffers. Using default"); + AXASSERT(0, "Unsupported format for depth and stencil buffers. Using default"); } _multisamplingCount = _glContextAttrs.multisamplingCount; @@ -198,7 +198,7 @@ float GLViewImpl::getContentScaleFactor() const float scaleFactor = [eaglview contentScaleFactor]; - // CCASSERT(scaleFactor == _scaleX == _scaleY, "Logic error in GLView::getContentScaleFactor"); + // AXASSERT(scaleFactor == _scaleX == _scaleY, "Logic error in GLView::getContentScaleFactor"); return scaleFactor; } diff --git a/core/platform/ios/CCImage-ios.mm b/core/platform/ios/CCImage-ios.mm index 55b0f475fe..d81caba167 100644 --- a/core/platform/ios/CCImage-ios.mm +++ b/core/platform/ios/CCImage-ios.mm @@ -40,7 +40,7 @@ bool axis::Image::saveToFile(std::string_view filename, bool isToRGB) // only support for backend::PixelFormat::RGB8 or backend::PixelFormat::RGBA8 uncompressed data if (isCompressed() || (_pixelFormat != backend::PixelFormat::RGB8 && _pixelFormat != backend::PixelFormat::RGBA8)) { - CCLOG("cocos2d: Image: saveToFile is only support for backend::PixelFormat::RGB8 or " + AXLOG("cocos2d: Image: saveToFile is only support for backend::PixelFormat::RGB8 or " "backend::PixelFormat::RGBA8 uncompressed data for now"); return false; } diff --git a/core/platform/ios/CCInputView-ios.mm b/core/platform/ios/CCInputView-ios.mm index 09748b5fbb..e4ee343e82 100644 --- a/core/platform/ios/CCInputView-ios.mm +++ b/core/platform/ios/CCInputView-ios.mm @@ -83,7 +83,7 @@ THE SOFTWARE. - (void)setSelectedTextRange:(UITextRange*)aSelectedTextRange { - CCLOG("UITextRange:setSelectedTextRange"); + AXLOG("UITextRange:setSelectedTextRange"); } - (UITextRange*)selectedTextRange @@ -115,56 +115,56 @@ THE SOFTWARE. - (NSWritingDirection)baseWritingDirectionForPosition:(nonnull UITextPosition*)position inDirection:(UITextStorageDirection)direction { - CCLOG("baseWritingDirectionForPosition"); + AXLOG("baseWritingDirectionForPosition"); return NSWritingDirectionLeftToRight; } - (CGRect)caretRectForPosition:(nonnull UITextPosition*)position { - CCLOG("caretRectForPosition"); + AXLOG("caretRectForPosition"); return CGRectZero; } - (nullable UITextRange*)characterRangeAtPoint:(CGPoint)point { - CCLOG("characterRangeAtPoint"); + AXLOG("characterRangeAtPoint"); return nil; } - (nullable UITextRange*)characterRangeByExtendingPosition:(nonnull UITextPosition*)position inDirection:(UITextLayoutDirection)direction { - CCLOG("characterRangeByExtendingPosition"); + AXLOG("characterRangeByExtendingPosition"); return nil; } - (nullable UITextPosition*)closestPositionToPoint:(CGPoint)point { - CCLOG("closestPositionToPoint"); + AXLOG("closestPositionToPoint"); return nil; } - (nullable UITextPosition*)closestPositionToPoint:(CGPoint)point withinRange:(nonnull UITextRange*)range { - CCLOG("closestPositionToPoint"); + AXLOG("closestPositionToPoint"); return nil; } - (NSComparisonResult)comparePosition:(nonnull UITextPosition*)position toPosition:(nonnull UITextPosition*)other { - CCLOG("comparePosition"); + AXLOG("comparePosition"); return (NSComparisonResult)0; } - (CGRect)firstRectForRange:(nonnull UITextRange*)range { - CCLOG("firstRectForRange"); + AXLOG("firstRectForRange"); return CGRectNull; } - (NSInteger)offsetFromPosition:(nonnull UITextPosition*)from toPosition:(nonnull UITextPosition*)toPosition { - CCLOG("offsetFromPosition"); + AXLOG("offsetFromPosition"); return 0; } @@ -172,20 +172,20 @@ THE SOFTWARE. inDirection:(UITextLayoutDirection)direction offset:(NSInteger)offset { - CCLOG("positionFromPosition"); + AXLOG("positionFromPosition"); return nil; } - (nullable UITextPosition*)positionFromPosition:(nonnull UITextPosition*)position offset:(NSInteger)offset { - CCLOG("positionFromPosition"); + AXLOG("positionFromPosition"); return nil; } - (nullable UITextPosition*)positionWithinRange:(nonnull UITextRange*)range farthestInDirection:(UITextLayoutDirection)direction { - CCLOG("positionWithinRange"); + AXLOG("positionWithinRange"); return nil; } @@ -194,7 +194,7 @@ THE SOFTWARE. - (nonnull NSArray*)selectionRectsForRange:(nonnull UITextRange*)range { - CCLOG("selectionRectsForRange"); + AXLOG("selectionRectsForRange"); return nil; } @@ -203,7 +203,7 @@ THE SOFTWARE. - (void)setMarkedText:(nullable NSString*)markedText selectedRange:(NSRange)selectedRange { - CCLOG("setMarkedText"); + AXLOG("setMarkedText"); if (markedText == self.myMarkedText) { return; @@ -218,7 +218,7 @@ THE SOFTWARE. - (UITextRange*)markedTextRange { - CCLOG("markedTextRange"); + AXLOG("markedTextRange"); if (nil != self.myMarkedText) { return [[[UITextRange alloc] init] autorelease]; @@ -228,7 +228,7 @@ THE SOFTWARE. - (nullable NSString*)textInRange:(nonnull UITextRange*)range { - CCLOG("textInRange"); + AXLOG("textInRange"); if (nil != self.myMarkedText) { return self.myMarkedText; @@ -239,13 +239,13 @@ THE SOFTWARE. - (nullable UITextRange*)textRangeFromPosition:(nonnull UITextPosition*)fromPosition toPosition:(nonnull UITextPosition*)toPosition { - CCLOG("textRangeFromPosition"); + AXLOG("textRangeFromPosition"); return nil; } - (void)unmarkText { - CCLOG("unmarkText"); + AXLOG("unmarkText"); if (nil == self.myMarkedText) { return; diff --git a/core/platform/linux/CCFileUtils-linux.cpp b/core/platform/linux/CCFileUtils-linux.cpp index 4aac1a8b99..5882090d91 100644 --- a/core/platform/linux/CCFileUtils-linux.cpp +++ b/core/platform/linux/CCFileUtils-linux.cpp @@ -49,7 +49,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsLinux"); + AXLOG("ERROR: Could not init CCFileUtilsLinux"); } } return s_sharedFileUtils; diff --git a/core/platform/mac/CCApplication-mac.mm b/core/platform/mac/CCApplication-mac.mm index ff44955a95..61d54521c1 100644 --- a/core/platform/mac/CCApplication-mac.mm +++ b/core/platform/mac/CCApplication-mac.mm @@ -41,13 +41,13 @@ Application* Application::sm_pSharedApplication = nullptr; Application::Application() : _animationInterval(16666667) { - CCASSERT(!sm_pSharedApplication, "sm_pSharedApplication already exist"); + AXASSERT(!sm_pSharedApplication, "sm_pSharedApplication already exist"); sm_pSharedApplication = this; } Application::~Application() { - CCASSERT(this == sm_pSharedApplication, "sm_pSharedApplication != this"); + AXASSERT(this == sm_pSharedApplication, "sm_pSharedApplication != this"); sm_pSharedApplication = 0; } @@ -127,7 +127,7 @@ std::string Application::getVersion() Application* Application::getInstance() { - CCASSERT(sm_pSharedApplication, "sm_pSharedApplication not set"); + AXASSERT(sm_pSharedApplication, "sm_pSharedApplication not set"); return sm_pSharedApplication; } diff --git a/core/platform/mac/CCDevice-mac.mm b/core/platform/mac/CCDevice-mac.mm index 3f59fcd85e..13959cfc6f 100644 --- a/core/platform/mac/CCDevice-mac.mm +++ b/core/platform/mac/CCDevice-mac.mm @@ -281,8 +281,8 @@ static bool _initWithString(const char* text, { bool ret = false; - CCASSERT(text, "Invalid text"); - CCASSERT(info, "Invalid info"); + AXASSERT(text, "Invalid text"); + AXASSERT(info, "Invalid info"); do { diff --git a/core/platform/mac/CCGLViewImpl-mac.mm b/core/platform/mac/CCGLViewImpl-mac.mm index 20c028078d..ed3f7d4cfb 100644 --- a/core/platform/mac/CCGLViewImpl-mac.mm +++ b/core/platform/mac/CCGLViewImpl-mac.mm @@ -304,7 +304,7 @@ GLViewImpl::GLViewImpl(bool initglfw) GLViewImpl::~GLViewImpl() { - CCLOGINFO("deallocing GLViewImpl: %p", this); + AXLOGINFO("deallocing GLViewImpl: %p", this); GLFWEventHandler::setGLViewImpl(nullptr); glfwTerminate(); } @@ -415,7 +415,7 @@ bool GLViewImpl::initWithRect(std::string_view viewName, Rect rect, float frameZ id device = MTLCreateSystemDefaultDevice(); if (!device) { - CCLOG("Doesn't support metal."); + AXLOG("Doesn't support metal."); return false; } @@ -622,7 +622,7 @@ void GLViewImpl::setCursorVisible(bool isVisible) void GLViewImpl::setFrameZoomFactor(float zoomFactor) { - CCASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0"); + AXASSERT(zoomFactor > 0.0f, "zoomFactor must be larger than 0"); if (std::abs(_frameZoomFactor - zoomFactor) < FLT_EPSILON) { @@ -852,7 +852,7 @@ void GLViewImpl::onGLFWError(int errorID, const char* errorDesc) { _glfwError.append(StringUtils::format("GLFWError #%d Happen, %s\n", errorID, errorDesc)); } - CCLOGERROR("%s", _glfwError.c_str()); + AXLOGERROR("%s", _glfwError.c_str()); } void GLViewImpl::onGLFWMouseCallBack(GLFWwindow* /*window*/, int button, int action, int /*modify*/) diff --git a/core/platform/win32/CCFileUtils-win32.cpp b/core/platform/win32/CCFileUtils-win32.cpp index 342cab1b5d..714274ab3b 100644 --- a/core/platform/win32/CCFileUtils-win32.cpp +++ b/core/platform/win32/CCFileUtils-win32.cpp @@ -98,7 +98,7 @@ FileUtils* FileUtils::getInstance() { delete s_sharedFileUtils; s_sharedFileUtils = nullptr; - CCLOG("ERROR: Could not init CCFileUtilsWin32"); + AXLOG("ERROR: Could not init CCFileUtilsWin32"); } } return s_sharedFileUtils; @@ -175,7 +175,7 @@ FileUtils::Status FileUtilsWin32::getContents(std::string_view filename, Resizab if (!successed) { - CCLOG("Get data from file(%s) failed, error code is %s", filename.data(), + AXLOG("Get data from file(%s) failed, error code is %s", filename.data(), std::to_string(::GetLastError()).data()); buffer->resize(sizeRead); return FileUtils::Status::ReadFailed; @@ -277,8 +277,8 @@ std::string FileUtilsWin32::getNativeWritableAbsolutePath() const bool FileUtilsWin32::renameFile(std::string_view oldfullpath, std::string_view newfullpath) const { - CCASSERT(!oldfullpath.empty(), "Invalid path"); - CCASSERT(!newfullpath.empty(), "Invalid path"); + AXASSERT(!oldfullpath.empty(), "Invalid path"); + AXASSERT(!newfullpath.empty(), "Invalid path"); std::wstring _wNew = ntcvt::from_chars(newfullpath); std::wstring _wOld = ntcvt::from_chars(oldfullpath); @@ -287,7 +287,7 @@ bool FileUtilsWin32::renameFile(std::string_view oldfullpath, std::string_view n { if (!DeleteFile(_wNew.c_str())) { - CCLOGERROR("Fail to delete file %s !Error code is 0x%x", newfullpath.data(), GetLastError()); + AXLOGERROR("Fail to delete file %s !Error code is 0x%x", newfullpath.data(), GetLastError()); } } @@ -297,7 +297,7 @@ bool FileUtilsWin32::renameFile(std::string_view oldfullpath, std::string_view n } else { - CCLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldfullpath.data(), newfullpath.data(), + AXLOGERROR("Fail to rename file %s to %s !Error code is 0x%x", oldfullpath.data(), newfullpath.data(), GetLastError()); return false; } @@ -305,7 +305,7 @@ bool FileUtilsWin32::renameFile(std::string_view oldfullpath, std::string_view n bool FileUtilsWin32::renameFile(std::string_view path, std::string_view oldname, std::string_view name) const { - CCASSERT(!path.empty(), "Invalid path"); + AXASSERT(!path.empty(), "Invalid path"); std::string oldPath{path}; oldPath += oldname; std::string newPath{path}; @@ -320,7 +320,7 @@ bool FileUtilsWin32::renameFile(std::string_view path, std::string_view oldname, bool FileUtilsWin32::createDirectory(std::string_view dirPath) const { - CCASSERT(!dirPath.empty(), "Invalid path"); + AXASSERT(!dirPath.empty(), "Invalid path"); if (isDirectoryExist(dirPath)) return true; @@ -366,7 +366,7 @@ bool FileUtilsWin32::createDirectory(std::string_view dirPath) const BOOL ret = CreateDirectoryW(subpath.c_str(), NULL); if (!ret && ERROR_ALREADY_EXISTS != GetLastError()) { - CCLOGERROR("Fail create directory %s !Error code is 0x%x", utf8Path.c_str(), GetLastError()); + AXLOGERROR("Fail create directory %s !Error code is 0x%x", utf8Path.c_str(), GetLastError()); return false; } } @@ -385,7 +385,7 @@ bool FileUtilsWin32::removeFile(std::string_view filepath) const } else { - CCLOGERROR("Fail remove file %s !Error code is 0x%x", filepath.data(), GetLastError()); + AXLOGERROR("Fail remove file %s !Error code is 0x%x", filepath.data(), GetLastError()); return false; } } diff --git a/core/renderer/CCMaterial.cpp b/core/renderer/CCMaterial.cpp index 9e17fca1d1..a9c5c59955 100644 --- a/core/renderer/CCMaterial.cpp +++ b/core/renderer/CCMaterial.cpp @@ -103,7 +103,7 @@ Material* Material::createWithProperties(Properties* materialProperties) Material* Material::createWithProgramState(backend::ProgramState* programState) { - CCASSERT(programState, "Invalid Program State"); + AXASSERT(programState, "Invalid Program State"); auto mat = new Material(); if (mat->initWithProgramState(programState)) @@ -249,7 +249,7 @@ bool Material::parsePass(Technique* technique, Properties* passProperties) } else { - CCASSERT(false, "Invalid namespace"); + AXASSERT(false, "Invalid namespace"); return false; } @@ -262,7 +262,7 @@ bool Material::parsePass(Technique* technique, Properties* passProperties) // cocos2d-x doesn't support Samplers yet. But will be added soon bool Material::parseSampler(backend::ProgramState* programState, Properties* samplerProperties) { - CCASSERT(samplerProperties->getId(), "Sampler must have an id. The id is the uniform name"); + AXASSERT(samplerProperties->getId(), "Sampler must have an id. The id is the uniform name"); // required auto filename = samplerProperties->getString("path"); @@ -270,7 +270,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam auto texture = Director::getInstance()->getTextureCache()->addImage(filename); if (!texture) { - CCLOG("Invalid filepath"); + AXLOG("Invalid filepath"); return false; } @@ -294,7 +294,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam else if (strcasecmp(wrapS, "CLAMP_TO_EDGE") == 0) texParams.sAddressMode = backend::SamplerAddressMode::CLAMP_TO_EDGE; else - CCLOG("Invalid wrapS: %s", wrapS); + AXLOG("Invalid wrapS: %s", wrapS); // valid options: REPEAT, CLAMP const char* wrapT = getOptionalString(samplerProperties, "wrapT", "CLAMP_TO_EDGE"); @@ -303,7 +303,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam else if (strcasecmp(wrapT, "CLAMP_TO_EDGE") == 0) texParams.tAddressMode = backend::SamplerAddressMode::CLAMP_TO_EDGE; else - CCLOG("Invalid wrapT: %s", wrapT); + AXLOG("Invalid wrapT: %s", wrapT); // valid options: NEAREST, LINEAR, NEAREST_MIPMAP_NEAREST, LINEAR_MIPMAP_NEAREST, NEAREST_MIPMAP_LINEAR, // LINEAR_MIPMAP_LINEAR @@ -322,7 +322,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam else if (strcasecmp(minFilter, "LINEAR_MIPMAP_LINEAR") == 0) texParams.minFilter = backend::SamplerFilter::LINEAR; else - CCLOG("Invalid minFilter: %s", minFilter); + AXLOG("Invalid minFilter: %s", minFilter); // valid options: NEAREST, LINEAR const char* magFilter = getOptionalString(samplerProperties, "magFilter", "LINEAR"); @@ -331,7 +331,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam else if (strcasecmp(magFilter, "LINEAR") == 0) texParams.magFilter = backend::SamplerFilter::LINEAR; else - CCLOG("Invalid magFilter: %s", magFilter); + AXLOG("Invalid magFilter: %s", magFilter); texture->setTexParameters(texParams); } @@ -341,7 +341,7 @@ bool Material::parseSampler(backend::ProgramState* programState, Properties* sam if (!location) { - CCLOG("warning: failed to find texture uniform location %s when parsing material", textureName); + AXLOG("warning: failed to find texture uniform location %s when parsing material", textureName); return false; } diff --git a/core/renderer/CCPass.cpp b/core/renderer/CCPass.cpp index 6a2137071d..d6d21f8407 100644 --- a/core/renderer/CCPass.cpp +++ b/core/renderer/CCPass.cpp @@ -248,7 +248,7 @@ void Pass::onAfterVisitCmd(MeshCommand* command) Node* Pass::getTarget() const { - CCASSERT(_technique && _technique->_material, "Pass must have a Technique and Material"); + AXASSERT(_technique && _technique->_material, "Pass must have a Technique and Material"); Material* material = _technique->_material; return material->_target; diff --git a/core/renderer/CCQuadCommand.cpp b/core/renderer/CCQuadCommand.cpp index 60433a394e..a6224e041d 100644 --- a/core/renderer/CCQuadCommand.cpp +++ b/core/renderer/CCQuadCommand.cpp @@ -61,7 +61,7 @@ void QuadCommand::reIndex(int indicesCount) indicesCount *= 1.25; indicesCount = std::min(indicesCount, 65536); - CCLOG("cocos2d: QuadCommand: resizing index size from [%d] to [%d]", __indexCapacity, indicesCount); + AXLOG("cocos2d: QuadCommand: resizing index size from [%d] to [%d]", __indexCapacity, indicesCount); _ownedIndices.push_back(__indices); __indices = new uint16_t[indicesCount]; diff --git a/core/renderer/CCRenderCommandPool.h b/core/renderer/CCRenderCommandPool.h index 599c168934..e0777a81c4 100644 --- a/core/renderer/CCRenderCommandPool.h +++ b/core/renderer/CCRenderCommandPool.h @@ -42,7 +42,7 @@ public: { // if( 0 != _usedPool.size()) // { - // CCLOG("All RenderCommand should not be used when Pool is released!"); + // AXLOG("All RenderCommand should not be used when Pool is released!"); // } _freePool.clear(); for (auto& allocatedPoolBlock : _allocatedPoolBlocks) @@ -70,7 +70,7 @@ public: { // if(_usedPool.find(ptr) == _usedPool.end()) // { - // CCLOG("push Back Wrong command!"); + // AXLOG("push Back Wrong command!"); // return; // } diff --git a/core/renderer/CCRenderState.cpp b/core/renderer/CCRenderState.cpp index e5a6f3c866..1685f810fa 100644 --- a/core/renderer/CCRenderState.cpp +++ b/core/renderer/CCRenderState.cpp @@ -221,7 +221,7 @@ static backend::BlendFactor parseBlend(std::string_view value) return backend::BlendFactor::SRC_ALPHA_SATURATE; else { - CCLOG("Unsupported blend value (%s). (Will default to BLEND_ONE if errors are treated as warnings)", + AXLOG("Unsupported blend value (%s). (Will default to BLEND_ONE if errors are treated as warnings)", value.data()); return backend::BlendFactor::ONE; } @@ -250,7 +250,7 @@ static DepthFunction parseDepthFunc(std::string_view value) return DepthFunction::ALWAYS; else { - CCLOG("Unsupported depth function value (%s). Will default to DEPTH_LESS if errors are treated as warnings)", + AXLOG("Unsupported depth function value (%s). Will default to DEPTH_LESS if errors are treated as warnings)", value.data()); return DepthFunction::LESS; } @@ -270,7 +270,7 @@ static CullFaceSide parseCullFaceSide(std::string_view value) // return RenderState::CULL_FACE_SIDE_FRONT_AND_BACK; else { - CCLOG("Unsupported cull face side value (%s). Will default to BACK if errors are treated as warnings.", + AXLOG("Unsupported cull face side value (%s). Will default to BACK if errors are treated as warnings.", value.data()); return CullFaceSide::BACK; } @@ -287,7 +287,7 @@ static FrontFace parseFrontFace(std::string_view value) return FrontFace::CLOCK_WISE; else { - CCLOG("Unsupported front face side value (%s). Will default to CCW if errors are treated as warnings.", + AXLOG("Unsupported front face side value (%s). Will default to CCW if errors are treated as warnings.", value.data()); return FrontFace::COUNTER_CLOCK_WISE; } @@ -333,7 +333,7 @@ void RenderState::StateBlock::setState(std::string_view name, std::string_view v } else { - CCLOG("Unsupported render state string '%s'.", name.data()); + AXLOG("Unsupported render state string '%s'.", name.data()); } } diff --git a/core/renderer/CCRenderer.cpp b/core/renderer/CCRenderer.cpp index 875de6bf89..694bd30b05 100644 --- a/core/renderer/CCRenderer.cpp +++ b/core/renderer/CCRenderer.cpp @@ -131,7 +131,7 @@ RenderCommand* RenderQueue::operator[](ssize_t index) const } } - CCASSERT(false, "invalid index"); + AXASSERT(false, "invalid index"); return nullptr; } @@ -234,22 +234,22 @@ void Renderer::addCommand(RenderCommand* command) void Renderer::addCommand(RenderCommand* command, int renderQueueID) { - CCASSERT(!_isRendering, "Cannot add command while rendering"); - CCASSERT(renderQueueID >= 0, "Invalid render queue"); - CCASSERT(command->getType() != RenderCommand::Type::UNKNOWN_COMMAND, "Invalid Command Type"); + AXASSERT(!_isRendering, "Cannot add command while rendering"); + AXASSERT(renderQueueID >= 0, "Invalid render queue"); + AXASSERT(command->getType() != RenderCommand::Type::UNKNOWN_COMMAND, "Invalid Command Type"); _renderGroups[renderQueueID].push_back(command); } void Renderer::pushGroup(int renderQueueID) { - CCASSERT(!_isRendering, "Cannot change render queue while rendering"); + AXASSERT(!_isRendering, "Cannot change render queue while rendering"); _commandGroupStack.push(renderQueueID); } void Renderer::popGroup() { - CCASSERT(!_isRendering, "Cannot change render queue while rendering"); + AXASSERT(!_isRendering, "Cannot change render queue while rendering"); _commandGroupStack.pop(); } @@ -291,9 +291,9 @@ void Renderer::processRenderCommand(RenderCommand* command) if (_queuedTotalVertexCount + cmd->getVertexCount() > VBO_SIZE || _queuedTotalIndexCount + cmd->getIndexCount() > INDEX_VBO_SIZE) { - CCASSERT(cmd->getVertexCount() >= 0 && cmd->getVertexCount() < VBO_SIZE, + AXASSERT(cmd->getVertexCount() >= 0 && cmd->getVertexCount() < VBO_SIZE, "VBO for vertex is not big enough, please break the data down or use customized render command"); - CCASSERT(cmd->getIndexCount() >= 0 && cmd->getIndexCount() < INDEX_VBO_SIZE, + AXASSERT(cmd->getIndexCount() >= 0 && cmd->getIndexCount() < INDEX_VBO_SIZE, "VBO for index is not big enough, please break the data down or use customized render command"); drawBatchedTriangles(); diff --git a/core/renderer/CCTexture2D.cpp b/core/renderer/CCTexture2D.cpp index f1e2b78007..2e7f8d6df0 100644 --- a/core/renderer/CCTexture2D.cpp +++ b/core/renderer/CCTexture2D.cpp @@ -83,7 +83,7 @@ Texture2D::~Texture2D() #if AX_ENABLE_CACHE_TEXTURE_DATA VolatileTextureMgr::removeTexture(this); #endif - CCLOGINFO("deallocing Texture2D: %p - id=%u", this, _name); + AXLOGINFO("deallocing Texture2D: %p - id=%u", this, _name); AX_SAFE_DELETE(_ninePatchInfo); @@ -166,7 +166,7 @@ bool Texture2D::initWithData(const void* data, int pixelsHigh, bool preMultipliedAlpha) { - CCASSERT(dataLen > 0 && pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); + AXASSERT(dataLen > 0 && pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); // if data has no mipmaps, we will consider it has only one mipmap MipmapInfo mipmap; @@ -193,7 +193,7 @@ bool Texture2D::updateWithImage(Image* image, backend::PixelFormat format, int i { if (image == nullptr) { - CCLOG("cocos2d: Texture2D. Can't create Texture. UIImage is nil"); + AXLOG("cocos2d: Texture2D. Can't create Texture. UIImage is nil"); return false; } @@ -208,7 +208,7 @@ bool Texture2D::updateWithImage(Image* image, backend::PixelFormat format, int i int maxTextureSize = conf->getMaxTextureSize(); if (imageWidth > maxTextureSize || imageHeight > maxTextureSize) { - CCLOG("cocos2d: WARNING: Image (%u x %u) is bigger than the supported %u x %u", imageWidth, imageHeight, + AXLOG("cocos2d: WARNING: Image (%u x %u) is bigger than the supported %u x %u", imageWidth, imageHeight, maxTextureSize, maxTextureSize); return false; } @@ -244,7 +244,7 @@ bool Texture2D::updateWithImage(Image* image, backend::PixelFormat format, int i { if (renderFormat != image->getPixelFormat()) { - CCLOG("cocos2d: WARNING: This image has more than 1 mipmaps and we will not convert the data format"); + AXLOG("cocos2d: WARNING: This image has more than 1 mipmaps and we will not convert the data format"); } // pixel format of data is not converted, renderFormat can be different from pixelFormat @@ -276,7 +276,7 @@ bool Texture2D::updateWithData(const void* data, bool preMultipliedAlpha, int index) { - CCASSERT(dataLen > 0 && pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); + AXASSERT(dataLen > 0 && pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); // if data has no mipmaps, we will consider it has only one mipmap MipmapInfo mipmap; @@ -295,21 +295,21 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, int index) { // the pixelFormat must be a certain value - CCASSERT(pixelFormat != PixelFormat::NONE, "the \"pixelFormat\" param must be a certain value!"); - CCASSERT(pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); + AXASSERT(pixelFormat != PixelFormat::NONE, "the \"pixelFormat\" param must be a certain value!"); + AXASSERT(pixelsWide > 0 && pixelsHigh > 0, "Invalid size"); if (mipmapsNum <= 0) { - CCLOG("cocos2d: WARNING: mipmap number is less than 1"); + AXLOG("cocos2d: WARNING: mipmap number is less than 1"); return false; } auto& pfd = backend::PixelFormatUtils::getFormatDescriptor(pixelFormat); if (!pfd.bpp) { - CCLOG("cocos2d: WARNING: unsupported pixelformat: %x", (uint32_t)pixelFormat); + AXLOG("cocos2d: WARNING: unsupported pixelformat: %x", (uint32_t)pixelFormat); #ifdef AX_USE_METAL - CCASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!"); + AXASSERT(false, "pixeformat not found in _pixelFormatInfoTables, register required!"); #endif return false; } @@ -320,7 +320,7 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, !Configuration::getInstance()->supportsETC2() && !Configuration::getInstance()->supportsS3TC() && !Configuration::getInstance()->supportsASTC() && !Configuration::getInstance()->supportsATITC()) { - CCLOG("cocos2d: WARNING: PVRTC/ETC images are not supported"); + AXLOG("cocos2d: WARNING: PVRTC/ETC images are not supported"); return false; } @@ -362,14 +362,14 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, auto convertedFormat = backend::PixelFormatUtils::convertDataToFormat(data, dataLen, oriPixelFormat, renderFormat, &outData, &outDataLen); #ifdef AX_USE_METAL - CCASSERT(convertedFormat == renderFormat, "PixelFormat convert failed!"); + AXASSERT(convertedFormat == renderFormat, "PixelFormat convert failed!"); #endif if (convertedFormat == renderFormat) pixelFormat = renderFormat; } textureDescriptor.textureFormat = pixelFormat; - CCASSERT(textureDescriptor.textureFormat != backend::PixelFormat::NONE, "PixelFormat should not be NONE"); + AXASSERT(textureDescriptor.textureFormat != backend::PixelFormat::NONE, "PixelFormat should not be NONE"); if (_texture->getTextureFormat() != textureDescriptor.textureFormat) _texture->updateTextureDescriptor(textureDescriptor, index); @@ -392,7 +392,7 @@ bool Texture2D::updateWithMipmaps(MipmapInfo* mipmaps, if (i > 0 && (width != height || ccNextPOT(width) != width)) { - CCLOG( + AXLOG( "cocos2d: Texture2D. WARNING. Mipmap level %u is not squared. Texture won't render correctly. width=%d " "!= height=%d", i, width, height); @@ -446,7 +446,7 @@ bool Texture2D::initWithImage(Image* image, backend::PixelFormat format) { if (image == nullptr) { - CCLOG("cocos2d: Texture2D. Can't create Texture. UIImage is nil"); + AXLOG("cocos2d: Texture2D. Can't create Texture. UIImage is nil"); return false; } @@ -515,12 +515,12 @@ bool Texture2D::initWithString(const char* text, const FontDefinition& textDefin } else { - CCASSERT(false, "Not supported alignment format!"); + AXASSERT(false, "Not supported alignment format!"); return false; } #if (AX_TARGET_PLATFORM != AX_PLATFORM_ANDROID) && (AX_TARGET_PLATFORM != AX_PLATFORM_IOS) - CCASSERT(textDefinition._stroke._strokeEnabled == false, "Currently stroke only supported on iOS and Android!"); + AXASSERT(textDefinition._stroke._strokeEnabled == false, "Currently stroke only supported on iOS and Android!"); #endif PixelFormat pixelFormat = g_defaultAlphaPixelFormat; @@ -680,7 +680,7 @@ bool Texture2D::isContain9PatchInfo() const const Rect& Texture2D::getSpriteFrameCapInset(axis::SpriteFrame* spriteFrame) const { - CCASSERT(_ninePatchInfo != nullptr, + AXASSERT(_ninePatchInfo != nullptr, "Can't get the sprite frame capInset when the texture contains no 9-patch info."); if (nullptr == spriteFrame) { @@ -719,7 +719,7 @@ void Texture2D::setTexParameters(const Texture2D::TexParams& desc) void Texture2D::generateMipmap() { - CCASSERT(_pixelsWide == ccNextPOT(_pixelsWide) && _pixelsHigh == ccNextPOT(_pixelsHigh), + AXASSERT(_pixelsWide == ccNextPOT(_pixelsWide) && _pixelsHigh == ccNextPOT(_pixelsHigh), "Mipmap texture only works in POT textures"); _texture->generateMipmaps(); diff --git a/core/renderer/CCTextureAtlas.cpp b/core/renderer/CCTextureAtlas.cpp index 96dfdc64ee..8b26a352aa 100644 --- a/core/renderer/CCTextureAtlas.cpp +++ b/core/renderer/CCTextureAtlas.cpp @@ -51,7 +51,7 @@ TextureAtlas::TextureAtlas() {} TextureAtlas::~TextureAtlas() { - CCLOGINFO("deallocing TextureAtlas: %p", this); + AXLOGINFO("deallocing TextureAtlas: %p", this); AX_SAFE_FREE(_quads); AX_SAFE_FREE(_indices); @@ -134,16 +134,16 @@ bool TextureAtlas::initWithFile(std::string_view file, ssize_t capacity) } else { - CCLOG("cocos2d: Could not open file: %s", file.data()); + AXLOG("cocos2d: Could not open file: %s", file.data()); return false; } } bool TextureAtlas::initWithTexture(Texture2D* texture, ssize_t capacity) { - CCASSERT(capacity >= 0, "Capacity must be >= 0"); + AXASSERT(capacity >= 0, "Capacity must be >= 0"); - // CCASSERT(texture != nullptr, "texture should not be null"); + // AXASSERT(texture != nullptr, "texture should not be null"); _capacity = capacity; _totalQuads = 0; @@ -152,14 +152,14 @@ bool TextureAtlas::initWithTexture(Texture2D* texture, ssize_t capacity) AX_SAFE_RETAIN(_texture); // Re-initialization is not allowed - CCASSERT(_quads == nullptr && _indices == nullptr, "_quads and _indices should be nullptr."); + AXASSERT(_quads == nullptr && _indices == nullptr, "_quads and _indices should be nullptr."); _quads = (V3F_C4B_T2F_Quad*)malloc(_capacity * sizeof(V3F_C4B_T2F_Quad)); _indices = (uint16_t*)malloc(_capacity * 6 * sizeof(uint16_t)); if (!(_quads && _indices) && _capacity > 0) { - // CCLOG("cocos2d: TextureAtlas: not enough memory"); + // AXLOG("cocos2d: TextureAtlas: not enough memory"); AX_SAFE_FREE(_quads); AX_SAFE_FREE(_indices); @@ -206,7 +206,7 @@ void TextureAtlas::setupIndices() void TextureAtlas::updateQuad(V3F_C4B_T2F_Quad* quad, ssize_t index) { - CCASSERT(index >= 0 && index < _capacity, "updateQuadWithTexture: Invalid index"); + AXASSERT(index >= 0 && index < _capacity, "updateQuadWithTexture: Invalid index"); _totalQuads = MAX(index + 1, _totalQuads); @@ -217,10 +217,10 @@ void TextureAtlas::updateQuad(V3F_C4B_T2F_Quad* quad, ssize_t index) void TextureAtlas::insertQuad(V3F_C4B_T2F_Quad* quad, ssize_t index) { - CCASSERT(index >= 0 && index < _capacity, "insertQuadWithTexture: Invalid index"); + AXASSERT(index >= 0 && index < _capacity, "insertQuadWithTexture: Invalid index"); _totalQuads++; - CCASSERT(_totalQuads <= _capacity, "invalid totalQuads"); + AXASSERT(_totalQuads <= _capacity, "invalid totalQuads"); // issue #575. index can be > totalQuads auto remaining = (_totalQuads - 1) - index; @@ -239,11 +239,11 @@ void TextureAtlas::insertQuad(V3F_C4B_T2F_Quad* quad, ssize_t index) void TextureAtlas::insertQuads(V3F_C4B_T2F_Quad* quads, ssize_t index, ssize_t amount) { - CCASSERT(index >= 0 && amount >= 0 && index + amount <= _capacity, "insertQuadWithTexture: Invalid index + amount"); + AXASSERT(index >= 0 && amount >= 0 && index + amount <= _capacity, "insertQuadWithTexture: Invalid index + amount"); _totalQuads += amount; - CCASSERT(_totalQuads <= _capacity, "invalid totalQuads"); + AXASSERT(_totalQuads <= _capacity, "invalid totalQuads"); // issue #575. index can be > totalQuads auto remaining = (_totalQuads - 1) - index - amount; @@ -269,8 +269,8 @@ void TextureAtlas::insertQuads(V3F_C4B_T2F_Quad* quads, ssize_t index, ssize_t a void TextureAtlas::insertQuadFromIndex(ssize_t oldIndex, ssize_t newIndex) { - CCASSERT(newIndex >= 0 && newIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); - CCASSERT(oldIndex >= 0 && oldIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); + AXASSERT(newIndex >= 0 && newIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); + AXASSERT(oldIndex >= 0 && oldIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); if (oldIndex == newIndex) { @@ -297,7 +297,7 @@ void TextureAtlas::insertQuadFromIndex(ssize_t oldIndex, ssize_t newIndex) void TextureAtlas::removeQuadAtIndex(ssize_t index) { - CCASSERT(index >= 0 && index < _totalQuads, "removeQuadAtIndex: Invalid index"); + AXASSERT(index >= 0 && index < _totalQuads, "removeQuadAtIndex: Invalid index"); auto remaining = (_totalQuads - 1) - index; @@ -315,7 +315,7 @@ void TextureAtlas::removeQuadAtIndex(ssize_t index) void TextureAtlas::removeQuadsAtIndex(ssize_t index, ssize_t amount) { - CCASSERT(index >= 0 && amount >= 0 && index + amount <= _totalQuads, + AXASSERT(index >= 0 && amount >= 0 && index + amount <= _totalQuads, "removeQuadAtIndex: index + amount out of bounds"); auto remaining = (_totalQuads) - (index + amount); @@ -338,7 +338,7 @@ void TextureAtlas::removeAllQuads() // TextureAtlas - Resize bool TextureAtlas::resizeCapacity(ssize_t newCapacity) { - CCASSERT(newCapacity >= 0, "capacity >= 0"); + AXASSERT(newCapacity >= 0, "capacity >= 0"); if (newCapacity == _capacity) { return true; @@ -398,7 +398,7 @@ bool TextureAtlas::resizeCapacity(ssize_t newCapacity) if (!(tmpQuads && tmpIndices)) { - CCLOG("cocos2d: TextureAtlas: not enough memory"); + AXLOG("cocos2d: TextureAtlas: not enough memory"); AX_SAFE_FREE(tmpQuads); AX_SAFE_FREE(tmpIndices); AX_SAFE_FREE(_quads); @@ -419,15 +419,15 @@ bool TextureAtlas::resizeCapacity(ssize_t newCapacity) void TextureAtlas::increaseTotalQuadsWith(ssize_t amount) { - CCASSERT(amount >= 0, "amount >= 0"); + AXASSERT(amount >= 0, "amount >= 0"); _totalQuads += amount; } void TextureAtlas::moveQuadsFromIndex(ssize_t oldIndex, ssize_t amount, ssize_t newIndex) { - CCASSERT(oldIndex >= 0 && amount >= 0 && newIndex >= 0, "values must be >= 0"); - CCASSERT(newIndex + amount <= _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); - CCASSERT(oldIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); + AXASSERT(oldIndex >= 0 && amount >= 0 && newIndex >= 0, "values must be >= 0"); + AXASSERT(newIndex + amount <= _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); + AXASSERT(oldIndex < _totalQuads, "insertQuadFromIndex:atIndex: Invalid index"); if (oldIndex == newIndex) { @@ -457,15 +457,15 @@ void TextureAtlas::moveQuadsFromIndex(ssize_t oldIndex, ssize_t amount, ssize_t void TextureAtlas::moveQuadsFromIndex(ssize_t index, ssize_t newIndex) { - CCASSERT(index >= 0 && newIndex >= 0, "values must be >= 0"); - CCASSERT(newIndex + (_totalQuads - index) <= _capacity, "moveQuadsFromIndex move is out of bounds"); + AXASSERT(index >= 0 && newIndex >= 0, "values must be >= 0"); + AXASSERT(newIndex + (_totalQuads - index) <= _capacity, "moveQuadsFromIndex move is out of bounds"); memmove(_quads + newIndex, _quads + index, (_totalQuads - index) * sizeof(_quads[0])); } void TextureAtlas::fillWithEmptyQuadsFromIndex(ssize_t index, ssize_t amount) { - CCASSERT(index >= 0 && amount >= 0, "values must be >= 0"); + AXASSERT(index >= 0 && amount >= 0, "values must be >= 0"); V3F_C4B_T2F_Quad quad; memset(&quad, 0, sizeof(quad)); diff --git a/core/renderer/CCTextureCache.cpp b/core/renderer/CCTextureCache.cpp index cbf6aad4dc..89dbf28020 100644 --- a/core/renderer/CCTextureCache.cpp +++ b/core/renderer/CCTextureCache.cpp @@ -67,7 +67,7 @@ TextureCache::TextureCache() : _loadingThread(nullptr), _needQuit(false), _async TextureCache::~TextureCache() { - CCLOGINFO("deallocing TextureCache: %p", this); + AXLOGINFO("deallocing TextureCache: %p", this); for (auto& texture : _textures) texture.second->release(); @@ -362,7 +362,7 @@ void TextureCache::addImageAsyncCallBack(float /*dt*/) else { texture = nullptr; - CCLOG("cocos2d: failed to call TextureCache::addImageAsync(%s)", asyncStruct->filename.c_str()); + AXLOG("cocos2d: failed to call TextureCache::addImageAsync(%s)", asyncStruct->filename.c_str()); } } @@ -445,7 +445,7 @@ Texture2D* TextureCache::addImage(std::string_view path, PixelFormat format) } else { - CCLOG("cocos2d: Couldn't create texture for file:%s in TextureCache", path.data()); + AXLOG("cocos2d: Couldn't create texture for file:%s in TextureCache", path.data()); AX_SAFE_RELEASE(texture); texture = nullptr; } @@ -474,8 +474,8 @@ Texture2D* TextureCache::addImage(Image* image, std::string_view key) Texture2D* TextureCache::addImage(Image* image, std::string_view key, PixelFormat format) { - CCASSERT(image != nullptr, "TextureCache: image MUST not be nil"); - CCASSERT(image->getData() != nullptr, "TextureCache: image MUST not be nil"); + AXASSERT(image != nullptr, "TextureCache: image MUST not be nil"); + AXASSERT(image->getData() != nullptr, "TextureCache: image MUST not be nil"); Texture2D* texture = nullptr; @@ -497,7 +497,7 @@ Texture2D* TextureCache::addImage(Image* image, std::string_view key, PixelForma { AX_SAFE_RELEASE(texture); texture = nullptr; - CCLOG("cocos2d: initWithImage failed!"); + AXLOG("cocos2d: initWithImage failed!"); } } while (0); @@ -565,7 +565,7 @@ void TextureCache::removeUnusedTextures() Texture2D* tex = it->second; if (tex->getReferenceCount() == 1) { - CCLOG("cocos2d: TextureCache: removing unused texture: %s", it->first.c_str()); + AXLOG("cocos2d: TextureCache: removing unused texture: %s", it->first.c_str()); tex->release(); it = _textures.erase(it); @@ -831,7 +831,7 @@ void VolatileTextureMgr::removeTexture(Texture2D* t) void VolatileTextureMgr::reloadAllTextures() { _isReloading = true; - CCLOG("reload all texture"); + AXLOG("reload all texture"); for (auto& texture : _textures) { diff --git a/core/renderer/CCTextureCache.h b/core/renderer/CCTextureCache.h index c0f31d3e2b..622082bf35 100644 --- a/core/renderer/CCTextureCache.h +++ b/core/renderer/CCTextureCache.h @@ -176,7 +176,7 @@ public: */ void removeTextureForKey(std::string_view key); - /** Output to CCLOG the current contents of this TextureCache. + /** Output to AXLOG the current contents of this TextureCache. * This will attempt to calculate the size of each texture, and the total texture memory in use. * * @since v1.0 diff --git a/core/renderer/CCTextureCube.cpp b/core/renderer/CCTextureCube.cpp index c22c58f6ee..afc0b24cb7 100644 --- a/core/renderer/CCTextureCube.cpp +++ b/core/renderer/CCTextureCube.cpp @@ -198,12 +198,12 @@ bool TextureCube::init(std::string_view positive_x, Image* img = images[i]; if (img->getWidth() != img->getHeight()) { - CCASSERT(false, "TextureCubemap: width should be equal to height!"); + AXASSERT(false, "TextureCubemap: width should be equal to height!"); return false; } if (imageSize != img->getWidth()) { - CCASSERT(imageSize == img->getWidth(), "TextureCubmap: texture of each face should have same dimension"); + AXASSERT(imageSize == img->getWidth(), "TextureCubmap: texture of each face should have same dimension"); return false; } } @@ -217,7 +217,7 @@ bool TextureCube::init(std::string_view positive_x, textureDescriptor.samplerDescriptor.tAddressMode = backend::SamplerAddressMode::CLAMP_TO_EDGE; _texture = static_cast(backend::Device::getInstance()->newTexture(textureDescriptor)); - CCASSERT(_texture != nullptr, "TextureCubemap: texture can not be nullptr"); + AXASSERT(_texture != nullptr, "TextureCubemap: texture can not be nullptr"); for (int i = 0; i < 6; i++) { @@ -240,7 +240,7 @@ bool TextureCube::init(std::string_view positive_x, } else { - CCASSERT(false, + AXASSERT(false, "error: CubeMap texture may be incorrect, failed to convert pixel format data to RGBA8888"); } } diff --git a/core/renderer/CCTrianglesCommand.cpp b/core/renderer/CCTrianglesCommand.cpp index bbe3a2575d..cec03ff61e 100644 --- a/core/renderer/CCTrianglesCommand.cpp +++ b/core/renderer/CCTrianglesCommand.cpp @@ -49,7 +49,7 @@ void TrianglesCommand::init(float globalOrder, { unsigned int count = _triangles.indexCount; _triangles.indexCount = count / 3 * 3; - CCLOGERROR("Resize indexCount from %d to %d, size must be multiple times of 3", count, _triangles.indexCount); + AXLOGERROR("Resize indexCount from %d to %d, size must be multiple times of 3", count, _triangles.indexCount); } _mv = mv; diff --git a/core/renderer/backend/PixelFormatUtils.cpp b/core/renderer/backend/PixelFormatUtils.cpp index 6f9b4bac5c..6c485b436f 100644 --- a/core/renderer/backend/PixelFormatUtils.cpp +++ b/core/renderer/backend/PixelFormatUtils.cpp @@ -542,7 +542,7 @@ axis::backend::PixelFormat convertL8ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::L8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::L8 to format ID:%d, we will use it's origin format " "PixelFormat::L8", static_cast(format)); @@ -603,7 +603,7 @@ axis::backend::PixelFormat convertLA8ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::LA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::LA8 to format ID:%d, we will use it's origin format " "PixelFormat::LA8", static_cast(format)); @@ -664,7 +664,7 @@ axis::backend::PixelFormat convertRGB8ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGB8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::RGB8 to format ID:%d, we will use it's origin format " "PixelFormat::RGB8", static_cast(format)); @@ -725,7 +725,7 @@ axis::backend::PixelFormat convertRGBA8ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGBA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::RGBA8 to format ID:%d, we will use it's origin format " "PixelFormat::RGBA8", static_cast(format)); @@ -760,7 +760,7 @@ axis::backend::PixelFormat convertRGB5A1ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGBA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::RGB5A1 to format ID:%d, we will use it's origin format " "PixelFormat::RGB51A", static_cast(format)); @@ -794,7 +794,7 @@ axis::backend::PixelFormat convertRGB565ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGBA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::RGB565 to format ID:%d, we will use it's origin format " "PixelFormat::RGB565", static_cast(format)); @@ -824,7 +824,7 @@ axis::backend::PixelFormat convertA8ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGBA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::A8 to format ID:%d, we will use it's origin format " "PixelFormat::A8", static_cast(format)); @@ -858,7 +858,7 @@ axis::backend::PixelFormat convertRGBA4ToFormat(const unsigned char* data, // unsupported conversion or don't need to convert if (format != PixelFormat::RGBA8) { - CCLOG( + AXLOG( "Can not convert image format PixelFormat::RGBA444 to format ID:%d, we will use it's origin format " "PixelFormat::RGBA4", static_cast(format)); @@ -944,7 +944,7 @@ axis::backend::PixelFormat convertDataToFormat(const unsigned char* data, case PixelFormat::BGRA8: return convertBGRA8ToFormat(data, dataLen, format, outData, outDataLen); default: - CCLOG("unsupported conversion from format %d to format %d", static_cast(originFormat), + AXLOG("unsupported conversion from format %d to format %d", static_cast(originFormat), static_cast(format)); *outData = (unsigned char*)data; *outDataLen = dataLen; diff --git a/core/renderer/backend/ProgramCache.cpp b/core/renderer/backend/ProgramCache.cpp index 080b3a3684..6bbab6af69 100644 --- a/core/renderer/backend/ProgramCache.cpp +++ b/core/renderer/backend/ProgramCache.cpp @@ -75,7 +75,7 @@ ProgramCache::~ProgramCache() { AX_SAFE_RELEASE(program.second); } - CCLOGINFO("deallocing ProgramCache: %p", this); + AXLOGINFO("deallocing ProgramCache: %p", this); ShaderCache::destroyInstance(); } @@ -241,7 +241,7 @@ void ProgramCache::removeUnusedProgram() auto program = iter->second; if (program->getReferenceCount() == 1) { - // CCLOG("cocos2d: TextureCache: removing unused program"); + // AXLOG("cocos2d: TextureCache: removing unused program"); program->release(); iter = _cachedPrograms.erase(iter); } diff --git a/core/renderer/backend/ShaderCache.cpp b/core/renderer/backend/ShaderCache.cpp index a84c150626..ae89046f08 100644 --- a/core/renderer/backend/ShaderCache.cpp +++ b/core/renderer/backend/ShaderCache.cpp @@ -54,7 +54,7 @@ ShaderCache::~ShaderCache() { AX_SAFE_RELEASE(shaderModule.second); } - CCLOGINFO("deallocing ProgramCache: %p", this); + AXLOGINFO("deallocing ProgramCache: %p", this); } bool ShaderCache::init() @@ -95,7 +95,7 @@ void ShaderCache::removeUnusedShader() auto shaderModule = iter->second; if (shaderModule->getReferenceCount() == 1) { - // CCLOG("cocos2d: TextureCache: removing unused program"); + // AXLOG("cocos2d: TextureCache: removing unused program"); shaderModule->release(); iter = _cachedShaders.erase(iter); } diff --git a/core/renderer/backend/metal/DeviceMTL.mm b/core/renderer/backend/metal/DeviceMTL.mm index e993f6f2e0..18cc1fa276 100644 --- a/core/renderer/backend/metal/DeviceMTL.mm +++ b/core/renderer/backend/metal/DeviceMTL.mm @@ -104,7 +104,7 @@ TextureBackend* DeviceMTL::newTexture(const TextureDescriptor& descriptor) case TextureType::TEXTURE_CUBE: return new TextureCubeMTL(_mtlDevice, descriptor); default: - CCASSERT(false, "invalidate texture type"); + AXASSERT(false, "invalidate texture type"); return nullptr; } } diff --git a/core/renderer/backend/metal/ProgramMTL.mm b/core/renderer/backend/metal/ProgramMTL.mm index 5ff5330dd4..4f1b651501 100644 --- a/core/renderer/backend/metal/ProgramMTL.mm +++ b/core/renderer/backend/metal/ProgramMTL.mm @@ -132,7 +132,7 @@ const hlookup::string_map ProgramMTL::getActiveAttributes() c // case ShaderStage::FRAGMENT: // return _fragmentShader->cloneUniformBuffer(); // default: -// CCASSERT(false, "Invalid shader stage."); +// AXASSERT(false, "Invalid shader stage."); // break; // } // } @@ -146,7 +146,7 @@ const UniformInfo& ProgramMTL::getActiveUniformInfo(ShaderStage stage, int locat case ShaderStage::FRAGMENT: return _fragmentShader->getActiveUniform(location); default: - CCASSERT(false, "Invalid shader stage."); + AXASSERT(false, "Invalid shader stage."); break; } } @@ -160,7 +160,7 @@ std::size_t ProgramMTL::getUniformBufferSize(ShaderStage stage) const case ShaderStage::FRAGMENT: return _fragmentShader->getUniformBufferSize(); default: - CCASSERT(false, "Invalid shader stage."); + AXASSERT(false, "Invalid shader stage."); break; } return 0; @@ -175,7 +175,7 @@ const hlookup::string_map& ProgramMTL::getAllActiveUniformInfo(Shad case ShaderStage::FRAGMENT: return _fragmentShader->getAllActiveUniformInfo(); default: - CCASSERT(false, "Invalid shader stage."); + AXASSERT(false, "Invalid shader stage."); } } diff --git a/core/renderer/backend/metal/TextureMTL.mm b/core/renderer/backend/metal/TextureMTL.mm index 479f88851a..11f5bda20a 100644 --- a/core/renderer/backend/metal/TextureMTL.mm +++ b/core/renderer/backend/metal/TextureMTL.mm @@ -48,7 +48,7 @@ MTLSamplerAddressMode toMTLSamplerAddressMode(SamplerAddressMode mode) ret = MTLSamplerAddressModeClampToEdge; break; default: - CCASSERT(false, "Not supported sampler address mode!"); + AXASSERT(false, "Not supported sampler address mode!"); break; } return ret; diff --git a/core/renderer/backend/opengl/BufferGL.cpp b/core/renderer/backend/opengl/BufferGL.cpp index f542bdb77c..a2e574f9a9 100644 --- a/core/renderer/backend/opengl/BufferGL.cpp +++ b/core/renderer/backend/opengl/BufferGL.cpp @@ -130,8 +130,8 @@ void BufferGL::updateData(void* data, std::size_t size) void BufferGL::updateSubData(void* data, std::size_t offset, std::size_t size) { - CCASSERT(_bufferAllocated != 0, "updateData should be invoke before updateSubData"); - CCASSERT(offset + size <= _bufferAllocated, "buffer size overflow"); + AXASSERT(_bufferAllocated != 0, "updateData should be invoke before updateSubData"); + AXASSERT(offset + size <= _bufferAllocated, "buffer size overflow"); if (_buffer) { diff --git a/core/renderer/backend/opengl/CommandBufferGL.cpp b/core/renderer/backend/opengl/CommandBufferGL.cpp index f1be71681a..5871fc61ef 100644 --- a/core/renderer/backend/opengl/CommandBufferGL.cpp +++ b/core/renderer/backend/opengl/CommandBufferGL.cpp @@ -418,7 +418,7 @@ void CommandBufferGL::setUniform(bool isArray, GLuint location, unsigned int siz break; default: - CCASSERT(false, "invalidate Uniform data type"); + AXASSERT(false, "invalidate Uniform data type"); break; } } diff --git a/core/renderer/backend/opengl/MacrosGL.h b/core/renderer/backend/opengl/MacrosGL.h index fed49a33c9..8e6f623d09 100644 --- a/core/renderer/backend/opengl/MacrosGL.h +++ b/core/renderer/backend/opengl/MacrosGL.h @@ -26,7 +26,7 @@ #include "base/ccMacros.h" -#if !defined(COCOS2D_DEBUG) || COCOS2D_DEBUG == 0 +#if !defined(AXIS_DEBUG) || AXIS_DEBUG == 0 # define CHECK_GL_ERROR_DEBUG() #else # define CHECK_GL_ERROR_DEBUG() \ diff --git a/core/renderer/backend/opengl/ProgramGL.cpp b/core/renderer/backend/opengl/ProgramGL.cpp index 618849ea38..72cda1c283 100644 --- a/core/renderer/backend/opengl/ProgramGL.cpp +++ b/core/renderer/backend/opengl/ProgramGL.cpp @@ -203,7 +203,7 @@ bool ProgramGL::getAttributeLocation(std::string_view attributeName, unsigned in GLint loc = glGetAttribLocation(_program, attributeName.data()); if (-1 == loc) { - CCLOG("Cocos2d: %s: can not find vertex attribute of %s", __FUNCTION__, attributeName.data()); + AXLOG("Cocos2d: %s: can not find vertex attribute of %s", __FUNCTION__, attributeName.data()); return false; } diff --git a/core/renderer/backend/opengl/ShaderModuleGL.cpp b/core/renderer/backend/opengl/ShaderModuleGL.cpp index afbe54b52b..8c9716dcd5 100644 --- a/core/renderer/backend/opengl/ShaderModuleGL.cpp +++ b/core/renderer/backend/opengl/ShaderModuleGL.cpp @@ -72,7 +72,7 @@ void ShaderModuleGL::compileShader(ShaderStage stage, std::string_view source) } deleteShader(); - CCASSERT(false, "Shader compile failed!"); + AXASSERT(false, "Shader compile failed!"); } } diff --git a/core/renderer/backend/opengl/UtilsGL.cpp b/core/renderer/backend/opengl/UtilsGL.cpp index 19f48e4ce1..4039a5d9fe 100644 --- a/core/renderer/backend/opengl/UtilsGL.cpp +++ b/core/renderer/backend/opengl/UtilsGL.cpp @@ -230,7 +230,7 @@ GLint UtilsGL::toGLMinFilter(SamplerFilter minFilter, bool hasMipmaps, bool isPo { if (hasMipmaps && !isPow2) { - CCLOG("Change minification filter to either NEAREST or LINEAR since non-power-of-two texture occur in %s %s %d", + AXLOG("Change minification filter to either NEAREST or LINEAR since non-power-of-two texture occur in %s %s %d", __FILE__, __FUNCTION__, __LINE__); if (SamplerFilter::LINEAR == minFilter) return GL_LINEAR; @@ -264,7 +264,7 @@ GLint UtilsGL::toGLAddressMode(SamplerAddressMode addressMode, bool isPow2) GLint ret = GL_REPEAT; if (!isPow2 && (addressMode != SamplerAddressMode::CLAMP_TO_EDGE)) { - CCLOG("Change texture wrap mode to CLAMP_TO_EDGE since non-power-of-two texture occur in %s %s %d", __FILE__, + AXLOG("Change texture wrap mode to CLAMP_TO_EDGE since non-power-of-two texture occur in %s %s %d", __FILE__, __FUNCTION__, __LINE__); return GL_CLAMP_TO_EDGE; } diff --git a/core/ui/UIEditBox/Mac/CCUIEditBoxMac.mm b/core/ui/UIEditBox/Mac/CCUIEditBoxMac.mm index c7bfa40ec4..5ac60cb3bb 100644 --- a/core/ui/UIEditBox/Mac/CCUIEditBoxMac.mm +++ b/core/ui/UIEditBox/Mac/CCUIEditBoxMac.mm @@ -248,19 +248,19 @@ self.dataInputMode = inputFlag; break; case axis::ui::EditBox::InputFlag::INITIAL_CAPS_WORD: - CCLOG("INITIAL_CAPS_WORD not implemented"); + AXLOG("INITIAL_CAPS_WORD not implemented"); break; case axis::ui::EditBox::InputFlag::INITIAL_CAPS_SENTENCE: - CCLOG("INITIAL_CAPS_SENTENCE not implemented"); + AXLOG("INITIAL_CAPS_SENTENCE not implemented"); break; case axis::ui::EditBox::InputFlag::INITIAL_CAPS_ALL_CHARACTERS: - CCLOG("INITIAL_CAPS_ALL_CHARACTERS not implemented"); + AXLOG("INITIAL_CAPS_ALL_CHARACTERS not implemented"); break; case axis::ui::EditBox::InputFlag::SENSITIVE: - CCLOG("SENSITIVE not implemented"); + AXLOG("SENSITIVE not implemented"); break; case axis::ui::EditBox::InputFlag::LOWERCASE_ALL_CHARACTERS: - CCLOG("LOWERCASE_ALL_CHARACTERS not implemented"); + AXLOG("LOWERCASE_ALL_CHARACTERS not implemented"); break; default: break; @@ -269,7 +269,7 @@ - (void)setReturnType:(axis::ui::EditBox::KeyboardReturnType)returnType { - CCLOG("setReturnType not implemented"); + AXLOG("setReturnType not implemented"); } - (void)setTextHorizontalAlignment:(axis::TextHAlignment)alignment diff --git a/core/ui/UIEditBox/UIEditBox.cpp b/core/ui/UIEditBox/UIEditBox.cpp index 24ef528813..93ec6af703 100644 --- a/core/ui/UIEditBox/UIEditBox.cpp +++ b/core/ui/UIEditBox/UIEditBox.cpp @@ -452,7 +452,7 @@ const char* EditBox::getText() const void EditBox::setFont(const char* pFontName, int fontSize) { - CCASSERT(pFontName != nullptr, "fontName can't be nullptr"); + AXASSERT(pFontName != nullptr, "fontName can't be nullptr"); if (pFontName != nullptr) { if (_editBoxImpl != nullptr) @@ -464,7 +464,7 @@ void EditBox::setFont(const char* pFontName, int fontSize) void EditBox::setFontName(const char* pFontName) { - CCASSERT(pFontName != nullptr, "fontName can't be nullptr"); + AXASSERT(pFontName != nullptr, "fontName can't be nullptr"); if (_editBoxImpl != nullptr) { _editBoxImpl->setFont(pFontName, _editBoxImpl->getFontSize()); @@ -520,7 +520,7 @@ const Color4B& EditBox::getFontColor() const void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) { - CCASSERT(pFontName != nullptr, "fontName can't be nullptr"); + AXASSERT(pFontName != nullptr, "fontName can't be nullptr"); if (pFontName != nullptr) { if (_editBoxImpl != nullptr) @@ -532,7 +532,7 @@ void EditBox::setPlaceholderFont(const char* pFontName, int fontSize) void EditBox::setPlaceholderFontName(const char* pFontName) { - CCASSERT(pFontName != nullptr, "fontName can't be nullptr"); + AXASSERT(pFontName != nullptr, "fontName can't be nullptr"); if (_editBoxImpl != nullptr) { _editBoxImpl->setPlaceholderFont(pFontName, _editBoxImpl->getPlaceholderFontSize()); @@ -829,7 +829,7 @@ static Rect getRect(Node* pNode) void EditBox::keyboardWillShow(IMEKeyboardNotificationInfo& info) { - // CCLOG("CCEditBox::keyboardWillShow"); + // AXLOG("CCEditBox::keyboardWillShow"); Rect rectTracked = getRect(this); // some adjustment for margin between the keyboard and the edit box. rectTracked.origin.y -= 4; @@ -837,13 +837,13 @@ void EditBox::keyboardWillShow(IMEKeyboardNotificationInfo& info) // if the keyboard area doesn't intersect with the tracking node area, nothing needs to be done. if (!rectTracked.intersectsRect(info.end)) { - CCLOG("needn't to adjust view layout."); + AXLOG("needn't to adjust view layout."); return; } // assume keyboard at the bottom of screen, calculate the vertical adjustment. _adjustHeight = info.end.getMaxY() - rectTracked.getMinY(); - // CCLOG("CCEditBox:needAdjustVerticalPosition(%f)", _adjustHeight); + // AXLOG("CCEditBox:needAdjustVerticalPosition(%f)", _adjustHeight); if (_editBoxImpl != nullptr) { @@ -855,7 +855,7 @@ void EditBox::keyboardDidShow(IMEKeyboardNotificationInfo& /*info*/) {} void EditBox::keyboardWillHide(IMEKeyboardNotificationInfo& info) { - // CCLOG("CCEditBox::keyboardWillHide"); + // AXLOG("CCEditBox::keyboardWillHide"); if (_editBoxImpl != nullptr) { _editBoxImpl->doAnimationWhenKeyboardMove(info.duration, -_adjustHeight); diff --git a/core/ui/UIEditBox/UIEditBoxImpl-android.cpp b/core/ui/UIEditBox/UIEditBoxImpl-android.cpp index d348b9e953..38083277f5 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-android.cpp +++ b/core/ui/UIEditBox/UIEditBoxImpl-android.cpp @@ -142,7 +142,7 @@ void EditBoxImplAndroid::setNativeFontColor(const Color4B& color) void EditBoxImplAndroid::setNativePlaceholderFont(const char* pFontName, int fontSize) { - CCLOG("Warning! You can't change Android Hint fontName and fontSize"); + AXLOG("Warning! You can't change Android Hint fontName and fontSize"); } void EditBoxImplAndroid::setNativePlaceholderFontColor(const Color4B& color) diff --git a/core/ui/UIEditBox/UIEditBoxImpl-common.cpp b/core/ui/UIEditBox/UIEditBoxImpl-common.cpp index 24aef5d2e5..7b0c9c0c4c 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-common.cpp +++ b/core/ui/UIEditBox/UIEditBoxImpl-common.cpp @@ -295,7 +295,7 @@ void EditBoxImplCommon::setVisible(bool visible) void EditBoxImplCommon::setContentSize(const Vec2& size) { _contentSize = applyPadding(size); - CCLOG("[Edit text] content size = (%f, %f)", _contentSize.width, _contentSize.height); + AXLOG("[Edit text] content size = (%f, %f)", _contentSize.width, _contentSize.height); placeInactiveLabels(_contentSize); } diff --git a/core/ui/UIEditBox/UIEditBoxImpl-ios.mm b/core/ui/UIEditBox/UIEditBoxImpl-ios.mm index 934f895845..8f240c28f9 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-ios.mm +++ b/core/ui/UIEditBox/UIEditBoxImpl-ios.mm @@ -207,7 +207,7 @@ void EditBoxImplIOS::nativeCloseKeyboard() UIFont* EditBoxImplIOS::constructFont(const char* fontName, int fontSize) { - CCASSERT(fontName != nullptr, "fontName can't be nullptr"); + AXASSERT(fontName != nullptr, "fontName can't be nullptr"); CCEAGLView* eaglview = static_cast(axis::Director::getInstance()->getOpenGLView()->getEAGLView()); float retinaFactor = eaglview.contentScaleFactor; NSString* fntName = [NSString stringWithUTF8String:fontName]; diff --git a/core/ui/UIEditBox/UIEditBoxImpl-linux.cpp b/core/ui/UIEditBox/UIEditBoxImpl-linux.cpp index d9f40229c1..84feabfecb 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-linux.cpp +++ b/core/ui/UIEditBox/UIEditBoxImpl-linux.cpp @@ -69,7 +69,7 @@ bool LinuxInputBox(std::string& entryLine) didChange = true; break; default: - // CCLOG("Undefined. Perhaps dialog was closed"); + // AXLOG("Undefined. Perhaps dialog was closed"); break; } diff --git a/core/ui/UIEditBox/UIEditBoxImpl-mac.mm b/core/ui/UIEditBox/UIEditBoxImpl-mac.mm index 3cb0fed134..cee4c299d0 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-mac.mm +++ b/core/ui/UIEditBox/UIEditBoxImpl-mac.mm @@ -117,7 +117,7 @@ void EditBoxImplMac::setNativePlaceholderFont(const char* pFontName, int fontSiz if (!textFont) { - CCLOGWARN("Font not found: %s", pFontName); + AXLOGWARN("Font not found: %s", pFontName); return; } [_sysEdit setPlaceholderFont:textFont]; diff --git a/core/ui/UIEditBox/UIEditBoxImpl-win32.cpp b/core/ui/UIEditBox/UIEditBoxImpl-win32.cpp index ba44c86764..46d203c238 100644 --- a/core/ui/UIEditBox/UIEditBoxImpl-win32.cpp +++ b/core/ui/UIEditBox/UIEditBoxImpl-win32.cpp @@ -376,7 +376,7 @@ std::string EditBoxImplWin::getText() const bool conversionResult = axis::StringUtils::UTF16ToUTF8(wstrResult, utf8Result); if (!conversionResult) { - CCLOG("warning, editbox input text conversion error."); + AXLOG("warning, editbox input text conversion error."); } return std::move(utf8Result); } diff --git a/core/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm b/core/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm index 318ddc2f4f..fc1cf00165 100644 --- a/core/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm +++ b/core/ui/UIEditBox/iOS/CCUIEditBoxIOS.mm @@ -371,7 +371,7 @@ - (BOOL)textViewShouldBeginEditing:(UITextView*)textView { - CCLOG("textFieldShouldBeginEditing..."); + AXLOG("textFieldShouldBeginEditing..."); _editState = YES; _returnPressed = NO; @@ -389,7 +389,7 @@ - (BOOL)textViewShouldEndEditing:(UITextView*)textView { - CCLOG("textFieldShouldEndEditing..."); + AXLOG("textFieldShouldEndEditing..."); _editState = NO; getEditBoxImplIOS()->refreshInactiveText(); @@ -464,7 +464,7 @@ - (BOOL)textFieldShouldBeginEditing:(UITextField*)sender // return NO to disallow editing. { - CCLOG("textFieldShouldBeginEditing..."); + AXLOG("textFieldShouldBeginEditing..."); _editState = YES; _returnPressed = NO; @@ -482,7 +482,7 @@ - (BOOL)textFieldShouldEndEditing:(UITextField*)sender { - CCLOG("textFieldShouldEndEditing..."); + AXLOG("textFieldShouldEndEditing..."); _editState = NO; const char* inputText = [sender.text UTF8String]; diff --git a/core/ui/UIHelper.cpp b/core/ui/UIHelper.cpp index 5bfe2d507d..008506fdc8 100644 --- a/core/ui/UIHelper.cpp +++ b/core/ui/UIHelper.cpp @@ -123,18 +123,18 @@ std::string Helper::getSubStringOfUTF8String(std::string_view str, std::u32string utf32; if (!StringUtils::UTF8ToUTF32(str, utf32)) { - CCLOGERROR("Can't convert string to UTF-32: %s", str.data()); + AXLOGERROR("Can't convert string to UTF-32: %s", str.data()); return ""; } if (utf32.size() < start) { - CCLOGERROR("'start' is out of range: %d, %s", static_cast(start), str.data()); + AXLOGERROR("'start' is out of range: %d, %s", static_cast(start), str.data()); return ""; } std::string result; if (!StringUtils::UTF32ToUTF8(utf32.substr(start, length), result)) { - CCLOGERROR("Can't convert internal UTF-32 string to UTF-8: %s", str.data()); + AXLOGERROR("Can't convert internal UTF-32 string to UTF-8: %s", str.data()); return ""; } return result; diff --git a/core/ui/UIImageView.cpp b/core/ui/UIImageView.cpp index de5c3cc1ca..e74049d803 100644 --- a/core/ui/UIImageView.cpp +++ b/core/ui/UIImageView.cpp @@ -170,7 +170,7 @@ void ImageView::setTextureRect(const Rect& rect) } else { - CCLOG("Warning!! you should load texture before set the texture's rect!"); + AXLOG("Warning!! you should load texture before set the texture's rect!"); } } } diff --git a/core/ui/UILayout.cpp b/core/ui/UILayout.cpp index 89b01ae7c1..d5c98781b5 100644 --- a/core/ui/UILayout.cpp +++ b/core/ui/UILayout.cpp @@ -1065,7 +1065,7 @@ Vec2 Layout::getWorldCenterPoint(Widget* widget) const Layout* layout = dynamic_cast(widget); // FIXEDME: we don't need to calculate the content size of layout anymore Vec2 widgetSize = layout ? layout->getLayoutAccumulatedSize() : widget->getContentSize(); - // CCLOG("content size : width = %f, height = %f", widgetSize.width, widgetSize.height); + // AXLOG("content size : width = %f, height = %f", widgetSize.width, widgetSize.height); return widget->convertToWorldSpace(Vec2(widgetSize.width / 2, widgetSize.height / 2)); } @@ -1154,7 +1154,7 @@ int Layout::findFirstFocusEnabledWidgetIndex() } index++; } - CCASSERT(0, "invalid operation"); + AXASSERT(0, "invalid operation"); return 0; } @@ -1201,7 +1201,7 @@ int Layout::findNearestChildWidgetIndex(FocusDirection direction, Widget* baseWi return found; } - CCASSERT(0, "invalid focus direction!!!"); + AXASSERT(0, "invalid focus direction!!!"); return 0; } @@ -1248,7 +1248,7 @@ int Layout::findFarthestChildWidgetIndex(FocusDirection direction, axis::ui::Wid return found; } - CCASSERT(0, "invalid focus direction!!!"); + AXASSERT(0, "invalid focus direction!!!"); return 0; } @@ -1354,7 +1354,7 @@ void Layout::findProperSearchingFunctor(FocusDirection dir, Widget* baseWidget) } else { - CCASSERT(0, "invalid direction!"); + AXASSERT(0, "invalid direction!"); } } @@ -1708,7 +1708,7 @@ bool Layout::isLastWidgetInContainer(Widget* widget, FocusDirection direction) c } else { - CCASSERT(0, "invalid layout Type"); + AXASSERT(0, "invalid layout Type"); return false; } @@ -1749,7 +1749,7 @@ bool Layout::isWidgetAncestorSupportLoopFocus(Widget* widget, FocusDirection dir } else { - CCASSERT(0, "invalid layout type"); + AXASSERT(0, "invalid layout type"); return false; } } @@ -1822,7 +1822,7 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current) break; default: { - CCASSERT(0, "Invalid Focus Direction"); + AXASSERT(0, "Invalid Focus Direction"); return current; } break; @@ -1861,7 +1861,7 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current) break; default: { - CCASSERT(0, "Invalid Focus Direction"); + AXASSERT(0, "Invalid Focus Direction"); return current; } break; @@ -1869,7 +1869,7 @@ Widget* Layout::findNextFocusedWidget(FocusDirection direction, Widget* current) } else { - CCASSERT(0, "Un Supported Layout type, please use VBox and HBox instead!!!"); + AXASSERT(0, "Un Supported Layout type, please use VBox and HBox instead!!!"); return current; } } diff --git a/core/ui/UIListView.cpp b/core/ui/UIListView.cpp index 0883a6d8e6..f693b587ce 100644 --- a/core/ui/UIListView.cpp +++ b/core/ui/UIListView.cpp @@ -85,7 +85,7 @@ void ListView::setItemModel(Widget* model) { if (nullptr == model) { - CCLOG("Can't set a nullptr to item model!"); + AXLOG("Can't set a nullptr to item model!"); return; } AX_SAFE_RELEASE_NULL(_model); @@ -145,7 +145,7 @@ void ListView::updateInnerContainerSize() void ListView::remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex) { - CCASSERT(nullptr != layoutParameter, "Layout parameter can't be nullptr!"); + AXASSERT(nullptr != layoutParameter, "Layout parameter can't be nullptr!"); switch (_gravity) { @@ -178,7 +178,7 @@ void ListView::remedyVerticalLayoutParameter(LinearLayoutParameter* layoutParame void ListView::remedyHorizontalLayoutParameter(LinearLayoutParameter* layoutParameter, ssize_t itemIndex) { - CCASSERT(nullptr != layoutParameter, "Layout parameter can't be nullptr!"); + AXASSERT(nullptr != layoutParameter, "Layout parameter can't be nullptr!"); switch (_gravity) { @@ -210,7 +210,7 @@ void ListView::remedyHorizontalLayoutParameter(LinearLayoutParameter* layoutPara void ListView::remedyLayoutParameter(Widget* item) { - CCASSERT(nullptr != item, "ListView Item can't be nullptr!"); + AXASSERT(nullptr != item, "ListView Item can't be nullptr!"); LinearLayoutParameter* linearLayoutParameter = (LinearLayoutParameter*)(item->getLayoutParameter()); bool isLayoutParameterExists = true; @@ -657,7 +657,7 @@ static Widget* findClosestItem(const Vec2& targetPosition, ssize_t lastIndex, float distanceFromLast) { - CCASSERT(firstIndex >= 0 && lastIndex < items.size() && firstIndex <= lastIndex, ""); + AXASSERT(firstIndex >= 0 && lastIndex < items.size() && firstIndex <= lastIndex, ""); if (firstIndex == lastIndex) { return items.at(firstIndex); diff --git a/core/ui/UIPageView.cpp b/core/ui/UIPageView.cpp index 4eb6f6161e..ec9b724dd6 100644 --- a/core/ui/UIPageView.cpp +++ b/core/ui/UIPageView.cpp @@ -377,7 +377,7 @@ void PageView::setIndicatorPosition(const Vec2& position) const Vec2& PageView::getIndicatorPosition() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getPosition(); } @@ -390,7 +390,7 @@ void PageView::setIndicatorSpaceBetweenIndexNodes(float spaceBetweenIndexNodes) } float PageView::getIndicatorSpaceBetweenIndexNodes() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getSpaceBetweenIndexNodes(); } @@ -404,7 +404,7 @@ void PageView::setIndicatorSelectedIndexColor(const Color3B& color) const Color3B& PageView::getIndicatorSelectedIndexColor() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getSelectedIndexColor(); } @@ -418,7 +418,7 @@ void PageView::setIndicatorIndexNodesColor(const Color3B& color) const Color3B& PageView::getIndicatorIndexNodesColor() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getIndexNodesColor(); } @@ -432,7 +432,7 @@ void PageView::setIndicatorSelectedIndexOpacity(uint8_t opacity) uint8_t PageView::getIndicatorSelectedIndexOpacity() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getSelectedIndexOpacity(); } @@ -446,7 +446,7 @@ void PageView::setIndicatorIndexNodesOpacity(uint8_t opacity) uint8_t PageView::getIndicatorIndexNodesOpacity() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getIndexNodesOpacity(); } @@ -461,7 +461,7 @@ void PageView::setIndicatorIndexNodesScale(float indexNodesScale) float PageView::getIndicatorIndexNodesScale() const { - CCASSERT(_indicator != nullptr, ""); + AXASSERT(_indicator != nullptr, ""); return _indicator->getIndexNodesScale(); } diff --git a/core/ui/UIRadioButton.cpp b/core/ui/UIRadioButton.cpp index bed44e8862..cf8deea147 100644 --- a/core/ui/UIRadioButton.cpp +++ b/core/ui/UIRadioButton.cpp @@ -171,7 +171,7 @@ void RadioButtonGroup::addRadioButton(RadioButton* radioButton) { if (radioButton != nullptr) { - CCASSERT(!radioButton->_group, "It already belongs to a group!"); + AXASSERT(!radioButton->_group, "It already belongs to a group!"); radioButton->_group = this; _radioButtons.pushBack(radioButton); @@ -187,7 +187,7 @@ void RadioButtonGroup::removeRadioButton(RadioButton* radioButton) ssize_t index = _radioButtons.getIndex(radioButton); if (index == AX_INVALID_INDEX) { - CCLOGERROR("The radio button does not belong to this group!"); + AXLOGERROR("The radio button does not belong to this group!"); return; } @@ -224,7 +224,7 @@ RadioButton* RadioButtonGroup::getRadioButtonByIndex(int index) const { if (index >= _radioButtons.size()) { - CCLOGERROR("Out of array index! length=%d, requestedIndex=%d", (int)_radioButtons.size(), index); + AXLOGERROR("Out of array index! length=%d, requestedIndex=%d", (int)_radioButtons.size(), index); return nullptr; } return _radioButtons.at(index); @@ -247,7 +247,7 @@ int RadioButtonGroup::getSelectedButtonIndex() const void RadioButtonGroup::setSelectedButton(int index) { - CCASSERT(index < _radioButtons.size(), "Out of array index!"); + AXASSERT(index < _radioButtons.size(), "Out of array index!"); setSelectedButton(_radioButtons.at(index)); } @@ -274,7 +274,7 @@ void RadioButtonGroup::setSelectedButtonWithoutEvent(RadioButton* radioButton) } if (radioButton != nullptr && !_radioButtons.contains(radioButton)) { - CCLOGERROR("The radio button does not belong to this group!"); + AXLOGERROR("The radio button does not belong to this group!"); return; } diff --git a/core/ui/UIRichText.cpp b/core/ui/UIRichText.cpp index dd877f9fb5..3dcce7dbdc 100644 --- a/core/ui/UIRichText.cpp +++ b/core/ui/UIRichText.cpp @@ -2042,7 +2042,7 @@ float getPaddingAmount(const RichText::HorizontalAlignment alignment, const floa case RichText::HorizontalAlignment::RIGHT: return leftOver; default: - CCASSERT(false, "invalid horizontal alignment!"); + AXASSERT(false, "invalid horizontal alignment!"); return 0.f; } } diff --git a/core/ui/UIScale9Sprite.cpp b/core/ui/UIScale9Sprite.cpp index 65945bba47..a4cd5f83c2 100644 --- a/core/ui/UIScale9Sprite.cpp +++ b/core/ui/UIScale9Sprite.cpp @@ -396,7 +396,7 @@ void Scale9Sprite::setScale9Enabled(bool enabled) { if (_renderMode == RenderMode::POLYGON) { - CCLOGWARN("Scale9Sprite::setScale9Enabled() can't be called when using POLYGON render modes"); + AXLOGWARN("Scale9Sprite::setScale9Enabled() can't be called when using POLYGON render modes"); return; } @@ -475,7 +475,7 @@ void Scale9Sprite::setRenderingType(Scale9Sprite::RenderingType type) { if (_renderMode == RenderMode::POLYGON) { - CCLOGWARN("Scale9Sprite::setRenderingType() can't be called when using POLYGON render modes"); + AXLOGWARN("Scale9Sprite::setRenderingType() can't be called when using POLYGON render modes"); return; } if (_renderingType != type) diff --git a/core/ui/UIScrollView.cpp b/core/ui/UIScrollView.cpp index 1bb782673e..8ca34861ff 100644 --- a/core/ui/UIScrollView.cpp +++ b/core/ui/UIScrollView.cpp @@ -760,7 +760,7 @@ void ScrollView::scrollToTopLeft(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } startAutoScrollToDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height), timeInSec, @@ -771,7 +771,7 @@ void ScrollView::scrollToTopRight(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } startAutoScrollToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, @@ -783,7 +783,7 @@ void ScrollView::scrollToBottomLeft(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } startAutoScrollToDestination(Vec2::ZERO, timeInSec, attenuated); @@ -793,7 +793,7 @@ void ScrollView::scrollToBottomRight(float timeInSec, bool attenuated) { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } startAutoScrollToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f), timeInSec, @@ -868,7 +868,7 @@ void ScrollView::jumpToTopLeft() { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } jumpToDestination(Vec2(0.0f, _contentSize.height - _innerContainer->getContentSize().height)); @@ -878,7 +878,7 @@ void ScrollView::jumpToTopRight() { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } jumpToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, @@ -889,7 +889,7 @@ void ScrollView::jumpToBottomLeft() { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } jumpToDestination(Vec2::ZERO); @@ -899,7 +899,7 @@ void ScrollView::jumpToBottomRight() { if (_direction != Direction::BOTH) { - CCLOG("Scroll direction is not both!"); + AXLOG("Scroll direction is not both!"); return; } jumpToDestination(Vec2(_contentSize.width - _innerContainer->getContentSize().width, 0.0f)); @@ -1285,35 +1285,35 @@ void ScrollView::setScrollBarPositionFromCorner(const Vec2& positionFromCorner) void ScrollView::setScrollBarPositionFromCornerForVertical(const Vec2& positionFromCorner) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); - CCASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!"); _verticalScrollBar->setPositionFromCorner(positionFromCorner); } Vec2 ScrollView::getScrollBarPositionFromCornerForVertical() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); - CCASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_direction != Direction::HORIZONTAL, "Scroll view doesn't have a vertical scroll bar!"); return _verticalScrollBar->getPositionFromCorner(); } void ScrollView::setScrollBarPositionFromCornerForHorizontal(const Vec2& positionFromCorner) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); - CCASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!"); _horizontalScrollBar->setPositionFromCorner(positionFromCorner); } Vec2 ScrollView::getScrollBarPositionFromCornerForHorizontal() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); - CCASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_direction != Direction::VERTICAL, "Scroll view doesn't have a horizontal scroll bar!"); return _horizontalScrollBar->getPositionFromCorner(); } void ScrollView::setScrollBarWidth(float width) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { _verticalScrollBar->setWidth(width); @@ -1326,7 +1326,7 @@ void ScrollView::setScrollBarWidth(float width) float ScrollView::getScrollBarWidth() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { return _verticalScrollBar->getWidth(); @@ -1340,7 +1340,7 @@ float ScrollView::getScrollBarWidth() const void ScrollView::setScrollBarColor(const Color3B& color) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { _verticalScrollBar->setColor(color); @@ -1353,7 +1353,7 @@ void ScrollView::setScrollBarColor(const Color3B& color) const Color3B& ScrollView::getScrollBarColor() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { return _verticalScrollBar->getColor(); @@ -1367,7 +1367,7 @@ const Color3B& ScrollView::getScrollBarColor() const void ScrollView::setScrollBarOpacity(uint8_t opacity) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { _verticalScrollBar->setOpacity(opacity); @@ -1380,7 +1380,7 @@ void ScrollView::setScrollBarOpacity(uint8_t opacity) uint8_t ScrollView::getScrollBarOpacity() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { return _verticalScrollBar->getOpacity(); @@ -1394,7 +1394,7 @@ uint8_t ScrollView::getScrollBarOpacity() const void ScrollView::setScrollBarAutoHideEnabled(bool autoHideEnabled) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { _verticalScrollBar->setAutoHideEnabled(autoHideEnabled); @@ -1407,7 +1407,7 @@ void ScrollView::setScrollBarAutoHideEnabled(bool autoHideEnabled) bool ScrollView::isScrollBarAutoHideEnabled() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { return _verticalScrollBar->isAutoHideEnabled(); @@ -1421,7 +1421,7 @@ bool ScrollView::isScrollBarAutoHideEnabled() const void ScrollView::setScrollBarAutoHideTime(float autoHideTime) { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { _verticalScrollBar->setAutoHideTime(autoHideTime); @@ -1434,7 +1434,7 @@ void ScrollView::setScrollBarAutoHideTime(float autoHideTime) float ScrollView::getScrollBarAutoHideTime() const { - CCASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); + AXASSERT(_scrollBarEnabled, "Scroll bar should be enabled!"); if (_verticalScrollBar != nullptr) { return _verticalScrollBar->getAutoHideTime(); diff --git a/core/ui/UIScrollViewBar.cpp b/core/ui/UIScrollViewBar.cpp index f4d3ea9292..0be1a6058b 100644 --- a/core/ui/UIScrollViewBar.cpp +++ b/core/ui/UIScrollViewBar.cpp @@ -62,8 +62,8 @@ ScrollViewBar::ScrollViewBar(ScrollView* parent, ScrollView::Direction direction , _autoHideTime(DEFAULT_AUTO_HIDE_TIME) , _autoHideRemainingTime(0) { - CCASSERT(parent != nullptr, "Parent scroll view must not be null!"); - CCASSERT(direction != ScrollView::Direction::BOTH, "Illegal scroll direction for scroll bar!"); + AXASSERT(parent != nullptr, "Parent scroll view must not be null!"); + AXASSERT(direction != ScrollView::Direction::BOTH, "Illegal scroll direction for scroll bar!"); setCascadeColorEnabled(true); setCascadeOpacityEnabled(true); } diff --git a/core/ui/UITabControl.cpp b/core/ui/UITabControl.cpp index 818d3db686..552f4209d4 100644 --- a/core/ui/UITabControl.cpp +++ b/core/ui/UITabControl.cpp @@ -63,7 +63,7 @@ void TabControl::insertTab(int index, TabHeader* header, Layout* container) int cellSize = (int)_tabItems.size(); if (index > cellSize) { - CCLOG("%s", "insert index error"); + AXLOG("%s", "insert index error"); return; } @@ -123,7 +123,7 @@ void TabControl::removeTab(int index) int cellSize = (int)_tabItems.size(); if (cellSize == 0 || index >= cellSize) { - CCLOG("%s", "no tab or remove index error"); + AXLOG("%s", "no tab or remove index error"); return; } diff --git a/core/ui/UITextAtlas.cpp b/core/ui/UITextAtlas.cpp index 0bdf7bf3df..a339e4a8ee 100644 --- a/core/ui/UITextAtlas.cpp +++ b/core/ui/UITextAtlas.cpp @@ -100,7 +100,7 @@ void TextAtlas::setProperty(std::string_view stringValue, updateContentSizeWithTextureSize(_labelAtlasRenderer->getContentSize()); _labelAtlasRendererAdaptDirty = true; - // CCLOG("cs w %f, h %f", _contentSize.width, _contentSize.height); + // AXLOG("cs w %f, h %f", _contentSize.width, _contentSize.height); } void TextAtlas::setString(std::string_view value) @@ -113,7 +113,7 @@ void TextAtlas::setString(std::string_view value) _labelAtlasRenderer->setString(value); updateContentSizeWithTextureSize(_labelAtlasRenderer->getContentSize()); _labelAtlasRendererAdaptDirty = true; - // CCLOG("cssss w %f, h %f", _contentSize.width, _contentSize.height); + // AXLOG("cssss w %f, h %f", _contentSize.width, _contentSize.height); } std::string_view TextAtlas::getString() const diff --git a/core/ui/UITextFieldEx.cpp b/core/ui/UITextFieldEx.cpp index e9f3cd381f..69eb966462 100644 --- a/core/ui/UITextFieldEx.cpp +++ b/core/ui/UITextFieldEx.cpp @@ -63,7 +63,7 @@ static bool engine_inj_containsTouchPoint(axis::Node* target, axis::Touch* touch bool contains = (rc.containsPoint(pt)); - // CCLOG("check %#x coordinate:(%f, %f), contains:%d", target, pt.x, pt.y, contains); + // AXLOG("check %#x coordinate:(%f, %f), contains:%d", target, pt.x, pt.y, contains); return contains; } @@ -77,7 +77,7 @@ static bool engine_inj_containsPoint(axis::Node* target, const axis::Vec2& world bool contains = (rc.containsPoint(pt)); - // CCLOG("check %#x coordinate:(%f, %f), contains:%d", target, pt.x, pt.y, contains); + // AXLOG("check %#x coordinate:(%f, %f), contains:%d", target, pt.x, pt.y, contains); return contains; } @@ -515,7 +515,7 @@ void TextFieldEx::keyboardDidHide(IMEKeyboardNotificationInfo& /*info*/) void TextFieldEx::openIME(void) { - CCLOG("TextFieldEx:: openIME"); + AXLOG("TextFieldEx:: openIME"); this->attachWithIME(); __updateCursorPosition(); __showCursor(); @@ -526,7 +526,7 @@ void TextFieldEx::openIME(void) void TextFieldEx::closeIME(void) { - CCLOG("TextFieldEx:: closeIME"); + AXLOG("TextFieldEx:: closeIME"); __hideCursor(); this->detachWithIME(); diff --git a/core/ui/UIWebView/UIWebViewImpl-win32.cpp b/core/ui/UIWebView/UIWebViewImpl-win32.cpp index 4b9cad508f..778e5dee6a 100644 --- a/core/ui/UIWebView/UIWebViewImpl-win32.cpp +++ b/core/ui/UIWebView/UIWebViewImpl-win32.cpp @@ -918,7 +918,7 @@ bool Win32WebControl::createWebView(const std::function& if (!embed(m_window, false, cb)) { - CCLOG("Cannot create edge chromium webview"); + AXLOG("Cannot create edge chromium webview"); ret = false; break; } diff --git a/core/ui/UIWidget.cpp b/core/ui/UIWidget.cpp index 0b5a7f1a6f..8b8e3f4e13 100644 --- a/core/ui/UIWidget.cpp +++ b/core/ui/UIWidget.cpp @@ -1262,7 +1262,7 @@ float Widget::getScaleY() const float Widget::getScale() const { - CCASSERT(this->getScaleX() == this->getScaleY(), "scaleX should be equal to scaleY."); + AXASSERT(this->getScaleX() == this->getScaleY(), "scaleX should be equal to scaleY."); return this->getScaleX(); } diff --git a/docs/CODING_STYLE.md b/docs/CODING_STYLE.md index d1f7b51178..e51fd1a27d 100644 --- a/docs/CODING_STYLE.md +++ b/docs/CODING_STYLE.md @@ -1660,20 +1660,20 @@ int cstmrId; // Deletes internal letters. ## File Names -Filenames should be all in CamelCasel, and for cocos2d specific files, they should start with the `CC` prefix as well. +Filenames should be all in CamelCasel Examples of acceptable file names: - CCSprite.cpp - CCTextureCache.cpp - CCTexture2D.cpp + Sprite.cpp + TextureCache.cpp + Texture2D.cpp C++ files should end in `.cpp` and header files should end in `.h`. Do not use filenames that already exist in /usr/include, such as db.h. -In general, make your filenames very specific. For example, use `CCTexture2D.h` rather than `Texture.h`. A very common case is to have a pair of files called, e.g., `FooBar.h` and `FooBar.cpp` , defining a class called `FooBar` . +A very common case is to have a pair of files called, e.g., `FooBar.h` and `FooBar.cpp` , defining a class called `FooBar` . Inline functions must be in a `.h` file. If your inline functions are very short, they should go directly into your .h file. However, if your inline functions include a lot of code, they may go into a third file that ends in `-inl.h` . In a class with a lot of inline code, your class could have three files: @@ -1828,14 +1828,14 @@ enum class UrlTableErrors { ## Macro Names -You're not really going to define a macro, are you? If you do, they're like this: CC_MY_MACRO_THAT_SCARES_SMALL_CHILDREN. +You're not really going to define a macro, are you? If you do, they're like this: AX_MY_MACRO_THAT_SCARES_SMALL_CHILDREN. -Please see the description of macros; in general macros should not be used. However, if they are absolutely needed, then they should be named with all capitals and underscores, and they should be prefixed with `CC_` or `CC` +Please see the description of macros; in general macros should not be used. However, if they are absolutely needed, then they should be named with all capitals and underscores, and they should be prefixed with `AX_` or `AX` ```cpp -#define CC_ROUND(x) ... -#define CC_PI_ROUNDED 3.0 -#define CCLOG(x) ... +#define AX_ROUND(x) ... +#define AX_PI_ROUNDED 3.0 +#define AXLOG(x) ... ``` ## Exceptions to Naming Rules @@ -2150,7 +2150,7 @@ If your TODO is of the form "At a future date do something" make sure that you e ## Deprecation Comments -Use the `CC_DEPRECATED_ATTRIBUTE` macro to mark an methods as deprecated. +Use the `AX_DEPRECATED_ATTRIBUTE` macro to mark an methods as deprecated. Also use the ` ``deprecated ` doxygen docstring to mark it as deprecated in the documentation. @@ -2825,7 +2825,7 @@ It is worth reiterating a few of the guidelines that you might forget if you are * Windows defines many of its own synonyms for primitive types, such as DWORD, HANDLE, etc. It is perfectly acceptable, and encouraged, that you use these types when calling Windows API functions. Even so, keep as close as you can to the underlying C++ types. For example, use const TCHAR * instead of LPCTSTR. * When compiling with Microsoft Visual C++, set the compiler to warning level 3 or higher, and treat all warnings as errors. * Do not use #pragma once; instead use the standard Google include guards. The path in the include guards should be relative to the top of your project tree. -* In fact, do not use any nonstandard extensions, like #pragma and __declspec, unless you absolutely must. Using `__declspec(dllimport)` and `__declspec(dllexport)` is allowed; however, you must use them through macros such as `DLLIMPORT` and `DLLEXPORT` or `CC_DLL`, so that someone can easily disable the extensions if they share the code. +* In fact, do not use any nonstandard extensions, like #pragma and __declspec, unless you absolutely must. Using `__declspec(dllimport)` and `__declspec(dllexport)` is allowed; however, you must use them through macros such as `DLLIMPORT` and `DLLEXPORT` or `AX_DLL`, so that someone can easily disable the extensions if they share the code. However, there are just a few rules that we occasionally need to break on Windows: diff --git a/examples/SimpleSnake/Classes/AppDelegate.cpp b/examples/SimpleSnake/Classes/AppDelegate.cpp index 4a189f2d83..cbc3f2e14e 100644 --- a/examples/SimpleSnake/Classes/AppDelegate.cpp +++ b/examples/SimpleSnake/Classes/AppDelegate.cpp @@ -67,8 +67,8 @@ bool AppDelegate::applicationDidFinishLaunching() auto glview = director->getOpenGLView(); if (!glview) { -#if (CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC) || \ - (CC_TARGET_PLATFORM == CC_PLATFORM_LINUX) +#if (AX_TARGET_PLATFORM == AX_PLATFORM_WIN32) || (AX_TARGET_PLATFORM == AX_PLATFORM_MAC) || \ + (AX_TARGET_PLATFORM == AX_PLATFORM_LINUX) glview = GLViewImpl::createWithRect( "Example: Simple Snake", axis::Rect(0, 0, designResolutionSize.width, designResolutionSize.height)); #else diff --git a/examples/SimpleSnake/Classes/SimpleSnakeScene.cpp b/examples/SimpleSnake/Classes/SimpleSnakeScene.cpp index c880172d35..07b4c69a11 100644 --- a/examples/SimpleSnake/Classes/SimpleSnakeScene.cpp +++ b/examples/SimpleSnake/Classes/SimpleSnakeScene.cpp @@ -74,7 +74,7 @@ bool SimpleSnake::init() // add a "close" icon to exit the progress. it's an autorelease object auto closeItem = MenuItemImage::create("CloseNormal.png", "CloseSelected.png", - CC_CALLBACK_1(SimpleSnake::menuCloseCallback, this)); + AX_CALLBACK_1(SimpleSnake::menuCloseCallback, this)); if (closeItem == nullptr || closeItem->getContentSize().width <= 0 || closeItem->getContentSize().height <= 0) { @@ -96,7 +96,7 @@ bool SimpleSnake::init() // 3. add your codes below... auto listener = EventListenerKeyboard::create(); - listener->onKeyPressed = CC_CALLBACK_2(SimpleSnake::onKeyPressed, this); + listener->onKeyPressed = AX_CALLBACK_2(SimpleSnake::onKeyPressed, this); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); // add a label shows "Hello World" diff --git a/extensions/GUI/CCControlExtension/CCControlButton.cpp b/extensions/GUI/CCControlExtension/CCControlButton.cpp index 3d95f564a2..58f970151a 100644 --- a/extensions/GUI/CCControlExtension/CCControlButton.cpp +++ b/extensions/GUI/CCControlExtension/CCControlButton.cpp @@ -73,10 +73,10 @@ bool ControlButton::initWithLabelAndBackgroundSprite(Node* node, { if (Control::init()) { - CCASSERT(node != nullptr, "node must not be nil."); + AXASSERT(node != nullptr, "node must not be nil."); LabelProtocol* label = dynamic_cast(node); - CCASSERT(backgroundSprite != nullptr, "Background sprite must not be nil."); - CCASSERT(label != nullptr, "label must not be nil."); + AXASSERT(backgroundSprite != nullptr, "Background sprite must not be nil."); + AXASSERT(label != nullptr, "label must not be nil."); _parentInited = true; diff --git a/extensions/GUI/CCControlExtension/CCControlSlider.cpp b/extensions/GUI/CCControlExtension/CCControlSlider.cpp index eea7142279..b831cfdea2 100644 --- a/extensions/GUI/CCControlExtension/CCControlSlider.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSlider.cpp @@ -122,10 +122,10 @@ bool ControlSlider::initWithSprites(Sprite* backgroundSprite, { if (Control::init()) { - CCASSERT(backgroundSprite, "Background sprite must be not nil"); - CCASSERT(progressSprite, "Progress sprite must be not nil"); - CCASSERT(thumbSprite, "Thumb sprite must be not nil"); - CCASSERT(selectedThumbSprite, "Thumb sprite must be not nil"); + AXASSERT(backgroundSprite, "Background sprite must be not nil"); + AXASSERT(progressSprite, "Progress sprite must be not nil"); + AXASSERT(thumbSprite, "Thumb sprite must be not nil"); + AXASSERT(selectedThumbSprite, "Thumb sprite must be not nil"); setIgnoreAnchorPointForPosition(false); diff --git a/extensions/GUI/CCControlExtension/CCControlStepper.cpp b/extensions/GUI/CCControlExtension/CCControlStepper.cpp index f38f7514e5..e2f1159849 100644 --- a/extensions/GUI/CCControlExtension/CCControlStepper.cpp +++ b/extensions/GUI/CCControlExtension/CCControlStepper.cpp @@ -70,8 +70,8 @@ bool ControlStepper::initWithMinusSpriteAndPlusSprite(Sprite* minusSprite, Sprit { if (Control::init()) { - CCASSERT(minusSprite, "Minus sprite must be not nil"); - CCASSERT(plusSprite, "Plus sprite must be not nil"); + AXASSERT(minusSprite, "Minus sprite must be not nil"); + AXASSERT(plusSprite, "Plus sprite must be not nil"); // Set the default values _autorepeat = true; @@ -148,7 +148,7 @@ void ControlStepper::setMinimumValue(double minimumValue) { if (minimumValue >= _maximumValue) { - CCASSERT(0, "Must be numerically less than maximumValue."); + AXASSERT(0, "Must be numerically less than maximumValue."); } _minimumValue = minimumValue; @@ -159,7 +159,7 @@ void ControlStepper::setMaximumValue(double maximumValue) { if (maximumValue <= _minimumValue) { - CCASSERT(0, "Must be numerically greater than minimumValue."); + AXASSERT(0, "Must be numerically greater than minimumValue."); } _maximumValue = maximumValue; @@ -180,7 +180,7 @@ void ControlStepper::setStepValue(double stepValue) { if (stepValue <= 0) { - CCASSERT(0, "Must be numerically greater than 0."); + AXASSERT(0, "Must be numerically greater than 0."); } _stepValue = stepValue; diff --git a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp index c6a01c405e..8309e38c14 100644 --- a/extensions/GUI/CCControlExtension/CCControlSwitch.cpp +++ b/extensions/GUI/CCControlExtension/CCControlSwitch.cpp @@ -216,7 +216,7 @@ bool ControlSwitchSprite::initWithMaskSprite(Sprite* maskSprite, void ControlSwitchSprite::updateTweenAction(float value, std::string_view key) { - CCLOGINFO("key = %s, value = %f", key.c_str(), value); + AXLOGINFO("key = %s, value = %f", key.c_str(), value); setSliderXPosition(value); } @@ -313,10 +313,10 @@ bool ControlSwitch::initWithMaskSprite(Sprite* maskSprite, { if (Control::init()) { - CCASSERT(maskSprite, "Mask must not be nil."); - CCASSERT(onSprite, "onSprite must not be nil."); - CCASSERT(offSprite, "offSprite must not be nil."); - CCASSERT(thumbSprite, "thumbSprite must not be nil."); + AXASSERT(maskSprite, "Mask must not be nil."); + AXASSERT(onSprite, "onSprite must not be nil."); + AXASSERT(offSprite, "offSprite must not be nil."); + AXASSERT(thumbSprite, "thumbSprite must not be nil."); _on = true; diff --git a/extensions/GUI/CCScrollView/CCScrollView.cpp b/extensions/GUI/CCScrollView/CCScrollView.cpp index ac0c692a27..d67dce7d3a 100644 --- a/extensions/GUI/CCScrollView/CCScrollView.cpp +++ b/extensions/GUI/CCScrollView/CCScrollView.cpp @@ -650,7 +650,7 @@ void ScrollView::visit(Renderer* renderer, const Mat4& parentTransform, uint32_t // 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 Director* director = Director::getInstance(); - 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); @@ -795,7 +795,7 @@ void ScrollView::onTouchMoved(Touch* touch, Event* /*event*/) if (!_touchMoved && fabs(convertDistanceFromPointToInch(dis)) < MOVE_INCH) { - // CCLOG("Invalid movement, distance = [%f, %f], disInch = %f", moveDistance.x, moveDistance.y); + // AXLOG("Invalid movement, distance = [%f, %f], disInch = %f", moveDistance.x, moveDistance.y); return; } diff --git a/extensions/ImGui/ImGuiPresenter.cpp b/extensions/ImGui/ImGuiPresenter.cpp index 3eca8ac863..8798301bf3 100644 --- a/extensions/ImGui/ImGuiPresenter.cpp +++ b/extensions/ImGui/ImGuiPresenter.cpp @@ -253,7 +253,7 @@ void ImGuiPresenter::loadCustomFonts(void* ud) } auto fontData = FileUtils::getInstance()->getDataFromFile(fontInfo.first); - CCASSERT(!fontData.isNull(), "Cannot load font for IMGUI"); + AXASSERT(!fontData.isNull(), "Cannot load font for IMGUI"); ssize_t bufferSize = 0; auto* buffer = fontData.takeBuffer(&bufferSize); // Buffer automatically freed by IMGUI diff --git a/extensions/Particle3D/CCParticle3DRender.cpp b/extensions/Particle3D/CCParticle3DRender.cpp index 1c14d49f58..06e884c3a9 100644 --- a/extensions/Particle3D/CCParticle3DRender.cpp +++ b/extensions/Particle3D/CCParticle3DRender.cpp @@ -82,7 +82,7 @@ void Particle3DQuadRender::render(Renderer* renderer, const Mat4& transform, Par backend::BufferType::VERTEX, backend::BufferUsage::DYNAMIC); if (_vertexBuffer == nullptr) { - CCLOG("Particle3DQuadRender::render create vertex buffer failed"); + AXLOG("Particle3DQuadRender::render create vertex buffer failed"); return; } } @@ -94,7 +94,7 @@ void Particle3DQuadRender::render(Renderer* renderer, const Mat4& transform, Par backend::BufferType::INDEX, backend::BufferUsage::DYNAMIC); if (_indexBuffer == nullptr) { - CCLOG("Particle3DQuadRender::render create index buffer failed"); + AXLOG("Particle3DQuadRender::render create index buffer failed"); return; } } @@ -309,7 +309,7 @@ void Particle3DModelRender::render(Renderer* renderer, const Mat4& transform, Pa MeshRenderer* mesh = MeshRenderer::create(_modelFile); if (mesh == nullptr) { - CCLOG("failed to load file %s", _modelFile.c_str()); + AXLOG("failed to load file %s", _modelFile.c_str()); continue; } mesh->setTexture(_texFile); diff --git a/extensions/Particle3D/CCParticleSystem3D.cpp b/extensions/Particle3D/CCParticleSystem3D.cpp index b03c955293..a2bc66b5f0 100644 --- a/extensions/Particle3D/CCParticleSystem3D.cpp +++ b/extensions/Particle3D/CCParticleSystem3D.cpp @@ -126,7 +126,7 @@ void ParticleSystem3D::addAffector(Particle3DAffector* affector) void ParticleSystem3D::removeAffector(int index) { - CCASSERT((unsigned int)index < _affectors.size(), "wrong index"); + AXASSERT((unsigned int)index < _affectors.size(), "wrong index"); _affectors.erase(_affectors.begin() + index); } @@ -142,7 +142,7 @@ void ParticleSystem3D::removeAllAffector() Particle3DAffector* ParticleSystem3D::getAffector(int index) { - CCASSERT(index < (int)_affectors.size(), "wrong index"); + AXASSERT(index < (int)_affectors.size(), "wrong index"); return _affectors[index]; } diff --git a/extensions/Particle3D/PU/CCPUBaseCollider.cpp b/extensions/Particle3D/PU/CCPUBaseCollider.cpp index 6d74ffb453..721f64a55e 100644 --- a/extensions/Particle3D/PU/CCPUBaseCollider.cpp +++ b/extensions/Particle3D/PU/CCPUBaseCollider.cpp @@ -104,7 +104,7 @@ void PUBaseCollider::calculateRotationSpeedAfterCollision(PUParticle3D* particle if (particle->particleType != PUParticle3D::PT_VISUAL) return; - float signedFriction = CCRANDOM_0_1() > 0.5f ? -(_friction - 1) : (_friction - 1); + float signedFriction = AXRANDOM_0_1() > 0.5f ? -(_friction - 1) : (_friction - 1); particle->rotationSpeed *= signedFriction; particle->zRotationSpeed *= signedFriction; diff --git a/extensions/Particle3D/PU/CCPUBeamRender.cpp b/extensions/Particle3D/PU/CCPUBeamRender.cpp index 6f5e892cb6..757dc4fec5 100644 --- a/extensions/Particle3D/PU/CCPUBeamRender.cpp +++ b/extensions/Particle3D/PU/CCPUBeamRender.cpp @@ -305,7 +305,7 @@ void PUBeamRender::updateRender(PUParticle3D* particle, float deltaTime, bool /* float divide = (float)_numberOfSegments + 1.0f; for (size_t numDev = 0; numDev < _numberOfSegments; ++numDev) { - Vec3::cross(end, Vec3(CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1()), &perpendicular); + Vec3::cross(end, Vec3(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()), &perpendicular); perpendicular.normalize(); beamRendererVisualData->destinationHalf[numDev] = (((float)numDev + 1.0f) / divide) * end + Vec3(_rendererScale.x * _deviation * perpendicular.x, diff --git a/extensions/Particle3D/PU/CCPUBillboardChain.cpp b/extensions/Particle3D/PU/CCPUBillboardChain.cpp index 4c429d44bf..723e6d2334 100644 --- a/extensions/Particle3D/PU/CCPUBillboardChain.cpp +++ b/extensions/Particle3D/PU/CCPUBillboardChain.cpp @@ -240,7 +240,7 @@ void PUBillboardChain::setDynamic(bool dyn) //----------------------------------------------------------------------- void PUBillboardChain::addChainElement(size_t chainIndex, const PUBillboardChain::Element& dtls) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); ChainSegment& seg = _chainSegmentList[chainIndex]; if (seg.head == SEGMENT_EMPTY) { @@ -285,7 +285,7 @@ void PUBillboardChain::addChainElement(size_t chainIndex, const PUBillboardChain //----------------------------------------------------------------------- void PUBillboardChain::removeChainElement(size_t chainIndex) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); ChainSegment& seg = _chainSegmentList[chainIndex]; if (seg.head == SEGMENT_EMPTY) return; // do nothing, nothing to remove @@ -315,7 +315,7 @@ void PUBillboardChain::removeChainElement(size_t chainIndex) //----------------------------------------------------------------------- void PUBillboardChain::clearChain(size_t chainIndex) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); ChainSegment& seg = _chainSegmentList[chainIndex]; // Just reset head & tail @@ -348,9 +348,9 @@ void PUBillboardChain::setFaceCamera(bool faceCamera, const Vec3& normalVector) //----------------------------------------------------------------------- void PUBillboardChain::updateChainElement(size_t chainIndex, size_t elementIndex, const PUBillboardChain::Element& dtls) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); ChainSegment& seg = _chainSegmentList[chainIndex]; - CCASSERT(seg.head != SEGMENT_EMPTY, "Chain segment is empty"); + AXASSERT(seg.head != SEGMENT_EMPTY, "Chain segment is empty"); size_t idx = seg.head + elementIndex; // adjust for the edge and start @@ -368,7 +368,7 @@ void PUBillboardChain::updateChainElement(size_t chainIndex, size_t elementIndex //----------------------------------------------------------------------- const PUBillboardChain::Element& PUBillboardChain::getChainElement(size_t chainIndex, size_t elementIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); const ChainSegment& seg = _chainSegmentList[chainIndex]; size_t idx = seg.head + elementIndex; @@ -380,7 +380,7 @@ const PUBillboardChain::Element& PUBillboardChain::getChainElement(size_t chainI //----------------------------------------------------------------------- size_t PUBillboardChain::getNumChainElements(size_t chainIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); const ChainSegment& seg = _chainSegmentList[chainIndex]; if (seg.tail < seg.head) @@ -431,7 +431,7 @@ void PUBillboardChain::updateVertexBuffer(const Mat4& camMat) e = 0; Element& elem = _chainElementList[e + seg.start]; - CCASSERT(((e + seg.start) * 2) < 65536, "Too many elements!"); + AXASSERT(((e + seg.start) * 2) < 65536, "Too many elements!"); unsigned short vertexIndex = static_cast((e + seg.start) * 2); //// Determine base pointer to vertex #1 // void* pBase = static_cast( @@ -594,7 +594,7 @@ void PUBillboardChain::updateIndexBuffer() e = 0; // indexes of this element are (e * 2) and (e * 2) + 1 // indexes of the last element are the same, -2 - CCASSERT(((e + seg.start) * 2) < 65536, "Too many elements!"); + AXASSERT(((e + seg.start) * 2) < 65536, "Too many elements!"); unsigned short baseIdx = static_cast((e + seg.start) * 2); unsigned short lastBaseIdx = static_cast((laste + seg.start) * 2); diff --git a/extensions/Particle3D/PU/CCPUBoxEmitter.cpp b/extensions/Particle3D/PU/CCPUBoxEmitter.cpp index 3c33a6e16f..39351556d0 100644 --- a/extensions/Particle3D/PU/CCPUBoxEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUBoxEmitter.cpp @@ -87,9 +87,9 @@ void CCPUBoxEmitter::initParticlePosition(PUParticle3D* particle) Mat4 rotMat; Mat4::createRotation(static_cast(_particleSystem)->getDerivedOrientation(), &rotMat); particle->position = getDerivedPosition() + rotMat * (/*_emitterScale **/ - Vec3(CCRANDOM_MINUS1_1() * _xRange * _emitterScale.x, - CCRANDOM_MINUS1_1() * _yRange * _emitterScale.y, - CCRANDOM_MINUS1_1() * _zRange * _emitterScale.z)); + Vec3(AXRANDOM_MINUS1_1() * _xRange * _emitterScale.x, + AXRANDOM_MINUS1_1() * _yRange * _emitterScale.y, + AXRANDOM_MINUS1_1() * _zRange * _emitterScale.z)); } // else //{ diff --git a/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp b/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp index d97cc45900..5d055f8ba4 100644 --- a/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp +++ b/extensions/Particle3D/PU/CCPUCollisionAvoidanceAffector.cpp @@ -47,7 +47,7 @@ void PUCollisionAvoidanceAffector::setRadius(float radius) //----------------------------------------------------------------------- void PUCollisionAvoidanceAffector::updatePUAffector(PUParticle3D* /*particle*/, float /*deltaTime*/) { - CCASSERT(0, "nonsupport yet"); + AXASSERT(0, "nonsupport yet"); // for (auto iter : _particleSystem->getParticles()) //{ // PUParticle3D *particle = iter; diff --git a/extensions/Particle3D/PU/CCPUEmitter.cpp b/extensions/Particle3D/PU/CCPUEmitter.cpp index 7f78c6524a..297febaf67 100644 --- a/extensions/Particle3D/PU/CCPUEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUEmitter.cpp @@ -205,7 +205,7 @@ void PUEmitter::initParticleOrientation(PUParticle3D* particle) if (_particleOrientationRangeSet) { // Generate random orientation 'between' start en end. - Quaternion::lerp(_particleOrientationRangeStart, _particleOrientationRangeEnd, CCRANDOM_0_1(), + Quaternion::lerp(_particleOrientationRangeStart, _particleOrientationRangeEnd, AXRANDOM_0_1(), &particle->orientation); } else @@ -242,7 +242,7 @@ void PUEmitter::generateAngle(float& angle) if (_dynAngle->getType() == PUDynamicAttribute::DAT_FIXED) { // Make an exception here and don't use the fixed angle. - angle = CCRANDOM_0_1() * angle; + angle = AXRANDOM_0_1() * angle; } } diff --git a/extensions/Particle3D/PU/CCPUGeometryRotator.cpp b/extensions/Particle3D/PU/CCPUGeometryRotator.cpp index a7ec9cf0fc..40e7407490 100644 --- a/extensions/Particle3D/PU/CCPUGeometryRotator.cpp +++ b/extensions/Particle3D/PU/CCPUGeometryRotator.cpp @@ -110,14 +110,14 @@ void PUGeometryRotator::initParticleForEmission(PUParticle3D* particle) if (!_rotationAxisSet) { // Set initial random rotation axis and orientation(PU 1.4) - particle->orientation.x = CCRANDOM_MINUS1_1(); - particle->orientation.y = CCRANDOM_MINUS1_1(); - particle->orientation.z = CCRANDOM_MINUS1_1(); - particle->orientation.w = CCRANDOM_MINUS1_1(); + particle->orientation.x = AXRANDOM_MINUS1_1(); + particle->orientation.y = AXRANDOM_MINUS1_1(); + particle->orientation.z = AXRANDOM_MINUS1_1(); + particle->orientation.w = AXRANDOM_MINUS1_1(); particle->orientation.normalize(); - particle->rotationAxis.x = CCRANDOM_0_1(); - particle->rotationAxis.y = CCRANDOM_0_1(); - particle->rotationAxis.z = CCRANDOM_0_1(); + particle->rotationAxis.x = AXRANDOM_0_1(); + particle->rotationAxis.y = AXRANDOM_0_1(); + particle->rotationAxis.z = AXRANDOM_0_1(); particle->rotationAxis.normalize(); } diff --git a/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp b/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp index 4577e1a128..934a38f411 100644 --- a/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp +++ b/extensions/Particle3D/PU/CCPUInterParticleCollider.cpp @@ -130,7 +130,7 @@ bool PUParticle3DInterParticleCollider::validateAndExecuteSphereCollision(PUPart void PUParticle3DInterParticleCollider::updatePUAffector(PUParticle3D* /*particle*/, float /*deltaTime*/) { - // CCASSERT(0, "nonsupport yet"); + // AXASSERT(0, "nonsupport yet"); // for (auto iter : _particleSystem->getParticles()) //{ // PUParticle3D *particle = iter; diff --git a/extensions/Particle3D/PU/CCPULineAffector.cpp b/extensions/Particle3D/PU/CCPULineAffector.cpp index c7a6aa1e4c..99c5094cd7 100644 --- a/extensions/Particle3D/PU/CCPULineAffector.cpp +++ b/extensions/Particle3D/PU/CCPULineAffector.cpp @@ -122,15 +122,15 @@ void PULineAffector::updatePUAffector(PUParticle3D* particle, float /*deltaTime* // PUParticle3D *particle = iter; (static_cast(_particleSystem)) ->rotationOffset(particle->originalPosition); // Always update - if (_update && CCRANDOM_0_1() > 0.5f && !_first) + if (_update && AXRANDOM_0_1() > 0.5f && !_first) { // Generate a random vector perpendicular on the line Vec3 perpendicular; - Vec3::cross(_end, Vec3(CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1()), &perpendicular); + Vec3::cross(_end, Vec3(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()), &perpendicular); perpendicular.normalize(); // Determine a random point near the line. - Vec3 targetPosition = particle->originalPosition + _scaledMaxDeviation * CCRANDOM_0_1() * perpendicular; + Vec3 targetPosition = particle->originalPosition + _scaledMaxDeviation * AXRANDOM_0_1() * perpendicular; /** Set the new position. @remarks diff --git a/extensions/Particle3D/PU/CCPULineEmitter.cpp b/extensions/Particle3D/PU/CCPULineEmitter.cpp index 74af4e454d..2b6f84ce78 100644 --- a/extensions/Particle3D/PU/CCPULineEmitter.cpp +++ b/extensions/Particle3D/PU/CCPULineEmitter.cpp @@ -150,7 +150,7 @@ void PULineEmitter::initParticlePosition(PUParticle3D* particle) if (_autoDirection || (_scaledMaxDeviation > 0.0f && !_first)) { // Generate a random vector perpendicular on the line if this is required - Vec3::cross(_end, Vec3(CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1()), &_perpendicular); + Vec3::cross(_end, Vec3(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()), &_perpendicular); _perpendicular.normalize(); } @@ -160,7 +160,7 @@ void PULineEmitter::initParticlePosition(PUParticle3D* particle) { if (!_first) { - _increment += (_scaledMinIncrement + CCRANDOM_0_1() * _scaledMaxIncrement); + _increment += (_scaledMinIncrement + AXRANDOM_0_1() * _scaledMaxIncrement); if (_increment >= _scaledLength) { _incrementsLeft = false; @@ -170,7 +170,7 @@ void PULineEmitter::initParticlePosition(PUParticle3D* particle) } else { - fraction = CCRANDOM_0_1(); + fraction = AXRANDOM_0_1(); } // If the deviation has been set, generate a position with a certain distance from the line @@ -180,7 +180,7 @@ void PULineEmitter::initParticlePosition(PUParticle3D* particle) if (!_first) { Vec3 basePosition = _derivedPosition + fraction * _scaledEnd; - particle->position = basePosition + _scaledMaxDeviation * CCRANDOM_0_1() * _perpendicular; + particle->position = basePosition + _scaledMaxDeviation * AXRANDOM_0_1() * _perpendicular; particle->originalPosition = basePosition; // Position is without deviation from the line, // to make affectors a bit faster/easier. } diff --git a/extensions/Particle3D/PU/CCPUMaterialManager.cpp b/extensions/Particle3D/PU/CCPUMaterialManager.cpp index adcefd9f2b..217a167339 100644 --- a/extensions/Particle3D/PU/CCPUMaterialManager.cpp +++ b/extensions/Particle3D/PU/CCPUMaterialManager.cpp @@ -106,7 +106,7 @@ void PUMaterialCache::addMaterial(PUMaterial* material) { if (iter->name == material->name) { - CCLOG("warning: Material has existed (FilePath: %s, MaterialName: %s)", material->fileName.c_str(), + AXLOG("warning: Material has existed (FilePath: %s, MaterialName: %s)", material->fileName.c_str(), material->name.c_str()); return; } @@ -180,7 +180,7 @@ bool PUMaterialCache::loadMaterialsFromSearchPaths(std::string_view fileFolder) if (!(d = opendir(fileFolder.data()))) { - CCLOG("error opendir %s!!!\n", fileFolder.data()); + AXLOG("error opendir %s!!!\n", fileFolder.data()); return false; } while ((file = readdir(d)) != NULL) @@ -194,14 +194,14 @@ bool PUMaterialCache::loadMaterialsFromSearchPaths(std::string_view fileFolder) { std::string fullpath{fileFolder}; fullpath.append("/"sv).append(file->d_name); - CCLOG("%s", fullpath.c_str()); + AXLOG("%s", fullpath.c_str()); loadMaterials(fullpath); state = true; } } closedir(d); #else - CCASSERT(0, "no implement for this platform"); + AXASSERT(0, "no implement for this platform"); #endif return state; diff --git a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp index c007df054b..d67c1beb4f 100644 --- a/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUMeshSurfaceEmitter.cpp @@ -90,8 +90,8 @@ const Vec3 PUTriangle::getRandomTrianglePosition() // in triangle ABC: the reflection step a=1-a; b=1-b gives a point (a,b) uniformly distributed in the // triangle (0,0)(1,0)(0,1), which is then mapped affinely to ABC. Now you have barycentric coordinates // a,b,c. Compute your point P = aA + bB + cC. - float a = CCRANDOM_0_1(); - float b = CCRANDOM_0_1(); + float a = AXRANDOM_0_1(); + float b = AXRANDOM_0_1(); if (a + b > 1) { a = 1 - a; @@ -103,8 +103,8 @@ const Vec3 PUTriangle::getRandomTrianglePosition() //----------------------------------------------------------------------- const PUTriangle::PositionAndNormal PUTriangle::getRandomEdgePositionAndNormal() { - float mult = CCRANDOM_0_1(); - float randomVal = CCRANDOM_0_1() * 3.0f; + float mult = AXRANDOM_0_1(); + float randomVal = AXRANDOM_0_1() * 3.0f; PositionAndNormal pAndN; pAndN.position.setZero(); pAndN.normal.setZero(); @@ -133,7 +133,7 @@ const PUTriangle::PositionAndNormal PUTriangle::getRandomEdgePositionAndNormal() //----------------------------------------------------------------------- const PUTriangle::PositionAndNormal PUTriangle::getRandomVertexAndNormal() { - float randomVal = CCRANDOM_0_1() * 3.0f; + float randomVal = AXRANDOM_0_1() * 3.0f; PositionAndNormal pAndN; pAndN.position.setZero(); pAndN.normal.setZero(); @@ -188,8 +188,8 @@ inline float MeshInfo::getGaussianRandom(float high, float cutoff) unsigned int max = 0; do { - x1 = CCRANDOM_0_1(); - x2 = CCRANDOM_0_1(); + x1 = AXRANDOM_0_1(); + x2 = AXRANDOM_0_1(); w = x1 * x1 + x2 * x2; // Prevent infinite loop @@ -220,7 +220,7 @@ size_t MeshInfo::getRandomTriangleIndex() index = (size_t)getGaussianRandom((float)_triangles.size() - 1); } else - index = (size_t)(CCRANDOM_0_1() * (float)(_triangles.size() - 1)); + index = (size_t)(AXRANDOM_0_1() * (float)(_triangles.size() - 1)); return index; } diff --git a/extensions/Particle3D/PU/CCPUObserver.cpp b/extensions/Particle3D/PU/CCPUObserver.cpp index b1192bba5b..6860773fa9 100644 --- a/extensions/Particle3D/PU/CCPUObserver.cpp +++ b/extensions/Particle3D/PU/CCPUObserver.cpp @@ -164,7 +164,7 @@ void PUObserver::removeEventHandler(PUEventHandler* eventHandler) //----------------------------------------------------------------------- PUEventHandler* PUObserver::getEventHandler(size_t index) const { - CCASSERT(index < _eventHandlers.size(), "EventHandler index out of bounds!"); + AXASSERT(index < _eventHandlers.size(), "EventHandler index out of bounds!"); return _eventHandlers[index]; } //----------------------------------------------------------------------- @@ -193,7 +193,7 @@ size_t PUObserver::getNumEventHandlers() const //----------------------------------------------------------------------- void PUObserver::destroyEventHandler(PUEventHandler* eventHandler) { - CCASSERT(eventHandler, "EventHandler is null!"); + AXASSERT(eventHandler, "EventHandler is null!"); ParticleEventHandlerIterator it; for (it = _eventHandlers.begin(); it != _eventHandlers.end(); ++it) { diff --git a/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp b/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp index 2ad04d1208..ccfbe5cdd8 100644 --- a/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp +++ b/extensions/Particle3D/PU/CCPUOnRandomObserver.cpp @@ -51,7 +51,7 @@ void PUOnRandomObserver::updateObserver(PUParticle3D* /*particle*/, float /*delt //----------------------------------------------------------------------- bool PUOnRandomObserver::observe(PUParticle3D* /*particle*/, float /*timeElapsed*/) { - return (CCRANDOM_0_1() > _threshold); + return (AXRANDOM_0_1() > _threshold); } PUOnRandomObserver* PUOnRandomObserver::create() diff --git a/extensions/Particle3D/PU/CCPUPositionEmitter.cpp b/extensions/Particle3D/PU/CCPUPositionEmitter.cpp index fb59e715fd..0190f8cf7e 100644 --- a/extensions/Particle3D/PU/CCPUPositionEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUPositionEmitter.cpp @@ -104,7 +104,7 @@ void PUPositionEmitter::initParticlePosition(PUParticle3D* particle) */ if (_randomized) { - size_t i = (size_t)(CCRANDOM_0_1() * (_positionList.size() - 1)); + size_t i = (size_t)(AXRANDOM_0_1() * (_positionList.size() - 1)); particle->position = getDerivedPosition() + Vec3(_emitterScale.x * _positionList[i].x, _emitterScale.y * _positionList[i].y, _emitterScale.z * _positionList[i].z); diff --git a/extensions/Particle3D/PU/CCPURandomiser.cpp b/extensions/Particle3D/PU/CCPURandomiser.cpp index 9e4f38d991..829df83a16 100644 --- a/extensions/Particle3D/PU/CCPURandomiser.cpp +++ b/extensions/Particle3D/PU/CCPURandomiser.cpp @@ -122,8 +122,8 @@ void PURandomiser::updatePUAffector(PUParticle3D* particle, float /*deltaTime*/) if (_randomDirection) { // Random direction: Change the direction after each update - particle->direction.add(CCRANDOM_MINUS1_1() * _maxDeviationX, CCRANDOM_MINUS1_1() * _maxDeviationY, - CCRANDOM_MINUS1_1() * _maxDeviationZ); + particle->direction.add(AXRANDOM_MINUS1_1() * _maxDeviationX, AXRANDOM_MINUS1_1() * _maxDeviationY, + AXRANDOM_MINUS1_1() * _maxDeviationZ); } else { @@ -132,9 +132,9 @@ void PURandomiser::updatePUAffector(PUParticle3D* particle, float /*deltaTime*/) return; // Random position: Add the position deviation after each update - particle->position.add(CCRANDOM_MINUS1_1() * _maxDeviationX * _affectorScale.x, - CCRANDOM_MINUS1_1() * _maxDeviationY * _affectorScale.y, - CCRANDOM_MINUS1_1() * _maxDeviationZ * _affectorScale.z); + particle->position.add(AXRANDOM_MINUS1_1() * _maxDeviationX * _affectorScale.x, + AXRANDOM_MINUS1_1() * _maxDeviationY * _affectorScale.y, + AXRANDOM_MINUS1_1() * _maxDeviationZ * _affectorScale.z); } } } diff --git a/extensions/Particle3D/PU/CCPURender.cpp b/extensions/Particle3D/PU/CCPURender.cpp index 35d085e4e2..0d440e95e0 100644 --- a/extensions/Particle3D/PU/CCPURender.cpp +++ b/extensions/Particle3D/PU/CCPURender.cpp @@ -86,7 +86,7 @@ void PUParticle3DQuadRender::render(Renderer* renderer, const Mat4& transform, P backend::BufferType::VERTEX, backend::BufferUsage::DYNAMIC); if (_vertexBuffer == nullptr) { - CCLOG("PUParticle3DQuadRender::render create vertex buffer failed"); + AXLOG("PUParticle3DQuadRender::render create vertex buffer failed"); return; } } @@ -98,7 +98,7 @@ void PUParticle3DQuadRender::render(Renderer* renderer, const Mat4& transform, P backend::BufferType::INDEX, backend::BufferUsage::DYNAMIC); if (_indexBuffer == nullptr) { - CCLOG("PUParticle3DQuadRender::render create index buffer failed"); + AXLOG("PUParticle3DQuadRender::render create index buffer failed"); return; } } @@ -508,7 +508,7 @@ void PUParticle3DModelRender::render(Renderer* renderer, const Mat4& transform, MeshRenderer* mesh = MeshRenderer::create(_modelFile); if (mesh == nullptr) { - CCLOG("failed to load file %s", _modelFile.c_str()); + AXLOG("failed to load file %s", _modelFile.c_str()); continue; } mesh->setTexture(_texFile); @@ -725,7 +725,7 @@ void PUParticle3DBoxRender::render(Renderer* renderer, const Mat4& transform, Pa backend::BufferType::VERTEX, backend::BufferUsage::DYNAMIC); if (_vertexBuffer == nullptr) { - CCLOG("PUParticle3DBoxRender::render create vertex buffer failed"); + AXLOG("PUParticle3DBoxRender::render create vertex buffer failed"); return; } _vertices.resize(8 * particleSystem->getParticleQuota()); @@ -735,7 +735,7 @@ void PUParticle3DBoxRender::render(Renderer* renderer, const Mat4& transform, Pa backend::BufferType::INDEX, backend::BufferUsage::DYNAMIC); if (_indexBuffer == nullptr) { - CCLOG("PUParticle3DBoxRender::render create index buffer failed"); + AXLOG("PUParticle3DBoxRender::render create index buffer failed"); return; } _indices.resize(36 * particleSystem->getParticleQuota()); @@ -917,7 +917,7 @@ void PUSphereRender::render(Renderer* renderer, const Mat4& transform, ParticleS backend::BufferType::VERTEX, backend::BufferUsage::DYNAMIC); if (_vertexBuffer == nullptr) { - CCLOG("PUSphereRender::render create vertex buffer failed"); + AXLOG("PUSphereRender::render create vertex buffer failed"); return; } _vertices.resize(vertexCount * particleSystem->getParticleQuota()); @@ -927,7 +927,7 @@ void PUSphereRender::render(Renderer* renderer, const Mat4& transform, ParticleS backend::BufferUsage::DYNAMIC); if (_indexBuffer == nullptr) { - CCLOG("PUSphereRender::render create index buffer failed"); + AXLOG("PUSphereRender::render create index buffer failed"); return; } _indices.resize(indexCount * particleSystem->getParticleQuota()); diff --git a/extensions/Particle3D/PU/CCPURibbonTrail.cpp b/extensions/Particle3D/PU/CCPURibbonTrail.cpp index 4d75674e39..fe3c518fc0 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrail.cpp +++ b/extensions/Particle3D/PU/CCPURibbonTrail.cpp @@ -59,7 +59,7 @@ void PURibbonTrail::addNode(Node* n) { if (_nodeList.size() == _chainCount) { - CCASSERT(false, " cannot monitor any more nodes, chain count exceeded"); + AXASSERT(false, " cannot monitor any more nodes, chain count exceeded"); } // if (n->getListener()) @@ -87,7 +87,7 @@ size_t PURibbonTrail::getChainIndexForNode(const Node* n) NodeToChainSegmentMap::const_iterator i = _nodeToSegMap.find(n); if (i == _nodeToSegMap.end()) { - CCASSERT(false, "This node is not being tracked"); + AXASSERT(false, "This node is not being tracked"); } return i->second; } @@ -130,7 +130,7 @@ void PURibbonTrail::setMaxChainElements(size_t maxElements) //----------------------------------------------------------------------- void PURibbonTrail::setNumberOfChains(size_t numChains) { - CCASSERT(numChains >= _nodeList.size(), "Can't shrink the number of chains less than number of tracking nodes"); + AXASSERT(numChains >= _nodeList.size(), "Can't shrink the number of chains less than number of tracking nodes"); size_t oldChains = getNumberOfChains(); @@ -181,7 +181,7 @@ void PURibbonTrail::setInitialColour(size_t chainIndex, const Vec4& col) //----------------------------------------------------------------------- void PURibbonTrail::setInitialColour(size_t chainIndex, float r, float g, float b, float a) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); _initialColor[chainIndex].x = r; _initialColor[chainIndex].y = g; _initialColor[chainIndex].z = b; @@ -190,19 +190,19 @@ void PURibbonTrail::setInitialColour(size_t chainIndex, float r, float g, float //----------------------------------------------------------------------- const Vec4& PURibbonTrail::getInitialColour(size_t chainIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); return _initialColor[chainIndex]; } //----------------------------------------------------------------------- void PURibbonTrail::setInitialWidth(size_t chainIndex, float width) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); _initialWidth[chainIndex] = width; } //----------------------------------------------------------------------- float PURibbonTrail::getInitialWidth(size_t chainIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); return _initialWidth[chainIndex]; } //----------------------------------------------------------------------- @@ -213,7 +213,7 @@ void PURibbonTrail::setColourChange(size_t chainIndex, const Vec4& valuePerSecon //----------------------------------------------------------------------- void PURibbonTrail::setColourChange(size_t chainIndex, float r, float g, float b, float a) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); _deltaColor[chainIndex].x = r; _deltaColor[chainIndex].y = g; _deltaColor[chainIndex].z = b; @@ -224,20 +224,20 @@ void PURibbonTrail::setColourChange(size_t chainIndex, float r, float g, float b //----------------------------------------------------------------------- const Vec4& PURibbonTrail::getColourChange(size_t chainIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); return _deltaColor[chainIndex]; } //----------------------------------------------------------------------- void PURibbonTrail::setWidthChange(size_t chainIndex, float widthDeltaPerSecond) { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); _deltaWidth[chainIndex] = widthDeltaPerSecond; manageController(); } //----------------------------------------------------------------------- float PURibbonTrail::getWidthChange(size_t chainIndex) const { - CCASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); + AXASSERT(chainIndex < _chainCount, "chainIndex out of bounds"); return _deltaWidth[chainIndex]; } //----------------------------------------------------------------------- diff --git a/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp b/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp index 8fd11da706..f70fb6d37f 100644 --- a/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp +++ b/extensions/Particle3D/PU/CCPURibbonTrailRender.cpp @@ -280,7 +280,7 @@ void PURibbonTrailRender::prepare() _visualData.push_back(visualData); // Used to assign to a particle if (_randomInitialColor) { - _trail->setInitialColour(i, CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1()); + _trail->setInitialColour(i, AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1()); } else { diff --git a/extensions/Particle3D/PU/CCPUScriptTranslator.cpp b/extensions/Particle3D/PU/CCPUScriptTranslator.cpp index dca1ceb6b0..a011cd4785 100644 --- a/extensions/Particle3D/PU/CCPUScriptTranslator.cpp +++ b/extensions/Particle3D/PU/CCPUScriptTranslator.cpp @@ -739,7 +739,7 @@ bool PUScriptTranslator::passValidatePropertyValidQuaternion(PUScriptCompiler* / //------------------------------------------------------------------------- void PUScriptTranslator::errorUnexpectedToken(PUScriptCompiler* /*compiler*/, PUAbstractNode* /*token2*/) { - // CCLOGERROR("PU Compiler: token2 is not recognized tokenFile:%s tokenLine:%s",) + // AXLOGERROR("PU Compiler: token2 is not recognized tokenFile:%s tokenLine:%s",) // printf() // compiler->addError(ScriptCompiler::CE_UNEXPECTEDTOKEN, token.getPointer()->file, token.getPointer()->line, // ); diff --git a/extensions/Particle3D/PU/CCPUSimpleSpline.cpp b/extensions/Particle3D/PU/CCPUSimpleSpline.cpp index 66f86bb097..60ecfe5580 100644 --- a/extensions/Particle3D/PU/CCPUSimpleSpline.cpp +++ b/extensions/Particle3D/PU/CCPUSimpleSpline.cpp @@ -82,7 +82,7 @@ Vec3 PUSimpleSpline::interpolate(float t) const Vec3 PUSimpleSpline::interpolate(unsigned int fromIndex, float t) const { // Bounds check - CCASSERT(fromIndex < _points.size(), "fromIndex out of bounds"); + AXASSERT(fromIndex < _points.size(), "fromIndex out of bounds"); if ((fromIndex + 1) == _points.size()) { @@ -204,7 +204,7 @@ void PUSimpleSpline::recalcTangents() //--------------------------------------------------------------------- const Vec3& PUSimpleSpline::getPoint(unsigned short index) const { - CCASSERT(index < _points.size(), "Point index is out of bounds!!"); + AXASSERT(index < _points.size(), "Point index is out of bounds!!"); return _points[index]; } @@ -222,7 +222,7 @@ void PUSimpleSpline::clear() //--------------------------------------------------------------------- void PUSimpleSpline::updatePoint(unsigned short index, const Vec3& value) { - CCASSERT(index < _points.size(), "Point index is out of bounds!!"); + AXASSERT(index < _points.size(), "Point index is out of bounds!!"); _points[index] = value; if (_autoCalc) diff --git a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp index 87df8cf1da..950864c2cf 100644 --- a/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp +++ b/extensions/Particle3D/PU/CCPUSphereSurfaceEmitter.cpp @@ -49,7 +49,7 @@ void PUSphereSurfaceEmitter::initParticlePosition(PUParticle3D* particle) { // Generate a random unit vector to calculate a point on the sphere. This unit vector is // also used as direction vector if mAutoDirection has been set. - _randomVector.set(CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1(), CCRANDOM_MINUS1_1()); + _randomVector.set(AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1(), AXRANDOM_MINUS1_1()); _randomVector.normalize(); // ParticleSystem* sys = mParentTechnique->getParentSystem(); // if (sys) diff --git a/extensions/Particle3D/PU/CCPUUtil.cpp b/extensions/Particle3D/PU/CCPUUtil.cpp index e36edd17b6..43d43bda6e 100644 --- a/extensions/Particle3D/PU/CCPUUtil.cpp +++ b/extensions/Particle3D/PU/CCPUUtil.cpp @@ -54,7 +54,7 @@ axis::Vec3 PUUtil::randomDeviant(const Vec3& src, float angle, const Vec3& up /* Quaternion q; Mat4 mat; - Quaternion::createFromAxisAngle(src, CCRANDOM_0_1() * M_PI * 2.0f, &q); + Quaternion::createFromAxisAngle(src, AXRANDOM_0_1() * M_PI * 2.0f, &q); Mat4::createRotation(q, &mat); //{ diff --git a/extensions/assets-manager/AssetsManager.cpp b/extensions/assets-manager/AssetsManager.cpp index 7494c4c4ba..04d566a2e8 100644 --- a/extensions/assets-manager/AssetsManager.cpp +++ b/extensions/assets-manager/AssetsManager.cpp @@ -210,7 +210,7 @@ AssetsManager::AssetsManager(const char* packageUrl /* =nullptr */, ? int(task.progressInfo.totalBytesReceived * 100 / task.progressInfo.totalBytesExpected) : 0; _delegate->onProgress(percent); - CCLOG("downloading... %d%%", percent); + AXLOG("downloading... %d%%", percent); }; // get version from version file when get data success @@ -225,7 +225,7 @@ AssetsManager::AssetsManager(const char* packageUrl /* =nullptr */, { _delegate->onError(ErrorCode::NO_NEW_VERSION); } - CCLOG("there is not new version"); + AXLOG("there is not new version"); // Set resource search path. setSearchPath(); _isDownloading = false; @@ -238,7 +238,7 @@ AssetsManager::AssetsManager(const char* packageUrl /* =nullptr */, if (_versionFileUrl.empty() || _packageUrl.empty() || FileUtils::getInstance()->getFileExtension(_packageUrl) != ".zip") { - CCLOG("no version file url, or no package url, or the package is not a zip file"); + AXLOG("no version file url, or no package url, or the package is not a zip file"); _isDownloading = false; return; } @@ -341,7 +341,7 @@ void AssetsManager::downloadAndUncompress() string zipfileName = this->_storagePath + TEMP_PACKAGE_FILE_NAME; if (remove(zipfileName.c_str()) != 0) { - CCLOG("can not remove downloaded zip file %s", zipfileName.c_str()); + AXLOG("can not remove downloaded zip file %s", zipfileName.c_str()); } if (this->_delegate) @@ -377,7 +377,7 @@ bool AssetsManager::uncompress() unzFile zipfile = unzOpen2(outFileName.c_str(), &zipFunctionOverrides); if (!zipfile) { - CCLOG("can not open downloaded zip file %s", outFileName.c_str()); + AXLOG("can not open downloaded zip file %s", outFileName.c_str()); return false; } @@ -385,7 +385,7 @@ bool AssetsManager::uncompress() unz_global_info global_info; if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) { - CCLOG("can not read file global info of %s", outFileName.c_str()); + AXLOG("can not read file global info of %s", outFileName.c_str()); unzClose(zipfile); return false; } @@ -393,7 +393,7 @@ bool AssetsManager::uncompress() // Buffer to hold data read from the zip file char readBuffer[BUFFER_SIZE]; - CCLOG("start uncompressing"); + AXLOG("start uncompressing"); // Loop to extract all files. uLong i; @@ -404,7 +404,7 @@ bool AssetsManager::uncompress() char fileName[MAX_FILENAME]; if (unzGetCurrentFileInfo(zipfile, &fileInfo, fileName, MAX_FILENAME, nullptr, 0, nullptr, 0) != UNZ_OK) { - CCLOG("can not read file info"); + AXLOG("can not read file info"); unzClose(zipfile); return false; } @@ -419,7 +419,7 @@ bool AssetsManager::uncompress() // If the directory exists, it will failed silently. if (!FileUtils::getInstance()->createDirectory(fullPath)) { - CCLOG("can not create directory %s", fullPath.c_str()); + AXLOG("can not create directory %s", fullPath.c_str()); unzClose(zipfile); return false; } @@ -444,13 +444,13 @@ bool AssetsManager::uncompress() { if (!FileUtils::getInstance()->createDirectory(dir)) { - CCLOG("can not create directory %s", dir.c_str()); + AXLOG("can not create directory %s", dir.c_str()); unzClose(zipfile); return false; } else { - CCLOG("create directory %s", dir.c_str()); + AXLOG("create directory %s", dir.c_str()); } } else @@ -468,7 +468,7 @@ bool AssetsManager::uncompress() // Open current file. if (unzOpenCurrentFile(zipfile) != UNZ_OK) { - CCLOG("can not open file %s", fileName); + AXLOG("can not open file %s", fileName); unzClose(zipfile); return false; } @@ -477,7 +477,7 @@ bool AssetsManager::uncompress() auto fsOut = FileUtils::getInstance()->openFileStream(fullPath, FileStream::Mode::WRITE); if (!fsOut) { - CCLOG("can not open destination file %s", fullPath.c_str()); + AXLOG("can not open destination file %s", fullPath.c_str()); unzCloseCurrentFile(zipfile); unzClose(zipfile); return false; @@ -490,7 +490,7 @@ bool AssetsManager::uncompress() error = unzReadCurrentFile(zipfile, readBuffer, BUFFER_SIZE); if (error < 0) { - CCLOG("can not read zip file %s, error code is %d", fileName, error); + AXLOG("can not read zip file %s, error code is %d", fileName, error); unzCloseCurrentFile(zipfile); unzClose(zipfile); fsOut.reset(); @@ -513,14 +513,14 @@ bool AssetsManager::uncompress() { if (unzGoToNextFile(zipfile) != UNZ_OK) { - CCLOG("can not read next file"); + AXLOG("can not read next file"); unzClose(zipfile); return false; } } } - CCLOG("end uncompressing"); + AXLOG("end uncompressing"); unzClose(zipfile); return true; diff --git a/extensions/assets-manager/AssetsManagerEx.cpp b/extensions/assets-manager/AssetsManagerEx.cpp index 97ae5fdedb..329877cb88 100644 --- a/extensions/assets-manager/AssetsManagerEx.cpp +++ b/extensions/assets-manager/AssetsManagerEx.cpp @@ -323,7 +323,7 @@ void AssetsManagerEx::loadLocalManifest(std::string_view /*manifestUrl*/) // Fail to load local manifest if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + AXLOG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); } } @@ -394,7 +394,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) size_t pos = zip.find_last_of("/\\"); if (pos == std::string::npos) { - CCLOG("AssetsManagerEx : no root path specified for zip file %s\n", zip.data()); + AXLOG("AssetsManagerEx : no root path specified for zip file %s\n", zip.data()); return false; } const std::string_view rootPath = zip.substr(0, pos + 1); @@ -411,7 +411,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) unzFile zipfile = unzOpen2(zip.data(), &zipFunctionOverrides); if (!zipfile) { - CCLOG("AssetsManagerEx : can not open downloaded zip file %s\n", zip.data()); + AXLOG("AssetsManagerEx : can not open downloaded zip file %s\n", zip.data()); return false; } @@ -419,7 +419,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) unz_global_info global_info; if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read file global info of %s\n", zip.data()); + AXLOG("AssetsManagerEx : can not read file global info of %s\n", zip.data()); unzClose(zipfile); return false; } @@ -435,7 +435,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) char fileName[MAX_FILENAME]; if (unzGetCurrentFileInfo(zipfile, &fileInfo, fileName, MAX_FILENAME, NULL, 0, NULL, 0) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read compressed file info\n"); + AXLOG("AssetsManagerEx : can not read compressed file info\n"); unzClose(zipfile); return false; } @@ -451,7 +451,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) if (!_fileUtils->createDirectory(basename(fullPath))) { // Failed to create directory - CCLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); + AXLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); unzClose(zipfile); return false; } @@ -465,7 +465,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) if (!_fileUtils->createDirectory(dir)) { // Failed to create directory - CCLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); + AXLOG("AssetsManagerEx : can not create directory %s\n", fullPath.c_str()); unzClose(zipfile); return false; } @@ -474,7 +474,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) // Open current file. if (unzOpenCurrentFile(zipfile) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not extract file %s\n", fileName); + AXLOG("AssetsManagerEx : can not extract file %s\n", fileName); unzClose(zipfile); return false; } @@ -483,7 +483,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) auto fsOut = FileUtils::getInstance()->openFileStream(fullPath, FileStream::Mode::WRITE); if (!fsOut) { - CCLOG("AssetsManagerEx : can not create decompress destination file %s (errno: %d)\n", fullPath.c_str(), + AXLOG("AssetsManagerEx : can not create decompress destination file %s (errno: %d)\n", fullPath.c_str(), errno); unzCloseCurrentFile(zipfile); unzClose(zipfile); @@ -497,7 +497,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) error = unzReadCurrentFile(zipfile, readBuffer, BUFFER_SIZE); if (error < 0) { - CCLOG("AssetsManagerEx : can not read zip file %s, error code is %d\n", fileName, error); + AXLOG("AssetsManagerEx : can not read zip file %s, error code is %d\n", fileName, error); fsOut.reset(); unzCloseCurrentFile(zipfile); unzClose(zipfile); @@ -520,7 +520,7 @@ bool AssetsManagerEx::decompress(std::string_view zip) { if (unzGoToNextFile(zipfile) != UNZ_OK) { - CCLOG("AssetsManagerEx : can not read next file for decompressing\n"); + AXLOG("AssetsManagerEx : can not read next file for decompressing\n"); unzClose(zipfile); return false; } @@ -630,7 +630,7 @@ void AssetsManagerEx::downloadVersion() // No version file found else { - CCLOG("AssetsManagerEx : No version file found, step skipped\n"); + AXLOG("AssetsManagerEx : No version file found, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } @@ -645,7 +645,7 @@ void AssetsManagerEx::parseVersion() if (!_remoteManifest->isVersionLoaded()) { - CCLOG("AssetsManagerEx : Fail to parse version file, step skipped\n"); + AXLOG("AssetsManagerEx : Fail to parse version file, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } @@ -701,7 +701,7 @@ void AssetsManagerEx::downloadManifest() // No manifest file found else { - CCLOG("AssetsManagerEx : No manifest file found, check update failed\n"); + AXLOG("AssetsManagerEx : No manifest file found, check update failed\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_DOWNLOAD_MANIFEST); _updateState = State::UNCHECKED; } @@ -716,7 +716,7 @@ void AssetsManagerEx::parseManifest() if (!_remoteManifest->isLoaded()) { - CCLOG("AssetsManagerEx : Error parsing manifest file, %s", _tempManifestPath.c_str()); + AXLOG("AssetsManagerEx : Error parsing manifest file, %s", _tempManifestPath.c_str()); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_PARSE_MANIFEST); _updateState = State::UNCHECKED; } @@ -877,19 +877,19 @@ void AssetsManagerEx::checkUpdate() { if (_updateEntry != UpdateEntry::NONE) { - CCLOGERROR("AssetsManagerEx::checkUpdate, updateEntry isn't NONE"); + AXLOGERROR("AssetsManagerEx::checkUpdate, updateEntry isn't NONE"); return; } if (!_inited) { - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + AXLOG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + AXLOG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -924,19 +924,19 @@ void AssetsManagerEx::update() { if (_updateEntry != UpdateEntry::NONE) { - CCLOGERROR("AssetsManagerEx::update, updateEntry isn't NONE"); + AXLOGERROR("AssetsManagerEx::update, updateEntry isn't NONE"); return; } if (!_inited) { - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + AXLOG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } if (!_localManifest->isLoaded()) { - CCLOG("AssetsManagerEx : No local manifest file found error.\n"); + AXLOG("AssetsManagerEx : No local manifest file found error.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -998,7 +998,7 @@ void AssetsManagerEx::updateAssets(const DownloadUnits& assets) { if (!_inited) { - CCLOG("AssetsManagerEx : Manifests uninited.\n"); + AXLOG("AssetsManagerEx : Manifests uninited.\n"); dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST); return; } @@ -1031,7 +1031,7 @@ const DownloadUnits& AssetsManagerEx::getFailedAssets() const void AssetsManagerEx::downloadFailedAssets() { - CCLOG("AssetsManagerEx : Start update %lu failed assets.\n", static_cast(_failedUnits.size())); + AXLOG("AssetsManagerEx : Start update %lu failed assets.\n", static_cast(_failedUnits.size())); updateAssets(_failedUnits); } @@ -1095,7 +1095,7 @@ void AssetsManagerEx::onError(const network::DownloadTask& task, // Skip version error occurred if (task.identifier == VERSION_ID) { - CCLOG("AssetsManagerEx : Fail to download version file, step skipped\n"); + AXLOG("AssetsManagerEx : Fail to download version file, step skipped\n"); _updateState = State::PREDOWNLOAD_MANIFEST; downloadManifest(); } diff --git a/extensions/assets-manager/Manifest.cpp b/extensions/assets-manager/Manifest.cpp index e2476caa57..4ea39f2bf4 100644 --- a/extensions/assets-manager/Manifest.cpp +++ b/extensions/assets-manager/Manifest.cpp @@ -97,7 +97,7 @@ void Manifest::loadJson(std::string_view url) if (content.empty()) { - CCLOG("Fail to retrieve local file content: %s\n", url.data()); + AXLOG("Fail to retrieve local file content: %s\n", url.data()); } else { @@ -110,7 +110,7 @@ void Manifest::loadJson(std::string_view url) if (offset > 0) offset--; std::string errorSnippet = content.substr(offset, 10); - CCLOG("File parse error %d at <%s>\n", _json.GetParseError(), errorSnippet.c_str()); + AXLOG("File parse error %d at <%s>\n", _json.GetParseError(), errorSnippet.c_str()); } } } diff --git a/extensions/cocostudio/ActionTimeline/CCActionTimeline.cpp b/extensions/cocostudio/ActionTimeline/CCActionTimeline.cpp index 9641ee3599..a19b06da39 100644 --- a/extensions/cocostudio/ActionTimeline/CCActionTimeline.cpp +++ b/extensions/cocostudio/ActionTimeline/CCActionTimeline.cpp @@ -95,7 +95,7 @@ void ActionTimeline::play(std::string name, bool loop) { if (_animationInfos.find(name) == _animationInfos.end()) { - CCLOG("Can't find animation info for %s", name.c_str()); + AXLOG("Can't find animation info for %s", name.c_str()); return; } @@ -163,7 +163,7 @@ void ActionTimeline::setCurrentFrame(int frameIndex) } else { - CCLOG("frame index is not between start frame and end frame"); + AXLOG("frame index is not between start frame and end frame"); } } @@ -298,7 +298,7 @@ void ActionTimeline::addAnimationInfo(const AnimationInfo& animationInfo) { if (_animationInfos.find(animationInfo.name) != _animationInfos.end()) { - CCLOG("Animation (%s) already exists.", animationInfo.name.c_str()); + AXLOG("Animation (%s) already exists.", animationInfo.name.c_str()); return; } @@ -311,7 +311,7 @@ void ActionTimeline::removeAnimationInfo(std::string animationName) auto clipIter = _animationInfos.find(animationName); if (clipIter == _animationInfos.end()) { - CCLOG("AnimationInfo (%s) not exists.", animationName.c_str()); + AXLOG("AnimationInfo (%s) not exists.", animationName.c_str()); return; } @@ -334,7 +334,7 @@ void ActionTimeline::setAnimationEndCallFunc(const std::string animationName, st auto clipIter = _animationInfos.find(animationName); if (clipIter == _animationInfos.end()) { - CCLOG("AnimationInfo (%s) not exists.", animationName.c_str()); + AXLOG("AnimationInfo (%s) not exists.", animationName.c_str()); return; } clipIter->second.clipEndCallBack = func; diff --git a/extensions/cocostudio/ActionTimeline/CCActionTimelineCache.cpp b/extensions/cocostudio/ActionTimeline/CCActionTimelineCache.cpp index 93c308244d..22989b718e 100644 --- a/extensions/cocostudio/ActionTimeline/CCActionTimelineCache.cpp +++ b/extensions/cocostudio/ActionTimeline/CCActionTimelineCache.cpp @@ -194,7 +194,7 @@ ActionTimeline* ActionTimelineCache::loadAnimationActionWithContent(std::string_ doc.Parse<0>(content.data(), content.length()); if (doc.HasParseError()) { - CCLOG("GetParseError %d\n", doc.GetParseError()); + AXLOG("GetParseError %d\n", doc.GetParseError()); } const rapidjson::Value& json = DICTOOL->getSubDictionary_json(doc, ACTION); @@ -599,7 +599,7 @@ Timeline* ActionTimelineCache::loadTimelineWithFlatBuffers(const flatbuffers::Ti if (!frame) { - CCLOG("frame is invalid."); + AXLOG("frame is invalid."); continue; } timeline->addFrame(frame); diff --git a/extensions/cocostudio/ActionTimeline/CCBoneNode.cpp b/extensions/cocostudio/ActionTimeline/CCBoneNode.cpp index f21c43c9ee..14fa864c41 100644 --- a/extensions/cocostudio/ActionTimeline/CCBoneNode.cpp +++ b/extensions/cocostudio/ActionTimeline/CCBoneNode.cpp @@ -116,7 +116,7 @@ void BoneNode::addChild(Node* child, int localZOrder, std::string_view name) void BoneNode::addSkin(SkinNode* skin, bool isDisplay, bool hideOthers) { - CCASSERT(skin != nullptr, "Argument must be non-nil"); + AXASSERT(skin != nullptr, "Argument must be non-nil"); if (hideOthers) { for (auto& bonskin : _boneSkins) @@ -198,7 +198,7 @@ void BoneNode::addToBoneList(BoneNode* bone) _rootSkeleton->_subBonesOrderDirty = true; } else - CCLOG("already has a bone named %s in skeleton %s", bonename.data(), + AXLOG("already has a bone named %s in skeleton %s", bonename.data(), _rootSkeleton->getName().data()); } } diff --git a/extensions/cocostudio/ActionTimeline/CCFrame.cpp b/extensions/cocostudio/ActionTimeline/CCFrame.cpp index 4c6ed38050..306d199421 100644 --- a/extensions/cocostudio/ActionTimeline/CCFrame.cpp +++ b/extensions/cocostudio/ActionTimeline/CCFrame.cpp @@ -505,7 +505,7 @@ void InnerActionFrame::onEnter(Frame* /*nextFrame*/, int /*currentFrameIndex*/) } else { - CCLOG("Animation %s not exists!", _animationName.c_str()); + AXLOG("Animation %s not exists!", _animationName.c_str()); } } @@ -530,7 +530,7 @@ void InnerActionFrame::setStartFrameIndex(int frameIndex) { if (_enterWithName) { - CCLOG(" cannot set start when enter frame with name. setEnterWithName false firstly!"); + AXLOG(" cannot set start when enter frame with name. setEnterWithName false firstly!"); return; } @@ -541,7 +541,7 @@ void InnerActionFrame::setEndFrameIndex(int frameIndex) { if (_enterWithName) { - CCLOG(" cannot set end when enter frame with name. setEnterWithName false firstly!"); + AXLOG(" cannot set end when enter frame with name. setEnterWithName false firstly!"); return; } @@ -552,7 +552,7 @@ void InnerActionFrame::setAnimationName(std::string_view animationName) { if (!_enterWithName) { - CCLOG(" cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!"); + AXLOG(" cannot set aniamtioname when enter frame with index. setEnterWithName true firstly!"); return; } diff --git a/extensions/cocostudio/ActionTimeline/CSLoader.cpp b/extensions/cocostudio/ActionTimeline/CSLoader.cpp index 33977d1ef0..6b3e0e80f4 100644 --- a/extensions/cocostudio/ActionTimeline/CSLoader.cpp +++ b/extensions/cocostudio/ActionTimeline/CSLoader.cpp @@ -451,7 +451,7 @@ Node* CSLoader::loadNodeWithContent(std::string_view content) doc.Parse<0>(content.data(), content.length()); if (doc.HasParseError()) { - CCLOG("GetParseError %d\n", doc.GetParseError()); + AXLOG("GetParseError %d\n", doc.GetParseError()); } // cocos2dx version mono editor is based on @@ -566,7 +566,7 @@ Node* CSLoader::loadNode(const rapidjson::Value& json) } else { - CCLOG("Not supported NodeType: %s", nodeType.c_str()); + AXLOG("Not supported NodeType: %s", nodeType.c_str()); } return node; @@ -688,7 +688,7 @@ Node* CSLoader::loadSprite(const rapidjson::Value& json) if (!sprite) { sprite = Sprite::create(); - CCLOG("filePath is empty. Create a sprite with no texture"); + AXLOG("filePath is empty. Create a sprite with no texture"); } } else @@ -798,14 +798,14 @@ Node* CSLoader::loadWidget(const rapidjson::Value& json) customJsonDict.Parse<0>(customProperty); if (customJsonDict.HasParseError()) { - CCLOG("GetParseError %d\n", customJsonDict.GetParseError()); + AXLOG("GetParseError %d\n", customJsonDict.GetParseError()); } widgetPropertiesReader.setPropsForAllCustomWidgetFromJsonDictionary(classname, widget, customJsonDict); } else { - CCLOG("Widget or WidgetReader doesn't exists!!! Please check your protocol buffers file."); + AXLOG("Widget or WidgetReader doesn't exists!!! Please check your protocol buffers file."); } } @@ -934,7 +934,7 @@ Node* CSLoader::createNode(const Data& data, const ccNodeLoadCallback& callback) } }); - CCASSERT(readerVersion >= writterVersion, + AXASSERT(readerVersion >= writterVersion, StringUtils::format( "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), ") and the reader build id in your axis(", loader->_csBuildID.c_str(), @@ -946,7 +946,7 @@ Node* CSLoader::createNode(const Data& data, const ccNodeLoadCallback& callback) // decode plist auto textures = csparsebinary->textures(); int textureSize = csparsebinary->textures()->size(); - CCLOG("textureSize = %d", textureSize); + AXLOG("textureSize = %d", textureSize); for (int i = 0; i < textureSize; ++i) { std::string plist = textures->Get(i)->c_str(); @@ -985,12 +985,12 @@ inline void CSLoader::reconstructNestNode(axis::Node* node) if (_callbackHandlers.empty()) { _rootNode = nullptr; - CCLOG("Call back handler container has been clear."); + AXLOG("Call back handler container has been clear."); } else { _rootNode = _callbackHandlers.back(); - CCLOG("after pop back _rootNode name = %s", _rootNode->getName().data()); + AXLOG("after pop back _rootNode name = %s", _rootNode->getName().data()); } } } @@ -1010,7 +1010,7 @@ Node* CSLoader::nodeWithFlatBuffersFile(std::string_view fileName, const ccNodeL if (buf.isNull()) { - CCLOG("CSLoader::nodeWithFlatBuffersFile - failed read file: %s", fileName.data()); + AXLOG("CSLoader::nodeWithFlatBuffersFile - failed read file: %s", fileName.data()); AX_ASSERT(false); return nullptr; } @@ -1051,7 +1051,7 @@ Node* CSLoader::nodeWithFlatBuffersFile(std::string_view fileName, const ccNodeL } }); - CCASSERT(readerVersion >= writterVersion, + AXASSERT(readerVersion >= writterVersion, StringUtils::format( "%s%s%s%s%s%s%s%s%s%s", "The reader build id of your Cocos exported file(", csBuildId->c_str(), ") and the reader build id in your axis(", _csBuildID.c_str(), ") are not match.\n", @@ -1288,7 +1288,7 @@ bool CSLoader::bindCallback(std::string_view callbackName, } } - CCLOG("callBackName %s cannot be found", callbackName.data()); + AXLOG("callBackName %s cannot be found", callbackName.data()); return false; } @@ -1436,7 +1436,7 @@ Node* CSLoader::createNodeWithFlatBuffersForSimulator(std::string_view filename) // decode plist auto textures = csparsebinary->textures(); int textureSize = csparsebinary->textures()->size(); - // CCLOG("textureSize = %d", textureSize); + // AXLOG("textureSize = %d", textureSize); for (int i = 0; i < textureSize; ++i) { SpriteFrameCache::getInstance()->addSpriteFramesWithFile(textures->Get(i)->c_str()); diff --git a/extensions/cocostudio/CCArmature.cpp b/extensions/cocostudio/CCArmature.cpp index f400df5f83..a653a96422 100644 --- a/extensions/cocostudio/CCArmature.cpp +++ b/extensions/cocostudio/CCArmature.cpp @@ -125,12 +125,12 @@ bool Armature::init(std::string_view name) if (!_name.empty()) { AnimationData* animationData = armatureDataManager->getAnimationData(name); - CCASSERT(animationData, "AnimationData not exist! "); + AXASSERT(animationData, "AnimationData not exist! "); _animation->setAnimationData(animationData); ArmatureData* armatureData = armatureDataManager->getArmatureData(name); - CCASSERT(armatureData, "armatureData doesn't exists!"); + AXASSERT(armatureData, "armatureData doesn't exists!"); _armatureData = armatureData; @@ -219,8 +219,8 @@ Bone* Armature::createBone(std::string_view boneName) void Armature::addBone(Bone* bone, std::string_view parentName) { - CCASSERT(bone != nullptr, "Argument must be non-nil"); - CCASSERT(_boneDic.at(bone->getName()) == nullptr, "bone already added. It can't be added again"); + AXASSERT(bone != nullptr, "Argument must be non-nil"); + AXASSERT(_boneDic.at(bone->getName()) == nullptr, "bone already added. It can't be added again"); if (!parentName.empty()) { @@ -247,7 +247,7 @@ void Armature::addBone(Bone* bone, std::string_view parentName) void Armature::removeBone(Bone* bone, bool recursion) { - CCASSERT(bone != nullptr, "bone must be added to the bone dictionary!"); + AXASSERT(bone != nullptr, "bone must be added to the bone dictionary!"); bone->setArmature(nullptr); bone->removeFromParent(recursion); @@ -267,7 +267,7 @@ Bone* Armature::getBone(std::string_view name) const void Armature::changeBoneParent(Bone* bone, std::string_view parentName) { - CCASSERT(bone != nullptr, "bone must be added to the bone dictionary!"); + AXASSERT(bone != nullptr, "bone must be added to the bone dictionary!"); if (bone->getParentBone()) { @@ -460,7 +460,7 @@ void Armature::visit(axis::Renderer* renderer, const Mat4& parentTransform, uint // 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 Director* director = Director::getInstance(); - 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); diff --git a/extensions/cocostudio/CCArmatureAnimation.cpp b/extensions/cocostudio/CCArmatureAnimation.cpp index ed34ecce4b..03e03dc5b5 100644 --- a/extensions/cocostudio/CCArmatureAnimation.cpp +++ b/extensions/cocostudio/CCArmatureAnimation.cpp @@ -160,18 +160,18 @@ void ArmatureAnimation::play(std::string_view animationName, int durationTo, int { if (animationName.empty()) { - CCLOG("_animationData can not be null"); + AXLOG("_animationData can not be null"); return; } - // CCASSERT(_animationData, "_animationData can not be null"); + // AXASSERT(_animationData, "_animationData can not be null"); _movementData = _animationData->getMovement(animationName); if (nullptr == _movementData) { - CCLOG("_movementData can not be null"); + AXLOG("_movementData can not be null"); return; } - // CCASSERT(_movementData, "_movementData can not be null"); + // AXASSERT(_movementData, "_movementData can not be null"); //! Get key frame count _rawDuration = _movementData->duration; @@ -296,7 +296,7 @@ void ArmatureAnimation::gotoAndPlay(int frameIndex) { if (!_movementData || frameIndex < 0 || frameIndex >= _movementData->duration) { - CCLOG("Please ensure you have played a movement, and the frameIndex is in the range."); + AXLOG("Please ensure you have played a movement, and the frameIndex is in the range."); return; } diff --git a/extensions/cocostudio/CCBone.cpp b/extensions/cocostudio/CCBone.cpp index b178534c57..ecfda6e184 100644 --- a/extensions/cocostudio/CCBone.cpp +++ b/extensions/cocostudio/CCBone.cpp @@ -128,7 +128,7 @@ bool Bone::init(std::string_view name) void Bone::setBoneData(BoneData* boneData) { - CCASSERT(nullptr != boneData, "_boneData must not be nullptr"); + AXASSERT(nullptr != boneData, "_boneData must not be nullptr"); if (_boneData != boneData) { @@ -289,8 +289,8 @@ void Bone::updateZOrder() void Bone::addChildBone(Bone* child) { - CCASSERT(nullptr != child, "Argument must be non-nil"); - CCASSERT(nullptr == child->_parentBone, "child already added. It can't be added again"); + AXASSERT(nullptr != child, "Argument must be non-nil"); + AXASSERT(nullptr == child->_parentBone, "child already added. It can't be added again"); if (_children.empty()) { diff --git a/extensions/cocostudio/CCDataReaderHelper.cpp b/extensions/cocostudio/CCDataReaderHelper.cpp index 7448e66940..21bc2c4120 100644 --- a/extensions/cocostudio/CCDataReaderHelper.cpp +++ b/extensions/cocostudio/CCDataReaderHelper.cpp @@ -1131,7 +1131,7 @@ void DataReaderHelper::addDataFromJsonCache(std::string_view fileContent, DataIn json.ParseStream<0>(stream); if (json.HasParseError()) { - CCLOG("GetParseError %d\n", json.GetParseError()); + AXLOG("GetParseError %d\n", json.GetParseError()); } dataInfo->contentScale = DICTOOL->getFloatValue_json(json, CONTENT_SCALE, 1.0f); @@ -1208,7 +1208,7 @@ void DataReaderHelper::addDataFromJsonCache(std::string_view fileContent, DataIn i); // json[CONFIG_FILE_PATH][i].IsNull() ? nullptr : json[CONFIG_FILE_PATH][i].GetString(); if (path == nullptr) { - CCLOG("load CONFIG_FILE_PATH error."); + AXLOG("load CONFIG_FILE_PATH error."); return; } @@ -1753,7 +1753,7 @@ void DataReaderHelper::addDataFromBinaryCache(const char* fileContent, DataInfo* const char* path = pConfigFilePath[ii].GetValue(&tCocoLoader); if (path == nullptr) { - CCLOG("load CONFIG_FILE_PATH error."); + AXLOG("load CONFIG_FILE_PATH error."); return; } diff --git a/extensions/cocostudio/CCDisplayManager.cpp b/extensions/cocostudio/CCDisplayManager.cpp index dba1f5e1ae..dd9da15108 100644 --- a/extensions/cocostudio/CCDisplayManager.cpp +++ b/extensions/cocostudio/CCDisplayManager.cpp @@ -213,7 +213,7 @@ const axis::Vector& DisplayManager::getDecorativeDisplayList void DisplayManager::changeDisplayWithIndex(int index, bool force) { - CCASSERT(index < (int)_decoDisplayList.size(), "the _index value is out of range"); + AXASSERT(index < (int)_decoDisplayList.size(), "the _index value is out of range"); _forceChangeDisplay = force; diff --git a/extensions/cocostudio/CCSGUIReader.cpp b/extensions/cocostudio/CCSGUIReader.cpp index 5116760b74..1a57b02667 100644 --- a/extensions/cocostudio/CCSGUIReader.cpp +++ b/extensions/cocostudio/CCSGUIReader.cpp @@ -134,7 +134,7 @@ int GUIReader::getVersionInteger(const char* str) int is = atoi(s.c_str()); int iVersion = it * 1000 + ih * 100 + ite * 10 + is; - // CCLOG("iversion %d",iVersion); + // AXLOG("iversion %d",iVersion); return iVersion; /************************/ } @@ -214,7 +214,7 @@ Widget* GUIReader::widgetFromJsonFile(const char* fileName) jsonDict.Parse<0>(contentStr.c_str()); if (jsonDict.HasParseError()) { - CCLOG("GetParseError %d\n", jsonDict.GetParseError()); + AXLOG("GetParseError %d\n", jsonDict.GetParseError()); } Widget* widget = nullptr; const char* fileVersion = DICTOOL->getStringValue_json(jsonDict, "version"); @@ -402,7 +402,7 @@ Widget* GUIReader::widgetFromBinaryFile(const char* fileName) int versionInteger = this->getVersionInteger(fileVersion); if (versionInteger < 250) { - CCASSERT( + AXASSERT( 0, "You current studio doesn't support binary format, please upgrade to the latest version!"); pReader = new WidgetPropertiesReader0250(); @@ -510,7 +510,7 @@ Widget* WidgetPropertiesReader0250::createWidget(const rapidjson::Value& data, float fileDesignHeight = DICTOOL->getFloatValue_json(data, "designHeight"); if (fileDesignWidth <= 0 || fileDesignHeight <= 0) { - CCLOGERROR("Read design size error!\n"); + AXLOGERROR("Read design size error!\n"); Size winSize = Director::getInstance()->getWinSize(); GUIReader::getInstance()->storeFileDesignSize(fileName, winSize); } @@ -534,7 +534,7 @@ Widget* WidgetPropertiesReader0250::createWidget(const rapidjson::Value& data, /* *********temp********* */ // ActionManager::getInstance()->releaseActions(); /* ********************** */ - // CCLOG("file name == [%s]",fileName); + // AXLOG("file name == [%s]",fileName); Ref* rootWidget = (Ref*)widget; ActionManagerEx::getInstance()->initWithDictionary(fileName, actions, rootWidget); return widget; @@ -1287,7 +1287,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, float fileDesignHeight = DICTOOL->getFloatValue_json(data, "designHeight"); if (fileDesignWidth <= 0 || fileDesignHeight <= 0) { - CCLOGERROR("Read design size error!\n"); + AXLOGERROR("Read design size error!\n"); Size winSize = Director::getInstance()->getWinSize(); GUIReader::getInstance()->storeFileDesignSize(fileName, winSize); } @@ -1311,7 +1311,7 @@ Widget* WidgetPropertiesReader0300::createWidget(const rapidjson::Value& data, /* *********temp********* */ // ActionManager::getInstance()->releaseActions(); /* ********************** */ - // CCLOG("file name == [%s]",fileName); + // AXLOG("file name == [%s]",fileName); Ref* rootWidget = (Ref*)widget; ActionManagerEx::getInstance()->initWithDictionary(fileName, actions, rootWidget); return widget; @@ -1356,7 +1356,7 @@ axis::ui::Widget* WidgetPropertiesReader0300::createWidgetFromBinary(CocoLoader* if (fileDesignWidth <= 0 || fileDesignHeight <= 0) { - CCLOGERROR("Read design size error!\n"); + AXLOGERROR("Read design size error!\n"); Size winSize = Director::getInstance()->getWinSize(); GUIReader::getInstance()->storeFileDesignSize(fileName, winSize); } @@ -1421,7 +1421,7 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, stE } else { - CCLOG("Warning!!! classname not found!"); + AXLOG("Warning!!! classname not found!"); } } else if (key == "children") @@ -1470,13 +1470,13 @@ Widget* WidgetPropertiesReader0300::widgetFromBinary(CocoLoader* cocoLoader, stE customJsonDict.Parse<0>(customProperty); if (customJsonDict.HasParseError()) { - CCLOG("GetParseError %d\n", customJsonDict.GetParseError()); + AXLOG("GetParseError %d\n", customJsonDict.GetParseError()); } setPropsForAllCustomWidgetFromJsonDictionary(classname, widget, customJsonDict); } else { - CCLOG("Widget or WidgetReader doesn't exists!!! Please check your csb file."); + AXLOG("Widget or WidgetReader doesn't exists!!! Please check your csb file."); } } @@ -1559,7 +1559,7 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va const char* classname = DICTOOL->getStringValue_json(data, "classname"); const rapidjson::Value& uiOptions = DICTOOL->getSubDictionary_json(data, "options"); Widget* widget = this->createGUI(classname); - // CCLOG("classname = %s", classname); + // AXLOG("classname = %s", classname); std::string readerName = this->getWidgetReaderClassName(classname); WidgetReaderProtocol* reader = this->createWidgetReaderProtocol(readerName); @@ -1585,13 +1585,13 @@ Widget* WidgetPropertiesReader0300::widgetFromJsonDictionary(const rapidjson::Va customJsonDict.Parse<0>(customProperty); if (customJsonDict.HasParseError()) { - CCLOG("GetParseError %d\n", customJsonDict.GetParseError()); + AXLOG("GetParseError %d\n", customJsonDict.GetParseError()); } setPropsForAllCustomWidgetFromJsonDictionary(classname, widget, customJsonDict); } else { - CCLOG("Widget or WidgetReader doesn't exists!!! Please check your json file."); + AXLOG("Widget or WidgetReader doesn't exists!!! Please check your json file."); } } diff --git a/extensions/cocostudio/CCSSceneReader.cpp b/extensions/cocostudio/CCSSceneReader.cpp index 9a1a322a58..ee98cc0866 100644 --- a/extensions/cocostudio/CCSSceneReader.cpp +++ b/extensions/cocostudio/CCSSceneReader.cpp @@ -242,7 +242,7 @@ std::string SceneReader::getComponentClassName(std::string_view name) } else { - CCASSERT(false, "Unregistered Component!"); + AXASSERT(false, "Unregistered Component!"); } return comName; diff --git a/extensions/cocostudio/CCSkin.cpp b/extensions/cocostudio/CCSkin.cpp index dc6e2c3427..786e99b79a 100644 --- a/extensions/cocostudio/CCSkin.cpp +++ b/extensions/cocostudio/CCSkin.cpp @@ -94,7 +94,7 @@ bool Skin::initWithSpriteFrameName(std::string_view spriteFrameName) } else { - CCLOG("Can't find CCSpriteFrame with %s. Please check your .plist file", spriteFrameName.data()); + AXLOG("Can't find CCSpriteFrame with %s. Please check your .plist file", spriteFrameName.data()); ret = false; } diff --git a/extensions/cocostudio/FlatBuffersSerialize.cpp b/extensions/cocostudio/FlatBuffersSerialize.cpp index d091de9614..05eca9e327 100644 --- a/extensions/cocostudio/FlatBuffersSerialize.cpp +++ b/extensions/cocostudio/FlatBuffersSerialize.cpp @@ -176,7 +176,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque, s pugi::xml_document& document = *reinterpret_cast(opaque); pugi::xml_node rootElement = document.document_element(); // Root - // CCLOG("rootElement name = %s", rootelement.name()); + // AXLOG("rootElement name = %s", rootelement.name()); pugi::xml_node element = rootElement.first_child(); @@ -185,7 +185,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque, s while (element) { - // CCLOG("entity name = %s", element.name()); + // AXLOG("entity name = %s", element.name()); if ("PropertyGroup"sv == element.name()) { auto attribute = element.first_attribute(); @@ -214,7 +214,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque, s // { // std::string name = attribute.name(); // std::string_view value = attribute.value(); - // CCLOG("attribute name = %s, value = %s", name, value); + // AXLOG("attribute name = %s, value = %s", name, value); // if (name == "") // { // serializeEnabled = true; @@ -328,7 +328,7 @@ std::string FlatBuffersSerialize::serializeFlatBuffersWithOpaque(void* opaque, s Offset FlatBuffersSerialize::createNodeTree(pugi::xml_node objectData, std::string_view classType) { auto classname = classType.substr(0, classType.find("ObjectData")); - // CCLOG("classname = %s", classname.c_str()); + // AXLOG("classname = %s", classname.c_str()); Offset options; std::vector> children; @@ -366,7 +366,7 @@ Offset FlatBuffersSerialize::createNodeTree(pugi::xml_node objectData, while (child) { - // CCLOG("child name = %s", child.name()); + // AXLOG("child name = %s", child.name()); if ("Children" == child.name()) { @@ -380,7 +380,7 @@ Offset FlatBuffersSerialize::createNodeTree(pugi::xml_node objectData, if (containChildrenElement) { child = child.first_child(); - // CCLOG("element name = %s", child.name()); + // AXLOG("element name = %s", child.name()); while (child) { @@ -555,7 +555,7 @@ Offset FlatBuffersSerialize::createNodeAction(pugi::xml_node objectD float speed = 0.0f; std::string currentAnimationName; - // CCLOG("animation name = %s", objectData->Name()); + // AXLOG("animation name = %s", objectData->Name()); // ActionTimeline auto attribute = objectData.first_attribute(); @@ -1238,7 +1238,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato // xml read if (!FileUtils::getInstance()->isFileExist(inFullpath)) { - // CCLOG(".csd file does not exist."); + // AXLOG(".csd file does not exist."); } std::string content = FileUtils::getInstance()->getStringFromFile(inFullpath); @@ -1249,7 +1249,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato document.load_buffer_inplace(&content.front(), content.length()); pugi::xml_node rootElement = document.document_element(); // Root - // CCLOG("rootElement name = %s", rootelement.name()); + // AXLOG("rootElement name = %s", rootelement.name()); pugi::xml_node element = rootElement.first_child(); @@ -1258,7 +1258,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato while (element) { - // CCLOG("entity name = %s", element.name()); + // AXLOG("entity name = %s", element.name()); if ("PropertyGroup"sv == element.name()) { auto attribute = element.first_attribute(); @@ -1361,7 +1361,7 @@ FlatBufferBuilder* FlatBuffersSerialize::createFlatBuffersWithXMLFileForSimulato Offset FlatBuffersSerialize::createNodeTreeForSimulator(pugi::xml_node objectData, std::string_view classType) { auto classname = classType.substr(0, classType.find("ObjectData")); - // CCLOG("classname = %s", classname.c_str()); + // AXLOG("classname = %s", classname.c_str()); Offset options; std::vector> children; @@ -1399,7 +1399,7 @@ Offset FlatBuffersSerialize::createNodeTreeForSimulator(pugi::xml_node while (child) { - // CCLOG("child name = %s", child.name()); + // AXLOG("child name = %s", child.name()); if ("Children"sv == child.name()) { @@ -1413,7 +1413,7 @@ Offset FlatBuffersSerialize::createNodeTreeForSimulator(pugi::xml_node if (containChildrenElement) { child = child.first_child(); - // CCLOG("element name = %s", child.name()); + // AXLOG("element name = %s", child.name()); while (child) { diff --git a/extensions/cocostudio/TriggerMng.cpp b/extensions/cocostudio/TriggerMng.cpp index 07034fd863..1204950e8e 100644 --- a/extensions/cocostudio/TriggerMng.cpp +++ b/extensions/cocostudio/TriggerMng.cpp @@ -75,7 +75,7 @@ void TriggerMng::destroyInstance() void TriggerMng::parse(const rapidjson::Value& root) { - CCLOG("%s", triggerMngVersion()); + AXLOG("%s", triggerMngVersion()); int count = DICTOOL->getArrayCount_json(root, "Triggers"); #if AX_ENABLE_SCRIPT_BINDING @@ -110,7 +110,7 @@ void TriggerMng::parse(const rapidjson::Value& root) void TriggerMng::parse(cocostudio::CocoLoader* pCocoLoader, cocostudio::stExpCocoNode* pCocoNode) { - CCLOG("%s", triggerMngVersion()); + AXLOG("%s", triggerMngVersion()); int count = pCocoNode[13].GetChildNum(); stExpCocoNode* pTriggersArray = pCocoNode[13].GetChildArray(pCocoLoader); diff --git a/extensions/cocostudio/TriggerObj.cpp b/extensions/cocostudio/TriggerObj.cpp index 06f2026f62..699f07856b 100644 --- a/extensions/cocostudio/TriggerObj.cpp +++ b/extensions/cocostudio/TriggerObj.cpp @@ -157,11 +157,11 @@ void TriggerObj::serialize(const rapidjson::Value& val) dynamic_cast(ObjectFactory::getInstance()->createObject(classname)); if (con == nullptr) { - CCLOG("class %s can not be implemented!", classname); - CCASSERT(con != nullptr, "con can't be nullptr!"); + AXLOG("class %s can not be implemented!", classname); + AXASSERT(con != nullptr, "con can't be nullptr!"); } - CCASSERT(con != nullptr, "con can't be nullptr!"); + AXASSERT(con != nullptr, "con can't be nullptr!"); con->serialize(subDict); con->init(); _cons.pushBack(con); @@ -180,8 +180,8 @@ void TriggerObj::serialize(const rapidjson::Value& val) dynamic_cast(ObjectFactory::getInstance()->createObject(classname)); if (act == nullptr) { - CCLOG("class %s can not be implemented!", classname); - CCASSERT(act != nullptr, "act can't be nullptr!"); + AXLOG("class %s can not be implemented!", classname); + AXASSERT(act != nullptr, "act can't be nullptr!"); } act->serialize(subDict); act->init(); diff --git a/extensions/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp b/extensions/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp index 486b97da70..4102402553 100644 --- a/extensions/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp +++ b/extensions/cocostudio/WidgetReader/TextAtlasReader/TextAtlasReader.cpp @@ -122,7 +122,7 @@ void TextAtlasReader::setPropsFromJsonDictionary(Widget* widget, const rapidjson break; } case 1: - CCLOG("Wrong res type of LabelAtlas!"); + AXLOG("Wrong res type of LabelAtlas!"); break; default: break; @@ -254,7 +254,7 @@ void TextAtlasReader::setPropsWithFlatBuffers(axis::Node* node, const flatbuffer } case 1: - CCLOG("Wrong res type of LabelAtlas!"); + AXLOG("Wrong res type of LabelAtlas!"); break; default: diff --git a/extensions/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp b/extensions/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp index 1a3632718c..491ce5909b 100644 --- a/extensions/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp +++ b/extensions/cocostudio/WidgetReader/TextBMFontReader/TextBMFontReader.cpp @@ -99,7 +99,7 @@ void TextBMFontReader::setPropsFromJsonDictionary(Widget* widget, const rapidjso break; } case 1: - CCLOG("Wrong res type of LabelAtlas!"); + AXLOG("Wrong res type of LabelAtlas!"); break; default: break; diff --git a/extensions/cocostudio/WidgetReader/WidgetReader.cpp b/extensions/cocostudio/WidgetReader/WidgetReader.cpp index 6c4dcb0232..81b78a0d9c 100644 --- a/extensions/cocostudio/WidgetReader/WidgetReader.cpp +++ b/extensions/cocostudio/WidgetReader/WidgetReader.cpp @@ -321,7 +321,7 @@ std::string WidgetReader::getResourcePath(const rapidjson::Value& dict, } else { - CCASSERT(0, "invalid TextureResType!!!"); + AXASSERT(0, "invalid TextureResType!!!"); } } return imageFileName_tp; @@ -354,7 +354,7 @@ std::string WidgetReader::getResourcePath(CocoLoader* cocoLoader, } else { - CCASSERT(0, "invalid TextureResType!!!"); + AXASSERT(0, "invalid TextureResType!!!"); } } return imageFileName_tp; @@ -956,7 +956,7 @@ std::string WidgetReader::getResourcePath(std::string_view path, axis::ui::Widge } else { - CCASSERT(0, "invalid TextureResType!!!"); + AXASSERT(0, "invalid TextureResType!!!"); } } return imageFileName_tp; diff --git a/extensions/fairygui/Controller.cpp b/extensions/fairygui/Controller.cpp index 9382210259..f106cb7ac0 100644 --- a/extensions/fairygui/Controller.cpp +++ b/extensions/fairygui/Controller.cpp @@ -25,7 +25,7 @@ void GController::setSelectedIndex(int value, bool triggerEvent) { if (_selectedIndex != value) { - CCASSERT(value < (int)_pageIds.size(), "Invalid selected index"); + AXASSERT(value < (int)_pageIds.size(), "Invalid selected index"); changing = true; diff --git a/extensions/fairygui/GComboBox.cpp b/extensions/fairygui/GComboBox.cpp index 154733093f..b19ec37a26 100644 --- a/extensions/fairygui/GComboBox.cpp +++ b/extensions/fairygui/GComboBox.cpp @@ -307,12 +307,12 @@ void GComboBox::constructExtension(ByteBuffer* buffer) if (!dropdown.empty()) { _dropdown = dynamic_cast(UIPackage::createObjectFromURL(dropdown)); - CCASSERT(_dropdown != nullptr, "FairyGUI: should be a component."); + AXASSERT(_dropdown != nullptr, "FairyGUI: should be a component."); _dropdown->retain(); _list = dynamic_cast(_dropdown->getChild("list")); - CCASSERT(_list != nullptr, "FairyGUI: should container a list component named list."); + AXASSERT(_list != nullptr, "FairyGUI: should container a list component named list."); _list->addEventListener(UIEventType::ClickItem, AX_CALLBACK_1(GComboBox::onClickItem, this)); diff --git a/extensions/fairygui/GComponent.cpp b/extensions/fairygui/GComponent.cpp index af0bce8028..1adc721387 100644 --- a/extensions/fairygui/GComponent.cpp +++ b/extensions/fairygui/GComponent.cpp @@ -66,7 +66,7 @@ GObject* GComponent::addChild(GObject* child) GObject* GComponent::addChildAt(GObject* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); if (child->_parent == this) { @@ -121,7 +121,7 @@ int GComponent::getInsertPosForSortingChild(GObject* target) void GComponent::removeChild(GObject* child) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int childIndex = (int)_children.getIndex(child); if (childIndex != -1) @@ -130,7 +130,7 @@ void GComponent::removeChild(GObject* child) void GComponent::removeChildAt(int index) { - CCASSERT(index >= 0 && index < _children.size(), "Invalid child index"); + AXASSERT(index >= 0 && index < _children.size(), "Invalid child index"); GObject* child = _children.at(index); @@ -162,7 +162,7 @@ void GComponent::removeChildren(int beginIndex, int endIndex) GObject* GComponent::getChildAt(int index) const { - CCASSERT(index >= 0 && index < _children.size(), "Invalid child index"); + AXASSERT(index >= 0 && index < _children.size(), "Invalid child index"); return _children.at(index); } @@ -211,7 +211,7 @@ GObject* GComponent::getChildByPath(const std::string& path) const GObject* GComponent::getChildInGroup(const GGroup* group, const std::string& name) const { - CCASSERT(group != nullptr, "Argument must be non-nil"); + AXASSERT(group != nullptr, "Argument must be non-nil"); for (const auto& child : _children) { @@ -235,17 +235,17 @@ GObject* GComponent::getChildById(const std::string& id) const int GComponent::getChildIndex(const GObject* child) const { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); return (int)_children.getIndex((GObject*)child); } void GComponent::setChildIndex(GObject* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int oldIndex = (int)_children.getIndex(child); - CCASSERT(oldIndex != -1, "Not a child of this container"); + AXASSERT(oldIndex != -1, "Not a child of this container"); if (child->_sortingOrder != 0) //no effect return; @@ -262,10 +262,10 @@ void GComponent::setChildIndex(GObject* child, int index) int GComponent::setChildIndexBefore(GObject* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int oldIndex = (int)_children.getIndex(child); - CCASSERT(oldIndex != -1, "Not a child of this container"); + AXASSERT(oldIndex != -1, "Not a child of this container"); if (child->_sortingOrder != 0) //no effect return oldIndex; @@ -335,14 +335,14 @@ int GComponent::moveChild(GObject* child, int oldIndex, int index) void GComponent::swapChildren(GObject* child1, GObject* child2) { - CCASSERT(child1 != nullptr, "Argument1 must be non-nil"); - CCASSERT(child2 != nullptr, "Argument2 must be non-nil"); + AXASSERT(child1 != nullptr, "Argument1 must be non-nil"); + AXASSERT(child2 != nullptr, "Argument2 must be non-nil"); int index1 = (int)_children.getIndex(child1); int index2 = (int)_children.getIndex(child2); - CCASSERT(index1 != -1, "Not a child of this container"); - CCASSERT(index2 != -1, "Not a child of this container"); + AXASSERT(index1 != -1, "Not a child of this container"); + AXASSERT(index2 != -1, "Not a child of this container"); swapChildrenAt(index1, index2); } @@ -417,24 +417,24 @@ GController* GComponent::getController(const std::string& name) const void GComponent::addController(GController* c) { - CCASSERT(c != nullptr, "Argument must be non-nil"); + AXASSERT(c != nullptr, "Argument must be non-nil"); _controllers.pushBack(c); } GController* GComponent::getControllerAt(int index) const { - CCASSERT(index >= 0 && index < _controllers.size(), "Invalid controller index"); + AXASSERT(index >= 0 && index < _controllers.size(), "Invalid controller index"); return _controllers.at(index); } void GComponent::removeController(GController* c) { - CCASSERT(c != nullptr, "Argument must be non-nil"); + AXASSERT(c != nullptr, "Argument must be non-nil"); ssize_t index = _controllers.getIndex(c); - CCASSERT(index != -1, "controller not exists"); + AXASSERT(index != -1, "controller not exists"); c->setParent(nullptr); applyController(c); @@ -473,7 +473,7 @@ Transition* GComponent::getTransition(const std::string& name) const Transition* GComponent::getTransitionAt(int index) const { - CCASSERT(index >= 0 && index < _transitions.size(), "Invalid transition index"); + AXASSERT(index >= 0 && index < _transitions.size(), "Invalid transition index"); return _transitions.at(index); } diff --git a/extensions/fairygui/GList.cpp b/extensions/fairygui/GList.cpp index ab8288e4b9..8f392e249d 100644 --- a/extensions/fairygui/GList.cpp +++ b/extensions/fairygui/GList.cpp @@ -882,7 +882,7 @@ void GList::scrollToView(int index, bool ani, bool setFirst) checkVirtualList(); - CCASSERT(index >= 0 && index < (int)_virtualItems.size(), "Invalid child index"); + AXASSERT(index >= 0 && index < (int)_virtualItems.size(), "Invalid child index"); if (_loop) index = floor(_firstIndex / _numItems) * _numItems + index; @@ -996,11 +996,11 @@ void GList::setVirtual(bool loop) { if (!_virtual) { - CCASSERT(_scrollPane != nullptr, "FairyGUI: Virtual list must be scrollable!"); + AXASSERT(_scrollPane != nullptr, "FairyGUI: Virtual list must be scrollable!"); if (loop) { - CCASSERT(_layout != ListLayoutType::FLOW_HORIZONTAL && _layout != ListLayoutType::FLOW_VERTICAL, + AXASSERT(_layout != ListLayoutType::FLOW_HORIZONTAL && _layout != ListLayoutType::FLOW_VERTICAL, "FairyGUI: Loop list is not supported for FlowHorizontal or FlowVertical layout!"); _scrollPane->setBouncebackEffect(false); @@ -1013,7 +1013,7 @@ void GList::setVirtual(bool loop) if (_itemSize.x == 0 || _itemSize.y == 0) { GObject* obj = getFromPool(); - CCASSERT(obj != nullptr, "FairyGUI: Virtual List must have a default list item resource."); + AXASSERT(obj != nullptr, "FairyGUI: Virtual List must have a default list item resource."); _itemSize = obj->getSize(); _itemSize.x = ceil(_itemSize.x); _itemSize.y = ceil(_itemSize.y); @@ -1050,7 +1050,7 @@ void GList::setNumItems(int value) { if (_virtual) { - CCASSERT(itemRenderer != nullptr, "FairyGUI: Set itemRenderer first!"); + AXASSERT(itemRenderer != nullptr, "FairyGUI: Set itemRenderer first!"); _numItems = value; if (_loop) @@ -1108,7 +1108,7 @@ void GList::setNumItems(int value) void GList::refreshVirtualList() { - CCASSERT(_virtual, "FairyGUI: not virtual list"); + AXASSERT(_virtual, "FairyGUI: not virtual list"); setVirtualListChangedFlag(false); } @@ -1445,7 +1445,7 @@ void GList::handleScroll(bool forceUpdate) forceUpdate = false; if (enterCounter > 20) { - CCLOG("FairyGUI: list will never be filled as the item renderer function always returns a different size."); + AXLOG("FairyGUI: list will never be filled as the item renderer function always returns a different size."); break; } } @@ -1460,7 +1460,7 @@ void GList::handleScroll(bool forceUpdate) forceUpdate = false; if (enterCounter > 20) { - CCLOG("FairyGUI: list will never be filled as the item renderer function always returns a different size."); + AXLOG("FairyGUI: list will never be filled as the item renderer function always returns a different size."); break; } } diff --git a/extensions/fairygui/GRoot.cpp b/extensions/fairygui/GRoot.cpp index d0da72ab1b..b4cfca9340 100644 --- a/extensions/fairygui/GRoot.cpp +++ b/extensions/fairygui/GRoot.cpp @@ -418,7 +418,7 @@ void GRoot::showTooltips(const std::string& msg) const std::string& resourceURL = UIConfig::tooltipsWin; if (resourceURL.empty()) { - CCLOGWARN("FairyGUI: UIConfig.tooltipsWin not defined"); + AXLOGWARN("FairyGUI: UIConfig.tooltipsWin not defined"); return; } diff --git a/extensions/fairygui/GScrollBar.cpp b/extensions/fairygui/GScrollBar.cpp index ec15f4bf71..92cb9593ab 100644 --- a/extensions/fairygui/GScrollBar.cpp +++ b/extensions/fairygui/GScrollBar.cpp @@ -71,9 +71,9 @@ void GScrollBar::constructExtension(ByteBuffer* buffer) _fixedGripSize = buffer->readBool(); _grip = getChild("grip"); - CCASSERT(_grip != nullptr, "FairyGUI: should define grip"); + AXASSERT(_grip != nullptr, "FairyGUI: should define grip"); _bar = getChild("bar"); - CCASSERT(_bar != nullptr, "FairyGUI: should define bar"); + AXASSERT(_bar != nullptr, "FairyGUI: should define bar"); _arrowButton1 = getChild("arrow1"); _arrowButton2 = getChild("arrow2"); diff --git a/extensions/fairygui/GTree.cpp b/extensions/fairygui/GTree.cpp index 0f86d57d8e..a24140b170 100644 --- a/extensions/fairygui/GTree.cpp +++ b/extensions/fairygui/GTree.cpp @@ -92,7 +92,7 @@ void GTree::createCell(GTreeNode* node) { const std::string& url = node->_resURL.empty() ? getDefaultItem() : node->_resURL; GComponent* child = getItemPool()->getObject(url)->as(); - CCASSERT(child, "Unable to create tree cell"); + AXASSERT(child, "Unable to create tree cell"); child->_treeNode = node; if (node->_cell != child) { diff --git a/extensions/fairygui/GTreeNode.cpp b/extensions/fairygui/GTreeNode.cpp index ddf015db10..150230ac74 100644 --- a/extensions/fairygui/GTreeNode.cpp +++ b/extensions/fairygui/GTreeNode.cpp @@ -106,7 +106,7 @@ GTreeNode* GTreeNode::addChild(GTreeNode* child) GTreeNode* GTreeNode::addChildAt(GTreeNode* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); if (child->_parent == this) { @@ -136,7 +136,7 @@ GTreeNode* GTreeNode::addChildAt(GTreeNode* child, int index) void GTreeNode::removeChild(GTreeNode* child) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int childIndex = (int)_children.getIndex(child); if (childIndex != -1) @@ -145,7 +145,7 @@ void GTreeNode::removeChild(GTreeNode* child) void GTreeNode::removeChildAt(int index) { - CCASSERT(index >= 0 && index < _children.size(), "Invalid child index"); + AXASSERT(index >= 0 && index < _children.size(), "Invalid child index"); GTreeNode* child = _children.at(index); child->_parent = nullptr; @@ -170,7 +170,7 @@ void GTreeNode::removeChildren(int beginIndex, int endIndex) GTreeNode* GTreeNode::getChildAt(int index) const { - CCASSERT(index >= 0 && index < _children.size(), "Invalid child index"); + AXASSERT(index >= 0 && index < _children.size(), "Invalid child index"); return _children.at(index); } @@ -201,27 +201,27 @@ GTreeNode* GTreeNode::getNextSibling() const int GTreeNode::getChildIndex(const GTreeNode* child) const { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); return (int)_children.getIndex((GTreeNode*)child); } void GTreeNode::setChildIndex(GTreeNode* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int oldIndex = (int)_children.getIndex(child); - CCASSERT(oldIndex != -1, "Not a child of this container"); + AXASSERT(oldIndex != -1, "Not a child of this container"); moveChild(child, oldIndex, index); } int GTreeNode::setChildIndexBefore(GTreeNode* child, int index) { - CCASSERT(child != nullptr, "Argument must be non-nil"); + AXASSERT(child != nullptr, "Argument must be non-nil"); int oldIndex = (int)_children.getIndex(child); - CCASSERT(oldIndex != -1, "Not a child of this container"); + AXASSERT(oldIndex != -1, "Not a child of this container"); if (oldIndex < index) return moveChild(child, oldIndex, index - 1); @@ -253,14 +253,14 @@ int GTreeNode::moveChild(GTreeNode* child, int oldIndex, int index) void GTreeNode::swapChildren(GTreeNode* child1, GTreeNode* child2) { - CCASSERT(child1 != nullptr, "Argument1 must be non-nil"); - CCASSERT(child2 != nullptr, "Argument2 must be non-nil"); + AXASSERT(child1 != nullptr, "Argument1 must be non-nil"); + AXASSERT(child2 != nullptr, "Argument2 must be non-nil"); int index1 = (int)_children.getIndex(child1); int index2 = (int)_children.getIndex(child2); - CCASSERT(index1 != -1, "Not a child of this container"); - CCASSERT(index2 != -1, "Not a child of this container"); + AXASSERT(index1 != -1, "Not a child of this container"); + AXASSERT(index2 != -1, "Not a child of this container"); swapChildrenAt(index1, index2); } diff --git a/extensions/fairygui/PopupMenu.cpp b/extensions/fairygui/PopupMenu.cpp index 30d45b4c7a..9c990478bd 100644 --- a/extensions/fairygui/PopupMenu.cpp +++ b/extensions/fairygui/PopupMenu.cpp @@ -43,7 +43,7 @@ bool PopupMenu::init(const std::string & resourceURL) url = UIConfig::popupMenu; if (url.empty()) { - CCLOGWARN("FairyGUI: UIConfig.popupMenu not defined"); + AXLOGWARN("FairyGUI: UIConfig.popupMenu not defined"); return false; } } @@ -100,7 +100,7 @@ void PopupMenu::addSeperator() { if (UIConfig::popupMenu_seperator.empty()) { - CCLOGWARN("FairyGUI: UIConfig.popupMenu_seperator not defined"); + AXLOGWARN("FairyGUI: UIConfig.popupMenu_seperator not defined"); return; } diff --git a/extensions/fairygui/Relations.cpp b/extensions/fairygui/Relations.cpp index 793086b967..e7b53c96f0 100644 --- a/extensions/fairygui/Relations.cpp +++ b/extensions/fairygui/Relations.cpp @@ -23,7 +23,7 @@ void Relations::add(GObject * target, RelationType relationType) void Relations::add(GObject * target, RelationType relationType, bool usePercent) { - CCASSERT(target, "target is null"); + AXASSERT(target, "target is null"); for (auto it = _items.begin(); it != _items.end(); ++it) { diff --git a/extensions/fairygui/ScrollPane.cpp b/extensions/fairygui/ScrollPane.cpp index 4faa914db0..232439582d 100644 --- a/extensions/fairygui/ScrollPane.cpp +++ b/extensions/fairygui/ScrollPane.cpp @@ -162,7 +162,7 @@ void ScrollPane::setup(ByteBuffer* buffer) { _vtScrollBar = dynamic_cast(UIPackage::createObjectFromURL(res)); if (_vtScrollBar == nullptr) - CCLOGWARN("FairyGUI: cannot create scrollbar from %s", res.c_str()); + AXLOGWARN("FairyGUI: cannot create scrollbar from %s", res.c_str()); else { _vtScrollBar->retain(); @@ -179,7 +179,7 @@ void ScrollPane::setup(ByteBuffer* buffer) { _hzScrollBar = dynamic_cast(UIPackage::createObjectFromURL(res)); if (_hzScrollBar == nullptr) - CCLOGWARN("FairyGUI: cannot create scrollbar from %s", res.c_str()); + AXLOGWARN("FairyGUI: cannot create scrollbar from %s", res.c_str()); else { _hzScrollBar->retain(); @@ -209,7 +209,7 @@ void ScrollPane::setup(ByteBuffer* buffer) { _header = dynamic_cast(UIPackage::createObjectFromURL(headerRes)); if (_header == nullptr) - CCLOGWARN("FairyGUI: cannot create scrollPane header from %s", headerRes.c_str()); + AXLOGWARN("FairyGUI: cannot create scrollPane header from %s", headerRes.c_str()); else { _header->retain(); @@ -223,7 +223,7 @@ void ScrollPane::setup(ByteBuffer* buffer) { _footer = dynamic_cast(UIPackage::createObjectFromURL(footerRes)); if (_footer == nullptr) - CCLOGWARN("FairyGUI: cannot create scrollPane footer from %s", footerRes.c_str()); + AXLOGWARN("FairyGUI: cannot create scrollPane footer from %s", footerRes.c_str()); else { _footer->retain(); diff --git a/extensions/fairygui/UIObjectFactory.cpp b/extensions/fairygui/UIObjectFactory.cpp index d80178c32b..66c7f45973 100644 --- a/extensions/fairygui/UIObjectFactory.cpp +++ b/extensions/fairygui/UIObjectFactory.cpp @@ -31,7 +31,7 @@ void UIObjectFactory::setPackageItemExtension(const string& url, GComponentCreat { if (url.size() == 0) { - CCLOG("Invaild url: %s", url.c_str()); + AXLOG("Invaild url: %s", url.c_str()); return; } PackageItem* pi = UIPackage::getItemByURL(url); diff --git a/extensions/fairygui/UIPackage.cpp b/extensions/fairygui/UIPackage.cpp index 3e7baf60b6..35cff5f664 100644 --- a/extensions/fairygui/UIPackage.cpp +++ b/extensions/fairygui/UIPackage.cpp @@ -108,7 +108,7 @@ UIPackage* UIPackage::addPackage(const string& assetPath) if (FileUtils::getInstance()->getContents(assetPath + ".fui", &data) != FileUtils::Status::OK) { - CCLOGERROR("FairyGUI: cannot load package from '%s'", assetPath.c_str()); + AXLOGERROR("FairyGUI: cannot load package from '%s'", assetPath.c_str()); return nullptr; } @@ -151,7 +151,7 @@ void UIPackage::removePackage(const string& packageIdOrName) pkg->release(); } else - CCLOGERROR("FairyGUI: invalid package name or id: %s", packageIdOrName.c_str()); + AXLOGERROR("FairyGUI: invalid package name or id: %s", packageIdOrName.c_str()); } void UIPackage::removeAllPackages() @@ -171,7 +171,7 @@ GObject* UIPackage::createObject(const string& pkgName, const string& resName) return pkg->createObject(resName); else { - CCLOGERROR("FairyGUI: package not found - %s", pkgName.c_str()); + AXLOGERROR("FairyGUI: package not found - %s", pkgName.c_str()); return nullptr; } } @@ -183,7 +183,7 @@ GObject* UIPackage::createObjectFromURL(const string& url) return pi->owner->createObject(pi); else { - CCLOGERROR("FairyGUI: resource not found - %s", url.c_str()); + AXLOGERROR("FairyGUI: resource not found - %s", url.c_str()); return nullptr; } } @@ -309,7 +309,7 @@ PackageItem* UIPackage::getItemByName(const string& itemName) GObject* UIPackage::createObject(const string& resName) { PackageItem* pi = getItemByName(resName); - CCASSERT(pi, StringUtils::format("FairyGUI: resource not found - %s in %s", + AXASSERT(pi, StringUtils::format("FairyGUI: resource not found - %s in %s", resName.c_str(), _name.c_str()) .c_str()); @@ -332,7 +332,7 @@ bool UIPackage::loadPackage(ByteBuffer* buffer) { if (buffer->readUint() != 0x46475549) { - CCLOGERROR("FairyGUI: old package format found in '%s'", _assetPath.c_str()); + AXLOGERROR("FairyGUI: old package format found in '%s'", _assetPath.c_str()); return false; } @@ -613,7 +613,7 @@ void UIPackage::loadAtlas(PackageItem* item) #if COCOS2D_VERSION < 0x00031702 Image::setPNGPremultipliedAlphaEnabled(true); #endif - CCLOGWARN("FairyGUI: texture '%s' not found in %s", item->file.c_str(), _name.c_str()); + AXLOGWARN("FairyGUI: texture '%s' not found in %s", item->file.c_str(), _name.c_str()); return; } #if COCOS2D_VERSION < 0x00031702 diff --git a/extensions/fairygui/display/FUIContainer.cpp b/extensions/fairygui/display/FUIContainer.cpp index 35555e7671..c83b4856fb 100644 --- a/extensions/fairygui/display/FUIContainer.cpp +++ b/extensions/fairygui/display/FUIContainer.cpp @@ -381,7 +381,7 @@ void FUIContainer::visit(axis::Renderer * renderer, const axis::Mat4 & parentTra // 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 Director* director = Director::getInstance(); - 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); diff --git a/extensions/fairygui/display/FUIRichText.cpp b/extensions/fairygui/display/FUIRichText.cpp index 200d081c0f..328c7f6a5d 100644 --- a/extensions/fairygui/display/FUIRichText.cpp +++ b/extensions/fairygui/display/FUIRichText.cpp @@ -50,7 +50,7 @@ static float getPaddingAmount(TextHAlignment alignment, const float leftOver) { case TextHAlignment::RIGHT: return leftOver; default: - CCASSERT(false, "invalid horizontal alignment!"); + AXASSERT(false, "invalid horizontal alignment!"); return 0.f; } } @@ -91,16 +91,16 @@ static std::string getSubStringOfUTF8String(const std::string& str, std::string: { std::u32string utf32; if (!StringUtils::UTF8ToUTF32(str, utf32)) { - CCLOGERROR("Can't convert string to UTF-32: %s", str.c_str()); + AXLOGERROR("Can't convert string to UTF-32: %s", str.c_str()); return ""; } if (utf32.size() < start) { - CCLOGERROR("'start' is out of range: %ld, %s", static_cast(start), str.c_str()); + AXLOGERROR("'start' is out of range: %ld, %s", static_cast(start), str.c_str()); return ""; } std::string result; if (!StringUtils::UTF32ToUTF8(utf32.substr(start, length), result)) { - CCLOGERROR("Can't convert internal UTF-32 string to UTF-8: %s", str.c_str()); + AXLOGERROR("Can't convert internal UTF-32 string to UTF-8: %s", str.c_str()); return ""; } return result; diff --git a/extensions/fairygui/display/FUISprite.cpp b/extensions/fairygui/display/FUISprite.cpp index 39b0aa6739..34fcef3468 100644 --- a/extensions/fairygui/display/FUISprite.cpp +++ b/extensions/fairygui/display/FUISprite.cpp @@ -346,7 +346,7 @@ void FUISprite::updateRadial(void) triangleCount = _vertexDataCount - 2; _vertexData = (V3F_C4B_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); _vertexIndex = (unsigned short *)malloc(triangleCount * 3 * sizeof(*_vertexIndex)); - CCASSERT(_vertexData, "FUISprite. Not enough memory"); + AXASSERT(_vertexData, "FUISprite. Not enough memory"); } else { @@ -435,7 +435,7 @@ void FUISprite::updateBar(void) _vertexDataCount = 4; _vertexData = (V3F_C4B_T2F*)malloc(_vertexDataCount * sizeof(*_vertexData)); _vertexIndex = (unsigned short*)malloc(6 * sizeof(*_vertexIndex)); - CCASSERT(_vertexData, "FUISprite. Not enough memory"); + AXASSERT(_vertexData, "FUISprite. Not enough memory"); } // TOPLEFT _vertexData[0].texCoords = textureCoordFromAlphaPoint(Vec2(min.x, max.y)); diff --git a/extensions/fairygui/utils/html/HtmlObject.cpp b/extensions/fairygui/utils/html/HtmlObject.cpp index dec6684054..6e928725a0 100644 --- a/extensions/fairygui/utils/html/HtmlObject.cpp +++ b/extensions/fairygui/utils/html/HtmlObject.cpp @@ -143,7 +143,7 @@ void HtmlObject::createButton() else { _ui = GComponent::create(); - CCLOGWARN("Set HtmlObject.buttonResource first"); + AXLOGWARN("Set HtmlObject.buttonResource first"); } _ui->retain(); @@ -168,7 +168,7 @@ void HtmlObject::createInput() else { _ui = GComponent::create(); - CCLOGWARN("Set HtmlObject.inputResource first"); + AXLOGWARN("Set HtmlObject.inputResource first"); } _ui->retain(); @@ -211,7 +211,7 @@ void HtmlObject::createSelect() else { _ui = GComponent::create(); - CCLOGWARN("Set HtmlObject.selectResource first"); + AXLOGWARN("Set HtmlObject.selectResource first"); } _ui->retain(); diff --git a/extensions/physics-nodes/CCPhysicsDebugNode.cpp b/extensions/physics-nodes/CCPhysicsDebugNode.cpp index 2baa0d0fe4..74a1834ad9 100644 --- a/extensions/physics-nodes/CCPhysicsDebugNode.cpp +++ b/extensions/physics-nodes/CCPhysicsDebugNode.cpp @@ -205,7 +205,7 @@ static void DrawConstraint(cpConstraint* constraint, DrawNode* renderer) } else { - CCLOG("Cannot draw constraint"); + AXLOG("Cannot draw constraint"); } } diff --git a/extensions/physics-nodes/CCPhysicsDebugNodeChipmunk2D.cpp b/extensions/physics-nodes/CCPhysicsDebugNodeChipmunk2D.cpp index 36aa79ad85..4057c27b0d 100644 --- a/extensions/physics-nodes/CCPhysicsDebugNodeChipmunk2D.cpp +++ b/extensions/physics-nodes/CCPhysicsDebugNodeChipmunk2D.cpp @@ -207,7 +207,7 @@ static void DrawConstraint(cpConstraint* constraint, DrawNode* renderer) } else { - CCLOG("Cannot draw constraint"); + AXLOG("Cannot draw constraint"); } } diff --git a/extensions/physics-nodes/CCPhysicsSprite.cpp b/extensions/physics-nodes/CCPhysicsSprite.cpp index bbc25a5d33..79dba182dd 100644 --- a/extensions/physics-nodes/CCPhysicsSprite.cpp +++ b/extensions/physics-nodes/CCPhysicsSprite.cpp @@ -205,7 +205,7 @@ cpBody* PhysicsSprite::getCPBody() const # if AX_ENABLE_CHIPMUNK_INTEGRATION return _CPBody; # else - CCASSERT(false, "Can't call chipmunk methods when Chipmunk is disabled"); + AXASSERT(false, "Can't call chipmunk methods when Chipmunk is disabled"); return nullptr; # endif } @@ -215,7 +215,7 @@ void PhysicsSprite::setCPBody(cpBody* pBody) # if AX_ENABLE_CHIPMUNK_INTEGRATION _CPBody = pBody; # else - CCASSERT(false, "Can't call chipmunk methods when Chipmunk is disabled"); + AXASSERT(false, "Can't call chipmunk methods when Chipmunk is disabled"); # endif } @@ -224,7 +224,7 @@ b2Body* PhysicsSprite::getB2Body() const # if AX_ENABLE_BOX2D_INTEGRATION return _pB2Body; # else - CCASSERT(false, "Can't call box2d methods when Box2d is disabled"); + AXASSERT(false, "Can't call box2d methods when Box2d is disabled"); return nullptr; # endif } @@ -235,7 +235,7 @@ void PhysicsSprite::setB2Body(b2Body* pBody) _pB2Body = pBody; # else AX_UNUSED_PARAM(pBody); - CCASSERT(false, "Can't call box2d methods when Box2d is disabled"); + AXASSERT(false, "Can't call box2d methods when Box2d is disabled"); # endif } @@ -244,7 +244,7 @@ float PhysicsSprite::getPTMRatio() const # if AX_ENABLE_BOX2D_INTEGRATION return _PTMRatio; # else - CCASSERT(false, "Can't call box2d methods when Box2d is disabled"); + AXASSERT(false, "Can't call box2d methods when Box2d is disabled"); return 0; # endif } @@ -255,7 +255,7 @@ void PhysicsSprite::setPTMRatio(float fRatio) _PTMRatio = fRatio; # else AX_UNUSED_PARAM(fRatio); - CCASSERT(false, "Can't call box2d methods when Box2d is disabled"); + AXASSERT(false, "Can't call box2d methods when Box2d is disabled"); # endif } diff --git a/extensions/scripting/lua-bindings/manual/AxisLuaLoader.cpp b/extensions/scripting/lua-bindings/manual/AxisLuaLoader.cpp index 20bfc756be..9836f360d7 100644 --- a/extensions/scripting/lua-bindings/manual/AxisLuaLoader.cpp +++ b/extensions/scripting/lua-bindings/manual/AxisLuaLoader.cpp @@ -93,7 +93,7 @@ int axis_lua_loader(lua_State* L) resolvedPath.c_str()); } else - CCLOG("can not get file data of %s", resolvedPath.c_str()); + AXLOG("can not get file data of %s", resolvedPath.c_str()); return nret; } } diff --git a/extensions/scripting/lua-bindings/manual/CCComponentLua.cpp b/extensions/scripting/lua-bindings/manual/CCComponentLua.cpp index df7177b712..3fb050044e 100644 --- a/extensions/scripting/lua-bindings/manual/CCComponentLua.cpp +++ b/extensions/scripting/lua-bindings/manual/CCComponentLua.cpp @@ -154,7 +154,7 @@ bool ComponentLua::getLuaFunction(std::string_view functionName) int type = lua_type(l, -1); // if (type != LUA_TFUNCTION) // { - // CCLOG("can not get %s function from %s", functionName.c_str(), _scriptFileName.c_str()); + // AXLOG("can not get %s function from %s", functionName.c_str(), _scriptFileName.c_str()); // } return type == LUA_TFUNCTION; @@ -176,7 +176,7 @@ bool ComponentLua::loadAndExecuteScript() fullPathOfScript.c_str()); if (error) { - CCLOG("ComponentLua::loadAndExecuteScript: %s", lua_tostring(l, -1)); + AXLOG("ComponentLua::loadAndExecuteScript: %s", lua_tostring(l, -1)); lua_pop(l, 1); return false; } @@ -185,7 +185,7 @@ bool ComponentLua::loadAndExecuteScript() error = lua_pcall(l, 0, 1, 0); if (error) { - CCLOG("ComponentLua::loadAndExecuteScript: %s", lua_tostring(l, -1)); + AXLOG("ComponentLua::loadAndExecuteScript: %s", lua_tostring(l, -1)); lua_pop(l, 1); return false; } @@ -194,7 +194,7 @@ bool ComponentLua::loadAndExecuteScript() int type = lua_type(l, -1); if (type != LUA_TTABLE) { - CCLOG("%s should return a table, or the script component can not work currectly", _scriptFileName.c_str()); + AXLOG("%s should return a table, or the script component can not work currectly", _scriptFileName.c_str()); return false; } diff --git a/extensions/scripting/lua-bindings/manual/CCLuaBridge.cpp b/extensions/scripting/lua-bindings/manual/CCLuaBridge.cpp index d201cee7a4..04dcbd272e 100644 --- a/extensions/scripting/lua-bindings/manual/CCLuaBridge.cpp +++ b/extensions/scripting/lua-bindings/manual/CCLuaBridge.cpp @@ -93,7 +93,7 @@ int LuaBridge::retainLuaFunctionById(int functionId) lua_rawset(L, -3); /* id_r[id] = r, L: id_r */ lua_pop(L, 1); - CCLOG("CCLuaBridge::retainLuaFunctionById(%d) - retain count = %d", functionId, retainCount); + AXLOG("CCLuaBridge::retainLuaFunctionById(%d) - retain count = %d", functionId, retainCount); return retainCount; } @@ -107,7 +107,7 @@ int LuaBridge::releaseLuaFunctionById(int functionId) if (!lua_istable(L, -1)) { lua_pop(L, 1); - CCLOG("CCLuaBridge::releaseLuaFunctionById() - LUA_BRIDGE_REGISTRY_FUNCTION not exists"); + AXLOG("CCLuaBridge::releaseLuaFunctionById() - LUA_BRIDGE_REGISTRY_FUNCTION not exists"); return 0; } @@ -116,7 +116,7 @@ int LuaBridge::releaseLuaFunctionById(int functionId) if (!lua_istable(L, -1)) { lua_pop(L, 2); - CCLOG("CCLuaBridge::releaseLuaFunctionById() - LUA_BRIDGE_REGISTRY_RETAIN not exists"); + AXLOG("CCLuaBridge::releaseLuaFunctionById() - LUA_BRIDGE_REGISTRY_RETAIN not exists"); return 0; } @@ -125,7 +125,7 @@ int LuaBridge::releaseLuaFunctionById(int functionId) if (lua_type(L, -1) != LUA_TNUMBER) { lua_pop(L, 3); - CCLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d not found", functionId); + AXLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d not found", functionId); return 0; } @@ -140,7 +140,7 @@ int LuaBridge::releaseLuaFunctionById(int functionId) lua_pushinteger(L, retainCount); /* L: f_id id_r id r */ lua_rawset(L, -3); /* id_r[id] = r, L: f_id id_r */ lua_pop(L, 2); - CCLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d retain count = %d", functionId, retainCount); + AXLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d retain count = %d", functionId, retainCount); return retainCount; } @@ -165,7 +165,7 @@ int LuaBridge::releaseLuaFunctionById(int functionId) } /* L: f_id */ lua_pop(L, 1); - CCLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d released", functionId); + AXLOG("CCLuaBridge::releaseLuaFunctionById() - function id %d released", functionId); return 0; } diff --git a/extensions/scripting/lua-bindings/manual/CCLuaEngine.cpp b/extensions/scripting/lua-bindings/manual/CCLuaEngine.cpp index fd1cac2acd..828be96ff1 100644 --- a/extensions/scripting/lua-bindings/manual/CCLuaEngine.cpp +++ b/extensions/scripting/lua-bindings/manual/CCLuaEngine.cpp @@ -179,7 +179,7 @@ bool LuaEngine::parseConfig(ConfigType type, std::string_view str) lua_getglobal(_stack->getLuaState(), "__onParseConfig"); if (!lua_isfunction(_stack->getLuaState(), -1)) { - CCLOG("[LUA ERROR] name '%s' does not represent a Lua function", "__onParseConfig"); + AXLOG("[LUA ERROR] name '%s' does not represent a Lua function", "__onParseConfig"); lua_pop(_stack->getLuaState(), 1); return false; } diff --git a/extensions/scripting/lua-bindings/manual/CCLuaStack.cpp b/extensions/scripting/lua-bindings/manual/CCLuaStack.cpp index a61b721eac..ffb92d4c90 100644 --- a/extensions/scripting/lua-bindings/manual/CCLuaStack.cpp +++ b/extensions/scripting/lua-bindings/manual/CCLuaStack.cpp @@ -85,7 +85,7 @@ int lua_print(lua_State* L) { std::string t; get_string_for_print(L, &t); - CCLOG("[LUA-print] %s", t.c_str()); + AXLOG("[LUA-print] %s", t.c_str()); return 0; } @@ -262,7 +262,7 @@ int LuaStack::executeGlobalFunction(const char* functionName) lua_getglobal(_state, functionName); /* query function by name, stack: function */ if (!lua_isfunction(_state, -1)) { - CCLOG("[LUA ERROR] name '%s' does not represent a Lua function", functionName); + AXLOG("[LUA ERROR] name '%s' does not represent a Lua function", functionName); lua_pop(_state, 1); return 0; } @@ -375,7 +375,7 @@ bool LuaStack::pushFunctionByHandler(int nHandler) toluafix_get_function_by_refid(_state, nHandler); /* L: ... func */ if (!lua_isfunction(_state, -1)) { - CCLOG("[LUA ERROR] function refid '%d' does not reference a Lua function", nHandler); + AXLOG("[LUA ERROR] function refid '%d' does not reference a Lua function", nHandler); lua_pop(_state, 1); return false; } @@ -387,7 +387,7 @@ int LuaStack::executeFunction(int numArgs) int functionIndex = -(numArgs + 1); if (!lua_isfunction(_state, functionIndex)) { - CCLOG("value at stack [%d] is not function", functionIndex); + AXLOG("value at stack [%d] is not function", functionIndex); lua_pop(_state, numArgs + 1); // remove function and arguments return 0; } @@ -412,7 +412,7 @@ int LuaStack::executeFunction(int numArgs) { if (traceback == 0) { - CCLOG("[LUA ERROR] %s", lua_tostring(_state, -1)); /* L: ... error */ + AXLOG("[LUA ERROR] %s", lua_tostring(_state, -1)); /* L: ... error */ lua_pop(_state, 1); // remove error message from stack } else /* L: ... G error */ @@ -480,7 +480,7 @@ int LuaStack::reallocateScriptHandler(int nHandler) toluafix_get_function_by_refid(_state,nNewHandle); if (!lua_isfunction(_state, -1)) { - CCLOG("Error!"); + AXLOG("Error!"); } lua_settop(_state, 0); */ @@ -503,7 +503,7 @@ int LuaStack::executeFunction(int handler, if (!lua_isfunction(_state, functionIndex)) { - CCLOG("value at stack [%d] is not function", functionIndex); + AXLOG("value at stack [%d] is not function", functionIndex); lua_pop(_state, numArgs + 1); // remove function and arguments return 0; } @@ -529,7 +529,7 @@ int LuaStack::executeFunction(int handler, { if (traceCallback == 0) { - CCLOG("[LUA ERROR] %s", lua_tostring(_state, -1)); /* L: ... error */ + AXLOG("[LUA ERROR] %s", lua_tostring(_state, -1)); /* L: ... error */ lua_pop(_state, 1); // remove error message from stack } else /* L: ... G error */ @@ -563,7 +563,7 @@ int LuaStack::reload(const char* moduleFileName) { if (nullptr == moduleFileName || strlen(moduleFileName) == 0) { - CCLOG("moudulFileName is null"); + AXLOG("moudulFileName is null"); return 1; } @@ -597,7 +597,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L) { if (lua_gettop(L) < 1) { - CCLOG("luaLoadChunksFromZIP() - invalid arguments"); + AXLOG("luaLoadChunksFromZIP() - invalid arguments"); return 0; } @@ -627,7 +627,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L) if (zip) { - CCLOG("lua_loadChunksFromZIP() - load zip file: %s", zipFilePath.c_str()); + AXLOG("lua_loadChunksFromZIP() - load zip file: %s", zipFilePath.c_str()); lua_getglobal(L, "package"); lua_getfield(L, -1, "preload"); @@ -658,7 +658,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L) character = '.'; } } - CCLOG("[luaLoadChunksFromZIP] add %s to preload", filename.c_str()); + AXLOG("[luaLoadChunksFromZIP] add %s to preload", filename.c_str()); if (stack->luaLoadBuffer(L, (char*)zbuffer, (int)bufferSize, filename.c_str()) == 0) { lua_setfield(L, -2, filename.c_str()); @@ -668,7 +668,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L) } filename = zip->getNextFilename(); } - CCLOG("lua_loadChunksFromZIP() - loaded chunks count: %d", count); + AXLOG("lua_loadChunksFromZIP() - loaded chunks count: %d", count); lua_pop(L, 2); lua_pushboolean(L, 1); @@ -676,7 +676,7 @@ int LuaStack::luaLoadChunksFromZIP(lua_State* L) } else { - CCLOG("lua_loadChunksFromZIP() - not found or invalid zip file: %s", zipFilePath.c_str()); + AXLOG("lua_loadChunksFromZIP() - not found or invalid zip file: %s", zipFilePath.c_str()); lua_pushboolean(L, 0); } @@ -718,19 +718,19 @@ int LuaStack::luaLoadBuffer(lua_State* L, const char* chunk, int chunkSize, cons switch (r) { case LUA_ERRSYNTAX: - CCLOG("[LUA ERROR] load \"%s\", error: syntax error during pre-compilation.", chunkName); + AXLOG("[LUA ERROR] load \"%s\", error: syntax error during pre-compilation.", chunkName); break; case LUA_ERRMEM: - CCLOG("[LUA ERROR] load \"%s\", error: memory allocation error.", chunkName); + AXLOG("[LUA ERROR] load \"%s\", error: memory allocation error.", chunkName); break; case LUA_ERRFILE: - CCLOG("[LUA ERROR] load \"%s\", error: cannot open/read file.", chunkName); + AXLOG("[LUA ERROR] load \"%s\", error: cannot open/read file.", chunkName); break; default: - CCLOG("[LUA ERROR] load \"%s\", error: unknown.", chunkName); + AXLOG("[LUA ERROR] load \"%s\", error: unknown.", chunkName); } } #endif diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp index b532ff2382..d8f5abc7ce 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.cpp @@ -46,19 +46,19 @@ void luaval_to_native_err(lua_State* L, const char* msg, tolua_Error* err, const { int narg = err->index; if (err->array) - CCLOG("%s\n %s argument #%d is array of '%s'; array of '%s' expected.\n", msg + 2, funcName, narg, + AXLOG("%s\n %s argument #%d is array of '%s'; array of '%s' expected.\n", msg + 2, funcName, narg, provided, expected); else - CCLOG("%s\n %s argument #%d is '%s'; '%s' expected.\n", msg + 2, funcName, narg, provided, + AXLOG("%s\n %s argument #%d is '%s'; '%s' expected.\n", msg + 2, funcName, narg, provided, expected); } else if (msg[1] == 'v') { if (err->array) - CCLOG("%s\n %s value is array of '%s'; array of '%s' expected.\n", funcName, msg + 2, provided, + AXLOG("%s\n %s value is array of '%s'; array of '%s' expected.\n", funcName, msg + 2, provided, expected); else - CCLOG("%s\n %s value is '%s'; '%s' expected.\n", msg + 2, funcName, provided, expected); + AXLOG("%s\n %s value is '%s'; '%s' expected.\n", msg + 2, funcName, provided, expected); } } } @@ -1221,7 +1221,7 @@ bool luavals_variadic_to_ccvaluevector(lua_State* L, int argc, axis::ValueVector } else { - CCASSERT(false, "not supported type"); + AXASSERT(false, "not supported type"); } } @@ -1361,7 +1361,7 @@ bool luaval_to_ccvaluemap(lua_State* L, int lo, axis::ValueMap* ret, const char* } else { - CCASSERT(false, "not supported type"); + AXASSERT(false, "not supported type"); } } @@ -1449,7 +1449,7 @@ bool luaval_to_ccvaluemapintkey(lua_State* L, int lo, axis::ValueMapIntKey* ret, } else { - CCASSERT(false, "not supported type"); + AXASSERT(false, "not supported type"); } } @@ -1532,7 +1532,7 @@ bool luaval_to_ccvaluevector(lua_State* L, int lo, axis::ValueVector* ret, const } else { - CCASSERT(false, "not supported type"); + AXASSERT(false, "not supported type"); } lua_pop(L, 1); } @@ -1572,7 +1572,7 @@ bool luaval_to_std_vector_string(lua_State* L, int lo, std::vector* } else { - CCASSERT(false, "string type is needed"); + AXASSERT(false, "string type is needed"); } lua_pop(L, 1); @@ -1613,7 +1613,7 @@ bool luaval_to_std_vector_string_view(lua_State* L, int lo, std::vector* ret, const } else { - CCASSERT(false, "int type is needed"); + AXASSERT(false, "int type is needed"); } lua_pop(L, 1); @@ -1723,7 +1723,7 @@ bool luaval_to_std_vector_float(lua_State* L, int lo, std::vector* ret, c } else { - CCASSERT(false, "float type is needed"); + AXASSERT(false, "float type is needed"); } lua_pop(L, 1); @@ -1762,7 +1762,7 @@ bool luaval_to_std_vector_ushort(lua_State* L, int lo, std::vector* re } else { - CCASSERT(false, "vec2 type is needed"); + AXASSERT(false, "vec2 type is needed"); } lua_pop(L, 1); } @@ -2029,7 +2029,7 @@ bool luaval_to_std_vector_vec3(lua_State* L, int lo, std::vector* re } else { - CCASSERT(false, "vec3 type is needed"); + AXASSERT(false, "vec3 type is needed"); } lua_pop(L, 1); } @@ -2075,7 +2075,7 @@ bool luaval_to_std_vector_v3f_c4b_t2f(lua_State* L, } else { - CCASSERT(false, "V3F_C4B_T2F type is needed"); + AXASSERT(false, "V3F_C4B_T2F type is needed"); } lua_pop(L, 1); } @@ -3007,7 +3007,7 @@ bool luaval_to_std_map_string_string(lua_State* L, int lo, hlookup::string_map(lua_tointeger(L, -1)); lua_pop(L, 1); diff --git a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h index 7f078c8685..215c127a1d 100644 --- a/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h +++ b/extensions/scripting/lua-bindings/manual/LuaBasicConversions.h @@ -731,7 +731,7 @@ bool luaval_to_object(lua_State* L, int lo, const char* type, T** ret, const cha *ret = static_cast(tolua_tousertype(L, lo, 0)); if (nullptr == *ret) - CCLOG("Warning: %s argument %d is invalid native object(nullptr)", funcName, lo); + AXLOG("Warning: %s argument %d is invalid native object(nullptr)", funcName, lo); return true; } diff --git a/extensions/scripting/lua-bindings/manual/controller/lua_axis_controller_manual.cpp b/extensions/scripting/lua-bindings/manual/controller/lua_axis_controller_manual.cpp index d19c95393e..6c9ce2b4b8 100644 --- a/extensions/scripting/lua-bindings/manual/controller/lua_axis_controller_manual.cpp +++ b/extensions/scripting/lua-bindings/manual/controller/lua_axis_controller_manual.cpp @@ -138,7 +138,7 @@ static int tolua_axis_EventListenerController_clone(lua_State* tolua_S) return 1; } - CCLOG("'clone' has wrong number of arguments: %d, was expecting %d\n", argc, 0); + AXLOG("'clone' has wrong number of arguments: %d, was expecting %d\n", argc, 0); return 0; # if COCOS2D_DEBUG >= 1 @@ -280,7 +280,7 @@ static int tolua_axis_EventListenerController_registerScriptHandler(lua_State* t return 0; } - CCLOG("'registerScriptHandler' has wrong number of arguments: %d, was expecting %d\n", argc, 2); + AXLOG("'registerScriptHandler' has wrong number of arguments: %d, was expecting %d\n", argc, 2); return 0; # if COCOS2D_DEBUG >= 1 @@ -349,7 +349,7 @@ static int tolua_axis_Controller_getKeyStatus(lua_State* tolua_S) return 1; } - CCLOG("'clone' has wrong number of arguments: %d, was expecting %d\n", argc, 0); + AXLOG("'clone' has wrong number of arguments: %d, was expecting %d\n", argc, 0); return 0; # if COCOS2D_DEBUG >= 1 diff --git a/extensions/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp b/extensions/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp index f163ab04de..c7ecbc1592 100644 --- a/extensions/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp +++ b/extensions/scripting/lua-bindings/manual/network/lua_xml_http_request.cpp @@ -212,14 +212,14 @@ void LuaMinXmlHttpRequest::_sendRequest() if (0 != strlen(response->getHttpRequest()->getTag())) { - CCLOG("%s completed", response->getHttpRequest()->getTag()); + AXLOG("%s completed", response->getHttpRequest()->getTag()); } int statusCode = response->getResponseCode(); if (!response->isSucceed()) { - CCLOG("Response failed, statusCode: %d", statusCode); + AXLOG("Response failed, statusCode: %d", statusCode); if (statusCode == 0) { _errorFlag = true; @@ -232,7 +232,7 @@ void LuaMinXmlHttpRequest::_sendRequest() if (0 != handler) { - CCLOG("come in handler, handler is %d", handler); + AXLOG("come in handler, handler is %d", handler); axis::CommonScriptData data(handler, ""); axis::ScriptEvent event(axis::ScriptEventType::kCommonEvent, (void*)&data); axis::ScriptEngineManager::sendEventToLua(event); diff --git a/extensions/spine/SkeletonAnimation.cpp b/extensions/spine/SkeletonAnimation.cpp index 2edc8687c7..0ddba15f56 100644 --- a/extensions/spine/SkeletonAnimation.cpp +++ b/extensions/spine/SkeletonAnimation.cpp @@ -151,7 +151,7 @@ void SkeletonAnimation::draw(axis::Renderer *renderer, const axis::Mat4 &transfo } void SkeletonAnimation::setAnimationStateData (AnimationStateData* stateData) { - CCASSERT(stateData, "stateData cannot be null."); + AXASSERT(stateData, "stateData cannot be null."); if (_ownsAnimationStateData) delete _state->getData(); delete _state; diff --git a/extensions/spine/SkeletonBatch.cpp b/extensions/spine/SkeletonBatch.cpp index 531e7b46ac..21471df885 100644 --- a/extensions/spine/SkeletonBatch.cpp +++ b/extensions/spine/SkeletonBatch.cpp @@ -169,7 +169,7 @@ axis::TrianglesCommand* SkeletonBatch::addCommand(axis::Renderer* renderer, floa if (programState == nullptr) programState = _programState; - CCASSERT(programState, "programState should not be null"); + AXASSERT(programState, "programState should not be null"); auto pipelinePS = updateCommandPipelinePS(command, programState); diff --git a/extensions/spine/SkeletonRenderer.cpp b/extensions/spine/SkeletonRenderer.cpp index ecde3e1168..43828e72be 100644 --- a/extensions/spine/SkeletonRenderer.cpp +++ b/extensions/spine/SkeletonRenderer.cpp @@ -188,7 +188,7 @@ void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, At SkeletonJson json(_attachmentLoader); json.setScale(scale); SkeletonData* skeletonData = json.readSkeletonDataFile(skeletonDataFile.c_str()); - CCASSERT(skeletonData, (!json.getError().isEmpty() ? json.getError().buffer() : "Error reading skeleton data.")); + AXASSERT(skeletonData, (!json.getError().isEmpty() ? json.getError().buffer() : "Error reading skeleton data.")); _ownsSkeleton = true; setSkeletonData(skeletonData, true); @@ -198,14 +198,14 @@ void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, At void SkeletonRenderer::initWithJsonFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { _atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true); - CCASSERT(_atlas, "Error reading atlas file."); + AXASSERT(_atlas, "Error reading atlas file."); _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); SkeletonJson json(_attachmentLoader); json.setScale(scale); SkeletonData* skeletonData = json.readSkeletonDataFile(skeletonDataFile.c_str()); - CCASSERT(skeletonData, (!json.getError().isEmpty() ? json.getError().buffer() : "Error reading skeleton data.")); + AXASSERT(skeletonData, (!json.getError().isEmpty() ? json.getError().buffer() : "Error reading skeleton data.")); _ownsSkeleton = true; _ownsAtlas = true; @@ -221,7 +221,7 @@ void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, SkeletonBinary binary(_attachmentLoader); binary.setScale(scale); SkeletonData* skeletonData = binary.readSkeletonDataFile(skeletonDataFile.c_str()); - CCASSERT(skeletonData, (!binary.getError().isEmpty() ? binary.getError().buffer() : "Error reading skeleton data.")); + AXASSERT(skeletonData, (!binary.getError().isEmpty() ? binary.getError().buffer() : "Error reading skeleton data.")); _ownsSkeleton = true; setSkeletonData(skeletonData, true); @@ -230,14 +230,14 @@ void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, void SkeletonRenderer::initWithBinaryFile (const std::string& skeletonDataFile, const std::string& atlasFile, float scale) { _atlas = new (__FILE__, __LINE__) Atlas(atlasFile.c_str(), &textureLoader, true); - CCASSERT(_atlas, "Error reading atlas file."); + AXASSERT(_atlas, "Error reading atlas file."); _attachmentLoader = new (__FILE__, __LINE__) Cocos2dAtlasAttachmentLoader(_atlas); SkeletonBinary binary(_attachmentLoader); binary.setScale(scale); SkeletonData* skeletonData = binary.readSkeletonDataFile(skeletonDataFile.c_str()); - CCASSERT(skeletonData, (!binary.getError().isEmpty() ? binary.getError().buffer() : "Error reading skeleton data.")); + AXASSERT(skeletonData, (!binary.getError().isEmpty() ? binary.getError().buffer() : "Error reading skeleton data.")); _ownsSkeleton = true; _ownsAtlas = true; setSkeletonData(skeletonData, true); diff --git a/extensions/spine/SkeletonTwoColorBatch.cpp b/extensions/spine/SkeletonTwoColorBatch.cpp index abe9c369c6..8b08c061f4 100644 --- a/extensions/spine/SkeletonTwoColorBatch.cpp +++ b/extensions/spine/SkeletonTwoColorBatch.cpp @@ -157,7 +157,7 @@ void TwoColorTrianglesCommand::init(float globalOrder, axis::Texture2D *texture, if (_triangles.indexCount % 3 != 0) { int count = _triangles.indexCount; _triangles.indexCount = count / 3 * 3; - CCLOGERROR("Resize indexCount from %d to %d, size must be multiple times of 3", count, _triangles.indexCount); + AXLOGERROR("Resize indexCount from %d to %d, size must be multiple times of 3", count, _triangles.indexCount); } _mv = mv; @@ -206,7 +206,7 @@ void TwoColorTrianglesCommand::updateCommandPipelineDescriptor(axis::backend::Pr _programState = __twoColorProgramState->clone(); } - CCASSERT(_programState, "programState should not be null"); + AXASSERT(_programState, "programState should not be null"); pipelinePS = _programState; if (needsUpdateStateLayout) diff --git a/extensions/spine/spine-cocos2dx.cpp b/extensions/spine/spine-cocos2dx.cpp index ebeeb4a930..f198e96783 100644 --- a/extensions/spine/spine-cocos2dx.cpp +++ b/extensions/spine/spine-cocos2dx.cpp @@ -139,7 +139,7 @@ Cocos2dTextureLoader::~Cocos2dTextureLoader() { } void Cocos2dTextureLoader::load(AtlasPage& page, const spine::String& path) { Texture2D* texture = Director::getInstance()->getTextureCache()->addImage(path.buffer()); - CCASSERT(texture != nullptr, "Invalid image"); + AXASSERT(texture != nullptr, "Invalid image"); if (texture) { texture->retain(); #if COCOS2D_VERSION >= 0x0040000 diff --git a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp index c5bd488149..3f13c5796f 100644 --- a/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp +++ b/tests/cpp-tests/Classes/ActionsEaseTest/ActionsEaseTest.cpp @@ -931,9 +931,9 @@ void SpeedTest::altertime(float dt) auto action2 = static_cast(_tamara->getActionByTag(kTagAction1)); auto action3 = static_cast(_kathia->getActionByTag(kTagAction1)); - action1->setSpeed(CCRANDOM_MINUS1_1() * 2); - action2->setSpeed(CCRANDOM_MINUS1_1() * 2); - action3->setSpeed(CCRANDOM_MINUS1_1() * 2); + action1->setSpeed(rand_minus1_1() * 2); + action2->setSpeed(rand_minus1_1() * 2); + action3->setSpeed(rand_minus1_1() * 2); } std::string SpeedTest::subtitle() const diff --git a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp index 7b1b1415df..ff9b06705f 100644 --- a/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp +++ b/tests/cpp-tests/Classes/ActionsTest/ActionsTest.cpp @@ -929,7 +929,7 @@ void ActionCallFunction::callback2(Node* sender) addChild(label); - CCLOG("sender is: %p", sender); + AXLOG("sender is: %p", sender); } void ActionCallFunction::callback3(Node* sender, int32_t data) @@ -939,7 +939,7 @@ void ActionCallFunction::callback3(Node* sender, int32_t data) label->setPosition(s.width / 4 * 3, s.height / 2); addChild(label); - CCLOG("target is: %p, data is: %d", sender, data); + AXLOG("target is: %p, data is: %d", sender, data); } std::string ActionCallFunction::subtitle() const @@ -1243,7 +1243,7 @@ void ActionFollow::onEnter() float y = s.height; Vec2 vertices[] = {Vec2(5.0f, 5.0f), Vec2(x - 5, 5.0f), Vec2(x - 5, y - 5), Vec2(5.0f, y - 5)}; - drawNode->drawPoly(vertices, 4, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(vertices, 4, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); this->addChild(drawNode); @@ -1280,7 +1280,7 @@ void ActionFollowWithOffset::onEnter() float y = s.height; Vec2 vertices[] = {Vec2(5.0f, 5.0f), Vec2(x - 5, 5.0f), Vec2(x - 5, y - 5), Vec2(5.0f, y - 5)}; - drawNode->drawPoly(vertices, 4, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + drawNode->drawPoly(vertices, 4, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); this->addChild(drawNode); @@ -1380,7 +1380,7 @@ void ActionStacked::onEnter() void ActionStacked::addNewSpriteWithCoords(Vec2 p) { - int idx = static_cast(CCRANDOM_0_1() * 1400 / 100); + int idx = static_cast(AXRANDOM_0_1() * 1400 / 100); float w = 85.0f; float h = 121.0f; float x = (idx % 5) * w; diff --git a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp index b91c240b8c..73a847cf7c 100644 --- a/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp +++ b/tests/cpp-tests/Classes/BillBoardTest/BillBoardTest.cpp @@ -129,14 +129,14 @@ BillBoardTest::BillBoardTest() : _camera(nullptr) for (unsigned int i = 0; i < 4; ++i) { Layer* layer = Layer::create(); - auto billboard = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5f)]); + auto billboard = BillBoard::create(imgs[(unsigned int)(AXRANDOM_0_1() * 1 + 0.5f)]); billboard->setScale(0.5f); - billboard->setPosition3D(Vec3(0.0f, 0.0f, CCRANDOM_MINUS1_1() * 150.0f)); - billboard->setOpacity(static_cast(CCRANDOM_0_1() * 128 + 128)); + billboard->setPosition3D(Vec3(0.0f, 0.0f, rand_minus1_1() * 150.0f)); + billboard->setOpacity(static_cast(AXRANDOM_0_1() * 128 + 128)); _billboards.push_back(billboard); layer->addChild(billboard); _layerBillBoard->addChild(layer); - layer->runAction(RepeatForever::create(RotateBy::create(CCRANDOM_0_1() * 10, Vec3(0.0f, 45.0f, 0.0f)))); + layer->runAction(RepeatForever::create(RotateBy::create(AXRANDOM_0_1() * 10, Vec3(0.0f, 45.0f, 0.0f)))); } { @@ -235,10 +235,10 @@ void BillBoardTest::addNewBillBoardWithCoords(Vec3 p) std::string imgs[3] = {"Images/Icon.png", "Images/r2.png"}; for (unsigned int i = 0; i < 10; ++i) { - auto billboard = BillBoard::create(imgs[(unsigned int)(CCRANDOM_0_1() * 1 + 0.5f)]); + auto billboard = BillBoard::create(imgs[(unsigned int)(AXRANDOM_0_1() * 1 + 0.5f)]); billboard->setScale(0.5f); billboard->setPosition3D(Vec3(p.x, p.y, -150.0f + 30 * i)); - billboard->setOpacity(static_cast(CCRANDOM_0_1() * 128 + 128)); + billboard->setOpacity(static_cast(AXRANDOM_0_1() * 128 + 128)); _layerBillBoard->addChild(billboard); _billboards.push_back(billboard); @@ -266,7 +266,7 @@ void BillBoardTest::addNewAniBillBoardWithCoords(Vec3 p) auto action = Animate::create(animation); billboardAni->runAction(RepeatForever::create(action)); - billboardAni->setOpacity(static_cast(CCRANDOM_0_1() * 128 + 128)); + billboardAni->setOpacity(static_cast(AXRANDOM_0_1() * 128 + 128)); _billboards.push_back(billboardAni); } } diff --git a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp index 7a01db484a..a9980bcad2 100644 --- a/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp +++ b/tests/cpp-tests/Classes/Box2DTest/Box2dTest.cpp @@ -257,7 +257,7 @@ void Box2DTest::createResetButton() void Box2DTest::addNewSpriteAtPosition(Vec2 p) { - CCLOG("Add sprite %0.2f x %02.f", p.x, p.y); + AXLOG("Add sprite %0.2f x %02.f", p.x, p.y); // Define the dynamic body. // Set up a 1m squared box in the physics world @@ -265,7 +265,7 @@ void Box2DTest::addNewSpriteAtPosition(Vec2 p) bodyDef.type = b2_dynamicBody; bodyDef.position.Set(p.x / PTM_RATIO, p.y / PTM_RATIO); - CCLOG("Add PTM_RATIO sprite %0.2f x %0.2f", p.x / PTM_RATIO, p.y / PTM_RATIO); + AXLOG("Add PTM_RATIO sprite %0.2f x %0.2f", p.x / PTM_RATIO, p.y / PTM_RATIO); b2Body* body = world->CreateBody(&bodyDef); @@ -284,8 +284,8 @@ void Box2DTest::addNewSpriteAtPosition(Vec2 p) // We have a 64x64 sprite sheet with 4 different 32x32 images. The following code is // just randomly picking one of the images - int idx = (CCRANDOM_0_1() > .5 ? 0 : 1); - int idy = (CCRANDOM_0_1() > .5 ? 0 : 1); + int idx = (AXRANDOM_0_1() > .5 ? 0 : 1); + int idy = (AXRANDOM_0_1() > .5 ? 0 : 1); auto sprite = PhysicsSpriteBox2D::createWithTexture(_spriteTexture, Rect(32 * idx, 32 * idy, 32, 32)); parent->addChild(sprite); sprite->setB2Body(body); diff --git a/tests/cpp-tests/Classes/Box2DTestBed/Box2DTestBed.cpp b/tests/cpp-tests/Classes/Box2DTestBed/Box2DTestBed.cpp index 373c9c6986..929ebfec93 100644 --- a/tests/cpp-tests/Classes/Box2DTestBed/Box2DTestBed.cpp +++ b/tests/cpp-tests/Classes/Box2DTestBed/Box2DTestBed.cpp @@ -177,13 +177,13 @@ void Box2DTestBed::onTouchEnded(Touch* touch, Event* event) void Box2DTestBed::onKeyPressed(EventKeyboard::KeyCode code, Event* event) { - CCLOG("onKeyPressed, keycode: %d", static_cast(code)); + AXLOG("onKeyPressed, keycode: %d", static_cast(code)); m_test->Keyboard((static_cast(code) - 59)); // its a bad hack! } void Box2DTestBed::onKeyReleased(EventKeyboard::KeyCode code, Event* event) { - CCLOG("onKeyPressed, keycode: %d", static_cast(code)); + AXLOG("onKeyPressed, keycode: %d", static_cast(code)); m_test->KeyboardUp((static_cast(code) - 59)); // its a bad hack! } diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp index b20dec1707..8928010700 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-1174.cpp @@ -78,26 +78,26 @@ bool Bug1174Layer::init() // A | b // ----- // c | d - float ax = CCRANDOM_0_1() * -5000; - float ay = CCRANDOM_0_1() * 5000; + float ax = AXRANDOM_0_1() * -5000; + float ay = AXRANDOM_0_1() * 5000; // a | b // ----- // c | D - float dx = CCRANDOM_0_1() * 5000; - float dy = CCRANDOM_0_1() * -5000; + float dx = AXRANDOM_0_1() * 5000; + float dy = AXRANDOM_0_1() * -5000; // a | B // ----- // c | d - float bx = CCRANDOM_0_1() * 5000; - float by = CCRANDOM_0_1() * 5000; + float bx = AXRANDOM_0_1() * 5000; + float by = AXRANDOM_0_1() * 5000; // a | b // ----- // C | d - float cx = CCRANDOM_0_1() * -5000; - float cy = CCRANDOM_0_1() * -5000; + float cx = AXRANDOM_0_1() * -5000; + float cy = AXRANDOM_0_1() * -5000; A = Vec2(ax, ay); B = Vec2(bx, by); @@ -141,15 +141,15 @@ bool Bug1174Layer::init() // A | b // ----- // c | d - float ax = CCRANDOM_0_1() * -500; - float ay = CCRANDOM_0_1() * 500; + float ax = AXRANDOM_0_1() * -500; + float ay = AXRANDOM_0_1() * 500; p1 = Vec2(ax, ay); // a | b // ----- // c | D - float dx = CCRANDOM_0_1() * 500; - float dy = CCRANDOM_0_1() * -500; + float dx = AXRANDOM_0_1() * 500; + float dy = AXRANDOM_0_1() * -500; p2 = Vec2(dx, dy); ////// @@ -159,13 +159,13 @@ bool Bug1174Layer::init() // a | b // ----- // C | d - float cx = CCRANDOM_0_1() * -500; + float cx = AXRANDOM_0_1() * -500; p3 = Vec2(cx, y); // a | B // ----- // c | d - float bx = CCRANDOM_0_1() * 500; + float bx = AXRANDOM_0_1() * 500; p4 = Vec2(bx, y); s = 0.0f; diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp index 6f07a7adb1..631c2d1358 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-422.cpp @@ -63,8 +63,8 @@ void Bug422Layer::reset() auto menu = Menu::create(item1, item2, nullptr); menu->alignItemsVertically(); - float x = CCRANDOM_0_1() * 50; - float y = CCRANDOM_0_1() * 50; + float x = AXRANDOM_0_1() * 50; + float y = AXRANDOM_0_1() * 50; menu->setPosition(menu->getPosition() + Vec2(x, y)); addChild(menu, 0, localtag); diff --git a/tests/cpp-tests/Classes/BugsTest/Bug-Child.cpp b/tests/cpp-tests/Classes/BugsTest/Bug-Child.cpp index ccb5a4d67c..4c8233a921 100644 --- a/tests/cpp-tests/Classes/BugsTest/Bug-Child.cpp +++ b/tests/cpp-tests/Classes/BugsTest/Bug-Child.cpp @@ -73,13 +73,13 @@ void BugChild::switchChild(Ref* sender) { parent1->removeChild(child, false); parent2->addChild(child); - CCLOG("Child attached to parent2"); + AXLOG("Child attached to parent2"); } else { parent2->removeChild(child, false); parent1->addChild(child); - CCLOG("Child attached to parent1"); + AXLOG("Child attached to parent1"); } } diff --git a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp index ec361c00bd..4821cbc6b6 100644 --- a/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp +++ b/tests/cpp-tests/Classes/ChipmunkTest/ChipmunkTest.cpp @@ -208,8 +208,8 @@ void ChipmunkTest::addNewSpriteAtPosition(axis::Vec2 pos) auto parent = getChildByTag(kTagParentNode); - posx = CCRANDOM_0_1() * 200.0f; - posy = CCRANDOM_0_1() * 200.0f; + posx = AXRANDOM_0_1() * 200.0f; + posy = AXRANDOM_0_1() * 200.0f; posx = (posx % 4) * 85; posy = (posy % 3) * 121; diff --git a/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Bench.c b/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Bench.c index d85a8d6fe1..b3abc22b50 100644 --- a/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Bench.c +++ b/tests/cpp-tests/Classes/ChipmunkTestBed/demo/Bench.c @@ -496,7 +496,7 @@ static cpFloat pentagon_moment = 0.0f; static cpBool NoCollide_begin(cpArbiter* arb, cpSpace* space, void* data) { - // CCLOG("NoCollide_begin"); + // AXLOG("NoCollide_begin"); return cpTrue; } diff --git a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp index a8b23be490..0f18f43b8d 100644 --- a/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp +++ b/tests/cpp-tests/Classes/ClippingNodeTest/ClippingNodeTest.cpp @@ -402,8 +402,8 @@ void HoleDemo::setup() void HoleDemo::pokeHoleAtPoint(Vec2 point) { - float scale = CCRANDOM_0_1() * 0.2 + 0.9; - float rotation = CCRANDOM_0_1() * 360; + float scale = AXRANDOM_0_1() * 0.2 + 0.9; + float rotation = AXRANDOM_0_1() * 360; auto hole = Sprite::create("Images/hole_effect.png"); hole->setPosition(point); @@ -632,7 +632,7 @@ void RawStencilBufferTest::draw(Renderer* renderer, const Mat4& transform, uint3 cmdIndex++; Director* director = Director::getInstance(); - 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); _modelViewTransform = this->transform(transform); diff --git a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp index 8734ad3543..5c86d78762 100644 --- a/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp +++ b/tests/cpp-tests/Classes/ConsoleTest/ConsoleTest.cpp @@ -128,7 +128,7 @@ void ConsoleUploadFile::uploadFile() Data srcFileData = FileUtils::getInstance()->getDataFromFile(s_pathGrossini); if (srcFileData.isNull()) { - CCLOGERROR("ConsoleUploadFile: could not open file %s", s_pathGrossini); + AXLOGERROR("ConsoleUploadFile: could not open file %s", s_pathGrossini); } std::string targetFileName = _targetFileName; @@ -159,7 +159,7 @@ void ConsoleUploadFile::uploadFile() s = getaddrinfo(nodeName.c_str(), "5678", &hints, &result); if (s != 0) { - CCLOG("ConsoleUploadFile: getaddrinfo error"); + AXLOG("ConsoleUploadFile: getaddrinfo error"); return; } @@ -186,7 +186,7 @@ void ConsoleUploadFile::uploadFile() if (rp == nullptr) { /* No address succeeded */ - CCLOG("ConsoleUploadFile: could not connect!"); + AXLOG("ConsoleUploadFile: could not connect!"); return; } diff --git a/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp b/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp index ad9b32154a..249bced5a8 100644 --- a/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp +++ b/tests/cpp-tests/Classes/CurrentLanguageTest/CurrentLanguageTest.cpp @@ -96,7 +96,7 @@ CurrentLanguageTest::CurrentLanguageTest() labelLanguage->setString("current language is Polish"); break; default: - CCASSERT(false, "Invalid language type."); + AXASSERT(false, "Invalid language type."); break; } diff --git a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp index 52da2fb8b2..cbe0bb6c11 100644 --- a/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp +++ b/tests/cpp-tests/Classes/DrawPrimitivesTest/DrawPrimitivesTest.cpp @@ -50,14 +50,14 @@ DrawNodeTest::DrawNodeTest() addChild(draw, 10); draw->drawPoint(Vec2(s.width / 2 - 120, s.height / 2 - 120), 10, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); draw->drawPoint(Vec2(s.width / 2 + 120, s.height / 2 + 120), 10, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // draw 4 small points Vec2 position[] = {Vec2(60, 60), Vec2(70, 70), Vec2(60, 70), Vec2(70, 60)}; - draw->drawPoints(position, 4, 5, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + draw->drawPoints(position, 4, 5, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // draw a line draw->drawLine(Vec2(0, 0), Vec2(s.width, s.height), Color4F(1.0, 0.0, 0.0, 0.5)); @@ -66,30 +66,30 @@ DrawNodeTest::DrawNodeTest() draw->drawRect(Vec2(23, 23), Vec2(7, 7), Color4F(1, 1, 0, 1)); draw->drawRect(Vec2(15, 30), Vec2(30, 15), Vec2(15, 0), Vec2(0, 15), - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); // draw a circle draw->drawCircle(VisibleRect::center() + Vec2(140, 0), 100, AX_DEGREES_TO_RADIANS(90), 50, true, 1.0f, 2.0f, Color4F(1.0f, 0.0f, 0.0f, 0.5f)); draw->drawCircle(VisibleRect::center() - Vec2(140, 0), 50, AX_DEGREES_TO_RADIANS(90), 30, false, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // Draw some beziers draw->drawQuadBezier(Vec2(s.width - 150, s.height - 150), Vec2(s.width - 70, s.height - 10), Vec2(s.width - 10, s.height - 10), 10, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); draw->drawQuadBezier(Vec2(0.0f, s.height), Vec2(s.width / 2, s.height / 2), Vec2(s.width, s.height), 50, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); draw->drawCubicBezier(VisibleRect::center(), Vec2(VisibleRect::center().x + 30, VisibleRect::center().y + 50), Vec2(VisibleRect::center().x + 60, VisibleRect::center().y - 50), VisibleRect::right(), 100, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); draw->drawCubicBezier(Vec2(s.width - 250, 40.0f), Vec2(s.width - 70, 100.0f), Vec2(s.width - 30, 250.0f), Vec2(s.width - 10, s.height - 50), 10, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array = PointArray::create(20); array->addControlPoint(Vec2(0.0f, 0.0f)); @@ -99,7 +99,7 @@ DrawNodeTest::DrawNodeTest() array->addControlPoint(Vec2(80.0f, s.height - 80)); array->addControlPoint(Vec2(80.0f, 80.0f)); array->addControlPoint(Vec2(s.width / 2, s.height / 2)); - draw->drawCardinalSpline(array, 0.5f, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + draw->drawCardinalSpline(array, 0.5f, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); auto array2 = PointArray::create(20); array2->addControlPoint(Vec2(s.width / 2, 30.0f)); @@ -107,22 +107,22 @@ DrawNodeTest::DrawNodeTest() array2->addControlPoint(Vec2(s.width - 80, s.height - 80)); array2->addControlPoint(Vec2(s.width / 2, s.height - 80)); array2->addControlPoint(Vec2(s.width / 2, 30.0f)); - draw->drawCatmullRom(array2, 50, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + draw->drawCatmullRom(array2, 50, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); // open random color poly Vec2 vertices[] = {Vec2(0.0f, 0.0f), Vec2(50.0f, 50.0f), Vec2(100.0f, 50.0f), Vec2(100.0f, 100.0f), Vec2(50.0f, 100.0f)}; - draw->drawPoly(vertices, 5, false, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + draw->drawPoly(vertices, 5, false, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // closed random color poly Vec2 vertices2[] = {Vec2(30.0f, 130.0f), Vec2(30.0f, 230.0f), Vec2(50.0f, 200.0f)}; - draw->drawPoly(vertices2, 3, true, Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + draw->drawPoly(vertices2, 3, true, Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); // Draw 10 circles for (int i = 0; i < 10; i++) { draw->drawDot(Vec2(s.width / 2, s.height / 2), 10 * (10 - i), - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } // Draw polygons @@ -184,12 +184,12 @@ DrawNodeTest::DrawNodeTest() // Draw triangle draw->drawTriangle(Vec2(10.0f, 10.0f), Vec2(70.0f, 30.0f), Vec2(100.0f, 140.0f), - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 0.5f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 0.5f)); for (int i = 0; i < 100; i++) { draw->drawPoint(Vec2(i * 7.0f, 5.0f), (float)i / 5 + 1, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1.0f)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1.0f)); } auto draw1 = DrawNode::create(); @@ -223,10 +223,10 @@ Issue11942Test::Issue11942Test() // draw a circle draw->setLineWidth(1); draw->drawCircle(VisibleRect::center() - Vec2(140.0f, 0.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); draw->setLineWidth(10); draw->drawCircle(VisibleRect::center() + Vec2(140.0f, 0.0f), 50, AX_DEGREES_TO_RADIANS(90), 30, false, - Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); } string Issue11942Test::title() const diff --git a/tests/cpp-tests/Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp b/tests/cpp-tests/Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp index 661ec440b0..3253389b59 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/AssetsManagerExTest/AssetsManagerExTest.cpp @@ -97,7 +97,7 @@ bool AssetsManagerExLoaderScene::init() std::string manifestPath = sceneManifests[_testIndex], storagePath = FileUtils::getInstance()->getWritablePath() + storagePaths[_testIndex]; - CCLOG("Storage path for this test : %s", storagePath.c_str()); + AXLOG("Storage path for this test : %s", storagePath.c_str()); _am = AssetsManagerEx::create(manifestPath, storagePath); _am->retain(); @@ -121,7 +121,7 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) if (!_am->getLocalManifest()->isLoaded()) { - CCLOG("Fail to update assets, step skipped."); + AXLOG("Fail to update assets, step skipped."); onLoadEnd(); } else @@ -133,7 +133,7 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) { case EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST: { - CCLOG("No local manifest file found, skip assets update."); + AXLOG("No local manifest file found, skip assets update."); this->onLoadEnd(); } break; @@ -153,7 +153,7 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) else { str = StringUtils::format("%.2f", percent) + "%"; - CCLOG("%.2f Percent", percent); + AXLOG("%.2f Percent", percent); } if (this->_progress != nullptr) this->_progress->setString(str); @@ -162,20 +162,20 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) case EventAssetsManagerEx::EventCode::ERROR_DOWNLOAD_MANIFEST: case EventAssetsManagerEx::EventCode::ERROR_PARSE_MANIFEST: { - CCLOG("Fail to download manifest file, update skipped."); + AXLOG("Fail to download manifest file, update skipped."); this->onLoadEnd(); } break; case EventAssetsManagerEx::EventCode::ALREADY_UP_TO_DATE: case EventAssetsManagerEx::EventCode::UPDATE_FINISHED: { - CCLOG("Update finished. %s", event->getMessage().c_str()); + AXLOG("Update finished. %s", event->getMessage().c_str()); this->onLoadEnd(); } break; case EventAssetsManagerEx::EventCode::UPDATE_FAILED: { - CCLOG("Update failed. %s", event->getMessage().c_str()); + AXLOG("Update failed. %s", event->getMessage().c_str()); failCount++; if (failCount < 5) @@ -184,7 +184,7 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) } else { - CCLOG("Reach maximum fail count, exit update process"); + AXLOG("Reach maximum fail count, exit update process"); failCount = 0; this->onLoadEnd(); } @@ -192,12 +192,12 @@ void AssetsManagerExLoaderScene::startDownloadCallback(Ref* sender) break; case EventAssetsManagerEx::EventCode::ERROR_UPDATING: { - CCLOG("Asset %s : %s", event->getAssetId().c_str(), event->getMessage().c_str()); + AXLOG("Asset %s : %s", event->getAssetId().c_str(), event->getMessage().c_str()); } break; case EventAssetsManagerEx::EventCode::ERROR_DECOMPRESS: { - CCLOG("%s", event->getMessage().c_str()); + AXLOG("%s", event->getMessage().c_str()); } break; default: diff --git a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp index a199e6341f..47b2254e60 100644 --- a/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp +++ b/tests/cpp-tests/Classes/ExtensionsTest/TableViewTest/TableViewTestScene.cpp @@ -70,7 +70,7 @@ bool TableViewTest::init() void TableViewTest::tableCellTouched(TableView* table, TableViewCell* cell) { - CCLOG("cell touched at index: %d", static_cast(cell->getIdx())); + AXLOG("cell touched at index: %d", static_cast(cell->getIdx())); } Size TableViewTest::tableCellSizeForIndex(TableView* table, ssize_t idx) diff --git a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp index a1165fb1d8..a306552eeb 100644 --- a/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp +++ b/tests/cpp-tests/Classes/FileUtilsTest/FileUtilsTest.cpp @@ -123,7 +123,7 @@ void TestSearchPath::onEnter() if (fp) { size_t ret = fwrite(szBuf, 1, strlen(szBuf), fp); - CCASSERT(ret != 0, "fwrite function returned zero value"); + AXASSERT(ret != 0, "fwrite function returned zero value"); fclose(fp); if (ret != 0) log("Writing file to writable path succeed."); @@ -977,7 +977,7 @@ void TestIsFileExistAsync::onEnter() auto sharedFileUtils = FileUtils::getInstance(); sharedFileUtils->isFileExist("Images/grossini.png", [=](bool isExist) { - CCASSERT(std::this_thread::get_id() == Director::getInstance()->getCocos2dThreadId(), + AXASSERT(std::this_thread::get_id() == Director::getInstance()->getCocos2dThreadId(), "Callback should be on cocos thread"); auto label = Label::createWithSystemFont( isExist ? "Images/grossini.png exists" : "Images/grossini.png doesn't exist", "", 20); @@ -1070,7 +1070,7 @@ void TestFileFuncsAsync::onEnter() fclose(out); sharedFileUtils->isFileExist(filepath, [=](bool exists) { - CCASSERT(exists, "File could not be found"); + AXASSERT(exists, "File could not be found"); auto label = Label::createWithSystemFont("Test file '__test.test' created", "", 20); label->setPosition(x, y * 4); this->addChild(label); @@ -1082,13 +1082,13 @@ void TestFileFuncsAsync::onEnter() this->addChild(label); sharedFileUtils->renameFile(sharedFileUtils->getWritablePath(), filename, filename2, [=](bool success) { - CCASSERT(success, "Was not able to properly rename file"); + AXASSERT(success, "Was not able to properly rename file"); auto label = Label::createWithSystemFont("renameFile: Test file renamed to '__newtest.test'", "", 20); label->setPosition(x, y * 2); this->addChild(label); sharedFileUtils->removeFile(sharedFileUtils->getWritablePath() + filename2, [=](bool success) { - CCASSERT(success, "Was not able to remove file"); + AXASSERT(success, "Was not able to remove file"); auto label = Label::createWithSystemFont("removeFile: Test file removed", "", 20); label->setPosition(x, y * 1); this->addChild(label); @@ -1130,11 +1130,11 @@ void TestWriteStringAsync::onEnter() std::string fullPath = writablePath + fileName; FileUtils::getInstance()->writeStringToFile(writeDataStr, fullPath, [=](bool success) { - CCASSERT(success, "Write String to data failed"); + AXASSERT(success, "Write String to data failed"); writeResult->setString("write success:" + writeDataStr); FileUtils::getInstance()->getStringFromFile(fullPath, [=](std::string_view value) { - CCASSERT(!value.empty(), "String should be readable"); + AXASSERT(!value.empty(), "String should be readable"); std::string strVal = "read success: "; readResult->setString(strVal.append(value)); @@ -1240,12 +1240,12 @@ void TestListFiles::onEnter() for (int i = 0; i < listFonts.size(); i++) { - CCLOG("fonts/ %d: \t %s", i, listFonts[i].c_str()); + AXLOG("fonts/ %d: \t %s", i, listFonts[i].c_str()); } for (int i = 0; i < list.size(); i++) { - CCLOG("defResRootPath %d: \t %s", i, list[i].c_str()); + AXLOG("defResRootPath %d: \t %s", i, list[i].c_str()); } cntLabel->setString(cntBuffer); diff --git a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp index b15facf5ab..7068cf7304 100644 --- a/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp +++ b/tests/cpp-tests/Classes/LabelTest/LabelTestNew.cpp @@ -397,7 +397,7 @@ LabelFNTHundredLabels::LabelFNTHundredLabels() auto s = Director::getInstance()->getWinSize(); - auto p = Vec2(CCRANDOM_0_1() * s.width, CCRANDOM_0_1() * s.height); + auto p = Vec2(AXRANDOM_0_1() * s.width, AXRANDOM_0_1() * s.height); label->setPosition(p); } } @@ -422,14 +422,14 @@ LabelFNTMultiLine::LabelFNTMultiLine() addChild(label1, 0, kTagBitmapAtlas1); s = label1->getContentSize(); - CCLOG("content size: %.2fx%.2f", s.width, s.height); + AXLOG("content size: %.2fx%.2f", s.width, s.height); // Center auto label2 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "Multi line\nCenter"); addChild(label2, 0, kTagBitmapAtlas2); s = label2->getContentSize(); - CCLOG("content size: %.2fx%.2f", s.width, s.height); + AXLOG("content size: %.2fx%.2f", s.width, s.height); // right auto label3 = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "Multi line\nRight\nThree lines Three"); @@ -437,7 +437,7 @@ LabelFNTMultiLine::LabelFNTMultiLine() addChild(label3, 0, kTagBitmapAtlas3); s = label3->getContentSize(); - CCLOG("content size: %.2fx%.2f", s.width, s.height); + AXLOG("content size: %.2fx%.2f", s.width, s.height); label1->setPosition(VisibleRect::leftBottom()); label2->setPosition(VisibleRect::center()); @@ -1525,7 +1525,7 @@ LabelCharMapColorTest::LabelCharMapColorTest() void LabelCharMapColorTest::actionFinishCallback() { - CCLOG("Action finished"); + AXLOG("Action finished"); } void LabelCharMapColorTest::step(float dt) @@ -2498,7 +2498,7 @@ void LabelLayoutBaseTest::valueChanged(axis::Ref* sender, axis::extension::Contr // letterSprite->stopAllActions(); // letterSprite->runAction(Sequence::create(moveBy, moveBy->clone()->reverse(), nullptr )); // - // CCLOG("label line height = %f", _label->getLineHeight()); + // AXLOG("label line height = %f", _label->getLineHeight()); } void LabelLayoutBaseTest::updateDrawNodeSize(const axis::Size& drawNodeSize) diff --git a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp index c3c0026b2c..0c00ccde1b 100644 --- a/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp +++ b/tests/cpp-tests/Classes/LayerTest/LayerTest.cpp @@ -919,27 +919,27 @@ void LayerRadialGradientTest::sliderCallback(axis::Ref* sender, axis::ui::Slider case 0: // scale _layer->setScale(percent * 2); - CCLOG("scale is %f", percent * 2); + AXLOG("scale is %f", percent * 2); break; case 1: // skewx _layer->setSkewX(90 * percent); - CCLOG("SkewX is %f", 90 * percent); + AXLOG("SkewX is %f", 90 * percent); break; case 2: // skewy _layer->setSkewY(90 * percent); - CCLOG("SkewY is %f", 90 * percent); + AXLOG("SkewY is %f", 90 * percent); break; case 3: // expand _layer->setExpand(percent); - CCLOG("expand is %f", percent); + AXLOG("expand is %f", percent); break; case 4: // radius _layer->setRadius(300 * percent); - CCLOG("radius is %f", 300 * percent); + AXLOG("radius is %f", 300 * percent); break; default: break; diff --git a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp index c890335c57..f892fe1f4c 100644 --- a/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp +++ b/tests/cpp-tests/Classes/MaterialSystemTest/MaterialSystemTest.cpp @@ -209,15 +209,15 @@ bool EffectAutoBindingResolver::resolveAutoBinding(backend::ProgramState* progra void EffectAutoBindingResolver::callbackRadius(backend::ProgramState* programState, backend::UniformLocation uniform) { - float f = CCRANDOM_0_1() * 10; + float f = AXRANDOM_0_1() * 10; programState->setUniform(uniform, &f, sizeof(f)); } void EffectAutoBindingResolver::callbackColor(backend::ProgramState* programState, backend::UniformLocation uniform) { - float r = CCRANDOM_0_1(); - float g = CCRANDOM_0_1(); - float b = CCRANDOM_0_1(); + float r = AXRANDOM_0_1(); + float g = AXRANDOM_0_1(); + float b = AXRANDOM_0_1(); Vec3 color(r, g, b); programState->setUniform(uniform, &color, sizeof(color)); @@ -417,7 +417,7 @@ void Material_parsePerformance::onEnter() ui::Slider* slider = dynamic_cast(sender); float p = slider->getPercent() / 100.0f; slider->setTouchEnabled(false); - CCLOG("Will parsing material %d times", (int)(p * _maxParsingCoumt)); + AXLOG("Will parsing material %d times", (int)(p * _maxParsingCoumt)); Label* label = dynamic_cast(this->getChildByTag(SHOW_LEBAL_TAG)); if (label) { @@ -467,7 +467,7 @@ void Material_parsePerformance::parsingTesting(unsigned int count) elapsed_secs, count); label->setString(str); - CCLOG("Took: %.3f seconds for parsing material %d times.", elapsed_secs, count); + AXLOG("Took: %.3f seconds for parsing material %d times.", elapsed_secs, count); } } diff --git a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp index 49f541b0ce..92692e0d2c 100644 --- a/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp +++ b/tests/cpp-tests/Classes/MenuTest/MenuTest.cpp @@ -83,7 +83,7 @@ MenuLayerMainMenu::MenuLayerMainMenu() auto item3 = MenuItemLabel::create(labelAtlas, AX_CALLBACK_1(MenuLayerMainMenu::menuCallbackDisabled, this)); item3->setDisabledColor(Color3B(32, 32, 64)); item3->setColor(Color3B(200, 200, 255)); - CCLOG("test MenuItem Label getString: %s", item3->getString().data()); + AXLOG("test MenuItem Label getString: %s", item3->getString().data()); // Font Item auto item4 = MenuItemFont::create("I toggle enable items", [&](Ref* sender) { _disabledItem->setEnabled(!_disabledItem->isEnabled()); }); @@ -327,7 +327,7 @@ MenuLayer3::MenuLayer3() auto label = Label::createWithBMFont("fonts/bitmapFontTest3.fnt", "Enable AtlasItem"); auto item1 = MenuItemLabel::create(label, [&](Ref* sender) { - // CCLOG("Label clicked. Toggling AtlasSprite"); + // AXLOG("Label clicked. Toggling AtlasSprite"); _disabledItem->setEnabled(!_disabledItem->isEnabled()); _disabledItem->stopAllActions(); }); @@ -445,7 +445,7 @@ MenuLayer4::~MenuLayer4() {} void MenuLayer4::menuCallback(Ref* sender) { - // CCLOG("selected item: %x index:%d", dynamic_cast(sender)->selectedItem(), + // AXLOG("selected item: %x index:%d", dynamic_cast(sender)->selectedItem(), // dynamic_cast(sender)->selectedIndex() ); } diff --git a/tests/cpp-tests/Classes/MeshRendererTest/DrawNode3D.cpp b/tests/cpp-tests/Classes/MeshRendererTest/DrawNode3D.cpp index 9355b455b7..de7d5553e4 100644 --- a/tests/cpp-tests/Classes/MeshRendererTest/DrawNode3D.cpp +++ b/tests/cpp-tests/Classes/MeshRendererTest/DrawNode3D.cpp @@ -55,7 +55,7 @@ DrawNode3D* DrawNode3D::create() void DrawNode3D::ensureCapacity(int count) { - CCASSERT(count >= 0, "capacity must be >= 0"); + AXASSERT(count >= 0, "capacity must be >= 0"); auto EXTENDED_SIZE = _bufferLines.size() + count; diff --git a/tests/cpp-tests/Classes/MeshRendererTest/MeshRendererTest.cpp b/tests/cpp-tests/Classes/MeshRendererTest/MeshRendererTest.cpp index e9b4638ad4..9e78bfad12 100644 --- a/tests/cpp-tests/Classes/MeshRendererTest/MeshRendererTest.cpp +++ b/tests/cpp-tests/Classes/MeshRendererTest/MeshRendererTest.cpp @@ -167,7 +167,7 @@ MeshRendererBasicTest::MeshRendererBasicTest() void MeshRendererBasicTest::addNewMeshWithCoords(Vec2 p) { - // int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f); + // int idx = (int)(AXRANDOM_0_1() * 1400.0f / 100.0f); // int x = (idx%5) * 85; // int y = (idx/5) * 121; @@ -188,7 +188,7 @@ void MeshRendererBasicTest::addNewMeshWithCoords(Vec2 p) mesh->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -784,7 +784,7 @@ void MeshRendererEffectTest::addNewMeshWithCoords(Vec2 p) mesh->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -931,11 +931,11 @@ void MeshRendererWithSkinTest::addNewMeshWithCoords(Vec2 p) float speed = 1.0f; if (rand2 % 3 == 1) { - speed = animate->getSpeed() + CCRANDOM_0_1(); + speed = animate->getSpeed() + AXRANDOM_0_1(); } else if (rand2 % 3 == 2) { - speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1(); + speed = animate->getSpeed() - 0.5 * AXRANDOM_0_1(); } animate->setSpeed(inverse ? -speed : speed); animate->setTag(110); @@ -1045,11 +1045,11 @@ void MeshRendererWithSkinOutlineTest::addNewMeshWithCoords(Vec2 p) float speed = 1.0f; if (rand2 % 3 == 1) { - speed = animate->getSpeed() + CCRANDOM_0_1(); + speed = animate->getSpeed() + AXRANDOM_0_1(); } else if (rand2 % 3 == 2) { - speed = animate->getSpeed() - 0.5 * CCRANDOM_0_1(); + speed = animate->getSpeed() - 0.5 * AXRANDOM_0_1(); } animate->setSpeed(inverse ? -speed : speed); @@ -1563,8 +1563,8 @@ void MeshRendererWithOBBPerformanceTest::addOBBWithCount(float value) { for (int i = 0; i < value; i++) { - Vec2 randompos = Vec2(CCRANDOM_0_1() * Director::getInstance()->getWinSize().width, - CCRANDOM_0_1() * Director::getInstance()->getWinSize().height); + Vec2 randompos = Vec2(AXRANDOM_0_1() * Director::getInstance()->getWinSize().width, + AXRANDOM_0_1() * Director::getInstance()->getWinSize().height); Vec3 extents = Vec3(10, 10, 10); AABB aabb(-extents, extents); auto obb = OBB(aabb); @@ -2371,7 +2371,7 @@ void CameraBackgroundClearTest::switch_CameraClearMode(axis::Ref* sender) CameraBackgroundBrush::BrushType type = CameraBackgroundBrush::BrushType::NONE; if (!brush) { - CCLOG("No brash found!"); + AXLOG("No brash found!"); } else { @@ -2383,7 +2383,7 @@ void CameraBackgroundClearTest::switch_CameraClearMode(axis::Ref* sender) _camera->setBackgroundBrush(CameraBackgroundBrush::createDepthBrush(1.f)); _label->setString("Depth Clear Brush"); // Test brush valid when set by user scene setting - CCLOG("Background brush valid status is : %s", _camera->isBrushValid() ? "true" : "false"); + AXLOG("Background brush valid status is : %s", _camera->isBrushValid() ? "true" : "false"); } else if (type == CameraBackgroundBrush::BrushType::DEPTH) { @@ -2473,7 +2473,7 @@ MeshRendererNormalMappingTest::MeshRendererNormalMappingTest() } int maxAttributes = Configuration::getInstance()->getMaxAttributes(); - CCASSERT(maxAttributes > 8, "attributes supported must be greater than 8"); + AXASSERT(maxAttributes > 8, "attributes supported must be greater than 8"); if (maxAttributes > 8) { auto mesh = MeshRenderer::create("MeshRendererTest/sphere_bumped.c3b"); @@ -2587,13 +2587,13 @@ std::string MeshRendererPropertyTest::subtitle() const void MeshRendererPropertyTest::update(float delta) {} void MeshRendererPropertyTest::printMeshName(axis::Ref* sender) { - CCLOG("MeshName Begin"); + AXLOG("MeshName Begin"); Vector meshes = _mesh->getMeshes(); for (Mesh* mesh : meshes) { log("MeshName: %s ", mesh->getName().data()); } - CCLOG("MeshName End"); + AXLOG("MeshName End"); } void MeshRendererPropertyTest::removeUsedTexture(axis::Ref* sender) { diff --git a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp index 7168f126f2..a440cc0790 100644 --- a/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp +++ b/tests/cpp-tests/Classes/NetworkTest/HttpClientTest/HttpClientTest.cpp @@ -48,7 +48,7 @@ HttpClientTest::HttpClientTest() : _labelStatusCode(nullptr) auto cafile = FileUtils::getInstance()->fullPathForFilename("cacert.pem"); httpClient->setSSLVerification(cafile); httpClient->enableCookies(nullptr); - CCLOG("The http cookie will store to: %s", httpClient->getCookieFilename().data()); + AXLOG("The http cookie will store to: %s", httpClient->getCookieFilename().data()); const int MARGIN = 40; const int SPACE = 35; diff --git a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp index 2e4a4c32c0..788048588a 100644 --- a/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp +++ b/tests/cpp-tests/Classes/NewAudioEngineTest/NewAudioEngineTest.cpp @@ -422,7 +422,7 @@ bool AudioLoadTest::init() AudioEngine::preload("audio/SoundEffectsFX009/FX082.mp3", [isDestroyed, stateLabel](bool isSuccess) { if (*isDestroyed) { - CCLOG("AudioLoadTest scene was destroyed, no need to set the label text."); + AXLOG("AudioLoadTest scene was destroyed, no need to set the label text."); return; } @@ -738,7 +738,7 @@ bool AudioIssue18597Test::init() // test case for https://github.com/cocos2d/cocos2d-x/issues/18597 this->schedule( [=](float dt) { - CCLOG("issues 18597 audio crash test"); + AXLOG("issues 18597 audio crash test"); for (int i = 0; i < 2; ++i) { auto id = AudioEngine::play2d("audio/MUS_BGM_Battle_Round1_v1.caf", true, 1.0f); diff --git a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp index 5481cc5baf..be2c103215 100644 --- a/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp +++ b/tests/cpp-tests/Classes/NewEventDispatcherTest/NewEventDispatcherTest.cpp @@ -782,7 +782,7 @@ void RemoveListenerAfterAddingTest::onEnter() auto item1 = MenuItemFont::create("Click Me 1", [this](Ref* sender) { auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event) -> bool { - CCASSERT(false, "Should not come here!"); + AXASSERT(false, "Should not come here!"); return true; }; @@ -806,7 +806,7 @@ void RemoveListenerAfterAddingTest::onEnter() auto item2 = MenuItemFont::create("Click Me 2", [=](Ref* sender) { auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event) -> bool { - CCASSERT(false, "Should not come here!"); + AXASSERT(false, "Should not come here!"); return true; }; @@ -821,7 +821,7 @@ void RemoveListenerAfterAddingTest::onEnter() auto item3 = MenuItemFont::create("Click Me 3", [=](Ref* sender) { auto listener = EventListenerTouchOneByOne::create(); listener->onTouchBegan = [](Touch* touch, Event* event) -> bool { - CCASSERT(false, "Should not come here!"); + AXASSERT(false, "Should not come here!"); return true; }; @@ -1066,7 +1066,7 @@ StopPropagationTest::StopPropagationTest() return false; auto target = static_cast(event->getCurrentTarget()); - CCASSERT(target->getTag() == TAG_BLUE_SPRITE, "Yellow blocks shouldn't response event."); + AXASSERT(target->getTag() == TAG_BLUE_SPRITE, "Yellow blocks shouldn't response event."); if (this->isPointInNode(touch->getLocation(), target)) { @@ -1091,7 +1091,7 @@ StopPropagationTest::StopPropagationTest() return; auto target = static_cast(event->getCurrentTarget()); - CCASSERT(target->getTag() == TAG_BLUE_SPRITE2, "Yellow blocks shouldn't response event."); + AXASSERT(target->getTag() == TAG_BLUE_SPRITE2, "Yellow blocks shouldn't response event."); if (this->isPointInNode(touches[0]->getLocation(), target)) { @@ -1107,7 +1107,7 @@ StopPropagationTest::StopPropagationTest() return; auto target = static_cast(event->getCurrentTarget()); - CCASSERT(target->getTag() == TAG_BLUE_SPRITE2, "Yellow blocks shouldn't response event."); + AXASSERT(target->getTag() == TAG_BLUE_SPRITE2, "Yellow blocks shouldn't response event."); if (this->isPointInNode(touches[0]->getLocation(), target)) { @@ -1121,7 +1121,7 @@ StopPropagationTest::StopPropagationTest() keyboardEventListener->onKeyPressed = [](EventKeyboard::KeyCode /*key*/, Event* event) { auto target = static_cast(event->getCurrentTarget()); AX_UNUSED_PARAM(target); - CCASSERT(target->getTag() == TAG_BLUE_SPRITE || target->getTag() == TAG_BLUE_SPRITE2, + AXASSERT(target->getTag() == TAG_BLUE_SPRITE || target->getTag() == TAG_BLUE_SPRITE2, "Yellow blocks shouldn't response event."); // Stop propagation, so yellow blocks will not be able to receive event. event->stopPropagation(); @@ -1434,7 +1434,7 @@ Issue4129::Issue4129() : _bugFixed(false) _eventDispatcher->removeAllEventListeners(); auto nextItem = MenuItemFont::create("Reset", [=](Ref* sender) { - CCASSERT(_bugFixed, "This issue was not fixed!"); + AXASSERT(_bugFixed, "This issue was not fixed!"); getTestSuite()->restartCurrTest(); }); @@ -1576,15 +1576,15 @@ DanglingNodePointersTest::DanglingNodePointersTest() Size size = Director::getInstance()->getVisibleSize(); auto callback2 = [](DanglingNodePointersTestSprite* sprite2) { - CCASSERT(false, "This should never be called because the sprite gets removed from it's parent and destroyed!"); + AXASSERT(false, "This should never be called because the sprite gets removed from it's parent and destroyed!"); exit(1); }; auto callback1 = [callback2, origin, size](DanglingNodePointersTestSprite* sprite1) { DanglingNodePointersTestSprite* sprite2 = dynamic_cast(sprite1->getChildren().at(0)); - CCASSERT(sprite2, "The first child of sprite 1 should be sprite 2!"); - CCASSERT( + AXASSERT(sprite2, "The first child of sprite 1 should be sprite 2!"); + AXASSERT( sprite2->getReferenceCount() == 1, "There should only be 1 reference to sprite 1, from it's parent node. Hence removing it will destroy it!"); sprite1->removeAllChildren(); // This call should cause sprite 2 to be destroyed @@ -1634,7 +1634,7 @@ RegisterAndUnregisterWhileEventHanldingTest::RegisterAndUnregisterWhileEventHanl auto callback1 = [=](DanglingNodePointersTestSprite* sprite) { auto callback2 = [](DanglingNodePointersTestSprite* sprite) { - CCASSERT(false, "This should never get called!"); + AXASSERT(false, "This should never get called!"); }; { @@ -1710,7 +1710,7 @@ Issue8194::Issue8194() getEventDispatcher()->addCustomEventListener(Director::EVENT_AFTER_UPDATE, [this](axis::EventCustom* event) { if (nodesAdded) { - // CCLOG("Fire Issue8194 Event"); + // AXLOG("Fire Issue8194 Event"); getEventDispatcher()->dispatchCustomEvent("Issue8194"); // clear test nodes and listeners diff --git a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp index 7b49565214..8c285606f7 100644 --- a/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp +++ b/tests/cpp-tests/Classes/NewRendererTest/NewRendererTest.cpp @@ -213,7 +213,7 @@ SpriteInGroupCommand* SpriteInGroupCommand::create(std::string_view filename) void SpriteInGroupCommand::draw(Renderer* renderer, const Mat4& transform, uint32_t flags) { - CCASSERT(renderer, "Render is null"); + AXASSERT(renderer, "Render is null"); _spriteWrapperCommand.init(_globalZOrder); renderer->addCommand(&_spriteWrapperCommand); renderer->pushGroup(_spriteWrapperCommand.getRenderQueueID()); @@ -792,8 +792,8 @@ RendererBatchQuadTri::RendererBatchQuadTri() for (int i = 0; i < 250; i++) { - int x = CCRANDOM_0_1() * s.width; - int y = CCRANDOM_0_1() * s.height; + int x = AXRANDOM_0_1() * s.width; + int y = AXRANDOM_0_1() * s.height; auto label = LabelAtlas::create("This is a label", "fonts/tuffy_bold_italic-charmap.plist"); label->setColor(Color3B::RED); @@ -919,7 +919,7 @@ RendererUniformBatch2::RendererUniformBatch2() sprite->setScale(0.4); addChild(sprite); - auto r = CCRANDOM_0_1(); + auto r = AXRANDOM_0_1(); if (r < 0.33) sprite->setProgramState(sepiaState); else if (r < 0.66) diff --git a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp index 24f4292816..e6a3480f41 100644 --- a/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp +++ b/tests/cpp-tests/Classes/NodeTest/NodeTest.cpp @@ -385,17 +385,17 @@ std::string StressTest2::subtitle() const SchedulerTest1::SchedulerTest1() { auto layer = Layer::create(); - // CCLOG("retain count after init is %d", layer->getReferenceCount()); // 1 + // AXLOG("retain count after init is %d", layer->getReferenceCount()); // 1 addChild(layer, 0); - // CCLOG("retain count after addChild is %d", layer->getReferenceCount()); // 2 + // AXLOG("retain count after addChild is %d", layer->getReferenceCount()); // 2 layer->schedule(AX_CALLBACK_1(SchedulerTest1::doSomething, this), "do_something_key"); - // CCLOG("retain count after schedule is %d", layer->getReferenceCount()); // 3 : (objective-c version), but + // AXLOG("retain count after schedule is %d", layer->getReferenceCount()); // 3 : (objective-c version), but // win32 version is still 2, because Timer class don't save target. layer->unschedule("do_something_key"); - // CCLOG("retain count after unschedule is %d", layer->getReferenceCount()); // STILL 3! (win32 is '2') + // AXLOG("retain count after unschedule is %d", layer->getReferenceCount()); // STILL 3! (win32 is '2') } void SchedulerTest1::doSomething(float dt) {} @@ -814,7 +814,7 @@ void ConvertToNode::onTouchesEnded(const std::vector& touches, Event* ev p1 = node->convertToNodeSpaceAR(location); p2 = node->convertToNodeSpace(location); - CCLOG("AR: x=%.2f, y=%.2f -- Not AR: x=%.2f, y=%.2f", p1.x, p1.y, p2.x, p2.y); + AXLOG("AR: x=%.2f, y=%.2f -- Not AR: x=%.2f, y=%.2f", p1.x, p1.y, p2.x, p2.y); } } } @@ -1170,7 +1170,7 @@ void NodeNormalizedPositionTest2::update(float dt) Size s = Size(_copyContentSize.width * norm, _copyContentSize.height * norm); setContentSize(s); - CCLOG("s: %f,%f", s.width, s.height); + AXLOG("s: %f,%f", s.width, s.height); } //------------------------------------------------------------------ diff --git a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp index 9c13ae0608..7cfa3d869b 100644 --- a/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp +++ b/tests/cpp-tests/Classes/ParticleTest/ParticleTest.cpp @@ -2789,7 +2789,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt) ssize_t nChildrenCount = _batchNode->getChildren().size(); if (nChildrenCount > 0) { - CCLOG("remove random system"); + AXLOG("remove random system"); unsigned int uRand = rand() % (nChildrenCount - 1); _batchNode->removeChild(_batchNode->getChildren().at(uRand), true); @@ -2801,7 +2801,7 @@ void AddAndDeleteParticleSystems::removeSystem(float dt) particleSystem->setPosition(Vec2(rand() % 300, rand() % 400)); - CCLOG("add a new system"); + AXLOG("add a new system"); unsigned int randZ = rand() % 100; _batchNode->addChild(particleSystem, randZ, -1); } @@ -3010,7 +3010,7 @@ void PremultipliedAlphaTest::onEnter() // Cocos2d "normal" blend func for premul causes alpha to be ignored (oversaturates colors) _emitter->setBlendFunc(BlendFunc::ALPHA_PREMULTIPLIED); - CCASSERT(_emitter->isOpacityModifyRGB(), "Particle texture does not have premultiplied alpha, test is useless"); + AXASSERT(_emitter->isOpacityModifyRGB(), "Particle texture does not have premultiplied alpha, test is useless"); // Toggle next line to see old behavior // this->emitter.opacityModifyRGB = NO; diff --git a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp index 0a9810d271..5e796d2947 100644 --- a/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp +++ b/tests/cpp-tests/Classes/Physics3DTest/Physics3DTest.cpp @@ -734,15 +734,15 @@ bool Physics3DCollisionCallbackDemo::init() ci.objA->setMask(0); } } - // CCLOG("------------BoxB Collision Info------------"); - // CCLOG("Collision Point Num: %d", ci.collisionPointList.size()); + // AXLOG("------------BoxB Collision Info------------"); + // AXLOG("Collision Point Num: %d", ci.collisionPointList.size()); // for (auto &iter : ci.collisionPointList){ - // CCLOG("Collision Position On A: (%.2f, %.2f, %.2f)", iter.worldPositionOnA.x, iter.worldPositionOnA.y, - // iter.worldPositionOnA.z); CCLOG("Collision Position On B: (%.2f, %.2f, %.2f)", - // iter.worldPositionOnB.x, iter.worldPositionOnB.y, iter.worldPositionOnB.z); CCLOG("Collision Normal + // AXLOG("Collision Position On A: (%.2f, %.2f, %.2f)", iter.worldPositionOnA.x, iter.worldPositionOnA.y, + // iter.worldPositionOnA.z); AXLOG("Collision Position On B: (%.2f, %.2f, %.2f)", + // iter.worldPositionOnB.x, iter.worldPositionOnB.y, iter.worldPositionOnB.z); AXLOG("Collision Normal // On B: (%.2f, %.2f, %.2f)", iter.worldNormalOnB.x, iter.worldNormalOnB.y, iter.worldNormalOnB.z); // } - // CCLOG("------------BoxB Collision Info------------"); + // AXLOG("------------BoxB Collision Info------------"); }); } diff --git a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp index b92b649b83..74f1f736d8 100644 --- a/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp +++ b/tests/cpp-tests/Classes/PhysicsTest/PhysicsTest.cpp @@ -101,12 +101,12 @@ void PhysicsDemo::onEnter() Sprite* PhysicsDemo::addGrossiniAtPosition(Vec2 p, float scale /* = 1.0*/) { - CCLOG("Add sprite %0.2f x %02.f", p.x, p.y); + AXLOG("Add sprite %0.2f x %02.f", p.x, p.y); int posx, posy; - posx = CCRANDOM_0_1() * 200.0f; - posy = CCRANDOM_0_1() * 200.0f; + posx = AXRANDOM_0_1() * 200.0f; + posy = AXRANDOM_0_1() * 200.0f; posx = (posx % 4) * 85; posy = (posy % 3) * 121; @@ -205,7 +205,7 @@ Sprite* PhysicsDemo::makeBox(Vec2 point, Size size, int color, PhysicsMaterial m bool yellow = false; if (color == 0) { - yellow = CCRANDOM_0_1() > 0.5f; + yellow = AXRANDOM_0_1() > 0.5f; } else { @@ -228,7 +228,7 @@ Sprite* PhysicsDemo::makeTriangle(Vec2 point, Size size, int color, PhysicsMater bool yellow = false; if (color == 0) { - yellow = CCRANDOM_0_1() > 0.5f; + yellow = AXRANDOM_0_1() > 0.5f; } else { @@ -623,19 +623,19 @@ void PhysicsDemoRayCast::onTouchesEnded(const std::vector& touches, Even { auto location = touch->getLocation(); - float r = CCRANDOM_0_1(); + float r = AXRANDOM_0_1(); if (r < 1.0f / 3.0f) { - addChild(makeBall(location, 5 + CCRANDOM_0_1() * 10)); + addChild(makeBall(location, 5 + AXRANDOM_0_1() * 10)); } else if (r < 2.0f / 3.0f) { - addChild(makeBox(location, Size(10 + CCRANDOM_0_1() * 15, 10 + CCRANDOM_0_1() * 15))); + addChild(makeBox(location, Size(10 + AXRANDOM_0_1() * 15, 10 + AXRANDOM_0_1() * 15))); } else { - addChild(makeTriangle(location, Size(10 + CCRANDOM_0_1() * 20, 10 + CCRANDOM_0_1() * 20))); + addChild(makeTriangle(location, Size(10 + AXRANDOM_0_1() * 20, 10 + AXRANDOM_0_1() * 20))); } } } @@ -983,7 +983,7 @@ void PhysicsDemoPump::onEnter() // balls for (int i = 0; i < 6; ++i) { - auto ball = makeBall(VisibleRect::leftTop() + Vec2(75 + CCRANDOM_0_1() * 90, 0.0f), 22, + auto ball = makeBall(VisibleRect::leftTop() + Vec2(75 + AXRANDOM_0_1() * 90, 0.0f), 22, PhysicsMaterial(0.05f, 0.0f, 0.1f)); ball->getPhysicsBody()->setTag(DRAG_BODYS_TAG); addChild(ball); @@ -1056,7 +1056,7 @@ void PhysicsDemoPump::update(float delta) { if (body->getNode() != nullptr) { - body->getNode()->setPosition(VisibleRect::leftTop() + Vec2(75 + CCRANDOM_0_1() * 90, 0.0f)); + body->getNode()->setPosition(VisibleRect::leftTop() + Vec2(75 + AXRANDOM_0_1() * 90, 0.0f)); } body->setVelocity(Vec2(0.0f, 0.0f)); @@ -1468,13 +1468,13 @@ void PhysicsContactTest::resetTest() // yellow box, will collide with itself and blue box. for (int i = 0; i < _yellowBoxNum; ++i) { - Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); + Size size(10 + AXRANDOM_0_1() * 10, 10 + AXRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); - position.x = position.x * CCRANDOM_0_1(); - position.y = position.y * CCRANDOM_0_1(); + position.x = position.x * AXRANDOM_0_1(); + position.y = position.y * AXRANDOM_0_1(); position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); - Vec2 velocity((float)(CCRANDOM_0_1() - 0.5) * 200, (float)(CCRANDOM_0_1() - 0.5) * 200); + Vec2 velocity((float)(AXRANDOM_0_1() - 0.5) * 200, (float)(AXRANDOM_0_1() - 0.5) * 200); auto box = makeBox(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f)); auto boxBody = box->getPhysicsBody(); boxBody->setVelocity(velocity); @@ -1487,13 +1487,13 @@ void PhysicsContactTest::resetTest() // blue box, will collide with blue box. for (int i = 0; i < _blueBoxNum; ++i) { - Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); + Size size(10 + AXRANDOM_0_1() * 10, 10 + AXRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); - position.x = position.x * CCRANDOM_0_1(); - position.y = position.y * CCRANDOM_0_1(); + position.x = position.x * AXRANDOM_0_1(); + position.y = position.y * AXRANDOM_0_1(); position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); - Vec2 velocity((float)(CCRANDOM_0_1() - 0.5) * 200, (float)(CCRANDOM_0_1() - 0.5) * 200); + Vec2 velocity((float)(AXRANDOM_0_1() - 0.5) * 200, (float)(AXRANDOM_0_1() - 0.5) * 200); auto box = makeBox(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f)); auto boxBody = box->getPhysicsBody(); boxBody->setVelocity(velocity); @@ -1506,13 +1506,13 @@ void PhysicsContactTest::resetTest() // yellow triangle, will collide with itself and blue box. for (int i = 0; i < _yellowTriangleNum; ++i) { - Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); + Size size(10 + AXRANDOM_0_1() * 10, 10 + AXRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); - position.x = position.x * CCRANDOM_0_1(); - position.y = position.y * CCRANDOM_0_1(); + position.x = position.x * AXRANDOM_0_1(); + position.y = position.y * AXRANDOM_0_1(); position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); - Vec2 velocity((float)(CCRANDOM_0_1() - 0.5) * 300, (float)(CCRANDOM_0_1() - 0.5) * 300); + Vec2 velocity((float)(AXRANDOM_0_1() - 0.5) * 300, (float)(AXRANDOM_0_1() - 0.5) * 300); auto triangle = makeTriangle(position, size, 1, PhysicsMaterial(0.1f, 1, 0.0f)); auto triangleBody = triangle->getPhysicsBody(); triangleBody->setVelocity(velocity); @@ -1525,13 +1525,13 @@ void PhysicsContactTest::resetTest() // blue triangle, will collide with yellow box. for (int i = 0; i < _blueTriangleNum; ++i) { - Size size(10 + CCRANDOM_0_1() * 10, 10 + CCRANDOM_0_1() * 10); + Size size(10 + AXRANDOM_0_1() * 10, 10 + AXRANDOM_0_1() * 10); Size winSize = VisibleRect::getVisibleRect().size; Vec2 position = Vec2(winSize.width, winSize.height) - Vec2(size.width, size.height); - position.x = position.x * CCRANDOM_0_1(); - position.y = position.y * CCRANDOM_0_1(); + position.x = position.x * AXRANDOM_0_1(); + position.y = position.y * AXRANDOM_0_1(); position = VisibleRect::leftBottom() + position + Vec2(size.width / 2, size.height / 2); - Vec2 velocity((float)(CCRANDOM_0_1() - 0.5) * 300, (float)(CCRANDOM_0_1() - 0.5) * 300); + Vec2 velocity((float)(AXRANDOM_0_1() - 0.5) * 300, (float)(AXRANDOM_0_1() - 0.5) * 300); auto triangle = makeTriangle(position, size, 2, PhysicsMaterial(0.1f, 1, 0.0f)); auto triangleBody = triangle->getPhysicsBody(); triangleBody->setVelocity(velocity); diff --git a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp index 6fb7594aad..1fc3279d46 100644 --- a/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp +++ b/tests/cpp-tests/Classes/ReleasePoolTest/ReleasePoolTest.cpp @@ -36,12 +36,12 @@ class TestObject : public Ref public: TestObject() : _name("") {} - TestObject(std::string name) : _name(name) { CCLOG("TestObject:%s is created", _name.c_str()); } + TestObject(std::string name) : _name(name) { AXLOG("TestObject:%s is created", _name.c_str()); } ~TestObject() { if (_name.size() > 0) - CCLOG("TestObject:%s is destroyed", _name.c_str()); + AXLOG("TestObject:%s is destroyed", _name.c_str()); } private: diff --git a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp index dbe28026d1..ad871b0377 100644 --- a/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp +++ b/tests/cpp-tests/Classes/RenderTextureTest/RenderTextureTest.cpp @@ -87,7 +87,7 @@ std::string RenderTextureSave::subtitle() const void RenderTextureSave::clearImage(axis::Ref* sender) { - _target->clear(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1()); + _target->clear(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1()); } void RenderTextureSave::clearImageTransparent(axis::Ref* sender) @@ -115,7 +115,7 @@ void RenderTextureSave::saveImageWithPremultipliedAlpha(axis::Ref* sender) _target->saveToFile(png, Image::Format::PNG, true, callback); // Add this function to avoid crash if we switch to a new scene. Director::getInstance()->getRenderer()->render(); - CCLOG("Image saved %s", png); + AXLOG("Image saved %s", png); counter++; } @@ -141,7 +141,7 @@ void RenderTextureSave::saveImageWithNonPremultipliedAlpha(axis::Ref* sender) // Add this function to avoid crash if we switch to a new scene. Director::getInstance()->getRenderer()->render(); - CCLOG("Image saved %s", png); + AXLOG("Image saved %s", png); counter++; } @@ -155,8 +155,8 @@ void RenderTextureSave::addImage(axis::Ref* sender) Sprite* sprite = Sprite::create("Images/test-rgba1.png"); sprite->setPosition( - sprite->getContentSize().width + CCRANDOM_0_1() * (s.width - sprite->getContentSize().width), - sprite->getContentSize().height + CCRANDOM_0_1() * (s.height - sprite->getContentSize().height)); + sprite->getContentSize().width + AXRANDOM_0_1() * (s.width - sprite->getContentSize().width), + sprite->getContentSize().height + AXRANDOM_0_1() * (s.height - sprite->getContentSize().height)); sprite->visit(); // finish drawing and return context back to the screen @@ -201,8 +201,8 @@ void RenderTextureSave::onTouchesMoved(const std::vector& touches, Event _brushs.at(i)->setRotation(rand() % 360); float r = (float)(rand() % 50 / 50.f) + 0.25f; _brushs.at(i)->setScale(r); - /*_brush->setColor(Color3B(CCRANDOM_0_1() * 127 + 128, 255, 255));*/ - // Use CCRANDOM_0_1() will cause error when loading libtests.so on android, I don't know why. + /*_brush->setColor(Color3B(AXRANDOM_0_1() * 127 + 128, 255, 255));*/ + // Use AXRANDOM_0_1() will cause error when loading libtests.so on android, I don't know why. _brushs.at(i)->setColor(Color3B(rand() % 127 + 128, 255, 255)); // Call visit to draw the brush, don't call draw.. _brushs.at(i)->visit(); @@ -649,7 +649,7 @@ void RenderTextureTargetNode::touched(Ref* sender) else { renderTexture->setClearFlags(ClearFlag::NONE); - renderTexture->setClearColor(Color4F(CCRANDOM_0_1(), CCRANDOM_0_1(), CCRANDOM_0_1(), 1)); + renderTexture->setClearColor(Color4F(AXRANDOM_0_1(), AXRANDOM_0_1(), AXRANDOM_0_1(), 1)); } } @@ -723,7 +723,7 @@ SpriteRenderTextureBug::SpriteRenderTextureBug() SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCoords(const Vec2& p) { - int idx = CCRANDOM_0_1() * 1400 / 100; + int idx = AXRANDOM_0_1() * 1400 / 100; int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -733,7 +733,7 @@ SpriteRenderTextureBug::SimpleSprite* SpriteRenderTextureBug::addNewSpriteWithCo sprite->setPosition(p); FiniteTimeAction* action = nullptr; - float rd = CCRANDOM_0_1(); + float rd = AXRANDOM_0_1(); if (rd < 0.20) action = ScaleBy::create(3, 2); diff --git a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp index 93f4121b8b..187e11f1d1 100644 --- a/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp +++ b/tests/cpp-tests/Classes/SceneTest/SceneTest.cpp @@ -72,18 +72,18 @@ SceneTestLayer1::SceneTestLayer1() void SceneTestLayer1::testDealloc(float dt) { - // CCLOG("SceneTestLayer1:testDealloc"); + // AXLOG("SceneTestLayer1:testDealloc"); } void SceneTestLayer1::onEnter() { - CCLOG("SceneTestLayer1#onEnter"); + AXLOG("SceneTestLayer1#onEnter"); Layer::onEnter(); } void SceneTestLayer1::onEnterTransitionDidFinish() { - CCLOG("SceneTestLayer1#onEnterTransitionDidFinish"); + AXLOG("SceneTestLayer1#onEnterTransitionDidFinish"); Layer::onEnterTransitionDidFinish(); } diff --git a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp index e340d7ea79..cb837c517b 100644 --- a/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp +++ b/tests/cpp-tests/Classes/SchedulerTest/SchedulerTest.cpp @@ -81,18 +81,18 @@ void SchedulerAutoremove::onEnter() void SchedulerAutoremove::autoremove(float dt) { accum += dt; - CCLOG("autoremove scheduler: Time: %f", accum); + AXLOG("autoremove scheduler: Time: %f", accum); if (accum > 3) { unschedule(AX_SCHEDULE_SELECTOR(SchedulerAutoremove::autoremove)); - CCLOG("autoremove scheduler: scheduler removed"); + AXLOG("autoremove scheduler: scheduler removed"); } } void SchedulerAutoremove::tick(float /*dt*/) { - CCLOG("tick scheduler: This scheduler should not be removed"); + AXLOG("tick scheduler: This scheduler should not be removed"); } std::string SchedulerAutoremove::title() const @@ -120,17 +120,17 @@ void SchedulerPauseResume::onEnter() void SchedulerPauseResume::tick1(float /*dt*/) { - CCLOG("tick1"); + AXLOG("tick1"); } void SchedulerPauseResume::tick2(float /*dt*/) { - CCLOG("tick2"); + AXLOG("tick2"); } void SchedulerPauseResume::pause(float /*dt*/) { - CCLOG("paused, tick1 and tick2 should called six times"); + AXLOG("paused, tick1 and tick2 should called six times"); Director::getInstance()->getScheduler()->pauseTarget(this); } @@ -200,7 +200,7 @@ void SchedulerPauseResumeAll::pause(float /*dt*/) _pausedTargets = scheduler->pauseAllTargets(); // should have only 2 items: ActionManager, self - CCASSERT(_pausedTargets.size() == 2, "Error: pausedTargets should have only 2 items"); + AXASSERT(_pausedTargets.size() == 2, "Error: pausedTargets should have only 2 items"); // because target 'this' has been paused above, so use another node(tag:123) as target getChildByTag(123)->scheduleOnce([this](float dt) { this->resume(dt); }, 2.0f, "test resume"); @@ -314,22 +314,22 @@ void SchedulerUnscheduleAll::onEnter() void SchedulerUnscheduleAll::tick1(float /*dt*/) { - CCLOG("tick1"); + AXLOG("tick1"); } void SchedulerUnscheduleAll::tick2(float /*dt*/) { - CCLOG("tick2"); + AXLOG("tick2"); } void SchedulerUnscheduleAll::tick3(float /*dt*/) { - CCLOG("tick3"); + AXLOG("tick3"); } void SchedulerUnscheduleAll::tick4(float /*dt*/) { - CCLOG("tick4"); + AXLOG("tick4"); } void SchedulerUnscheduleAll::unscheduleAll(float /*dt*/) @@ -386,22 +386,22 @@ void SchedulerUnscheduleAllHard::onExit() void SchedulerUnscheduleAllHard::tick1(float /*dt*/) { - CCLOG("tick1"); + AXLOG("tick1"); } void SchedulerUnscheduleAllHard::tick2(float /*dt*/) { - CCLOG("tick2"); + AXLOG("tick2"); } void SchedulerUnscheduleAllHard::tick3(float /*dt*/) { - CCLOG("tick3"); + AXLOG("tick3"); } void SchedulerUnscheduleAllHard::tick4(float /*dt*/) { - CCLOG("tick4"); + AXLOG("tick4"); } void SchedulerUnscheduleAllHard::unscheduleAll(float /*dt*/) @@ -445,22 +445,22 @@ void SchedulerUnscheduleAllUserLevel::onEnter() void SchedulerUnscheduleAllUserLevel::tick1(float /*dt*/) { - CCLOG("tick1"); + AXLOG("tick1"); } void SchedulerUnscheduleAllUserLevel::tick2(float /*dt*/) { - CCLOG("tick2"); + AXLOG("tick2"); } void SchedulerUnscheduleAllUserLevel::tick3(float /*dt*/) { - CCLOG("tick3"); + AXLOG("tick3"); } void SchedulerUnscheduleAllUserLevel::tick4(float /*dt*/) { - CCLOG("tick4"); + AXLOG("tick4"); } void SchedulerUnscheduleAllUserLevel::unscheduleAll(float /*dt*/) @@ -494,22 +494,22 @@ void SchedulerSchedulesAndRemove::onEnter() void SchedulerSchedulesAndRemove::tick1(float /*dt*/) { - CCLOG("tick1"); + AXLOG("tick1"); } void SchedulerSchedulesAndRemove::tick2(float /*dt*/) { - CCLOG("tick2"); + AXLOG("tick2"); } void SchedulerSchedulesAndRemove::tick3(float /*dt*/) { - CCLOG("tick3"); + AXLOG("tick3"); } void SchedulerSchedulesAndRemove::tick4(float /*dt*/) { - CCLOG("tick4"); + AXLOG("tick4"); } std::string SchedulerSchedulesAndRemove::title() const @@ -635,12 +635,12 @@ void SchedulerUpdateAndCustom::onEnter() void SchedulerUpdateAndCustom::update(float dt) { - CCLOG("update called:%f", dt); + AXLOG("update called:%f", dt); } void SchedulerUpdateAndCustom::tick(float dt) { - CCLOG("custom selector called:%f", dt); + AXLOG("custom selector called:%f", dt); } void SchedulerUpdateAndCustom::stopSelectors(float /*dt*/) @@ -673,7 +673,7 @@ void SchedulerUpdateFromCustom::onEnter() void SchedulerUpdateFromCustom::update(float dt) { - CCLOG("update called:%f", dt); + AXLOG("update called:%f", dt); } void SchedulerUpdateFromCustom::schedUpdate(float /*dt*/) @@ -727,7 +727,7 @@ void RescheduleSelector::schedUpdate(float dt) { _ticks++; - CCLOG("schedUpdate: %.4f", dt); + AXLOG("schedUpdate: %.4f", dt); if (_ticks > 3) { _interval += 1.0f; @@ -742,7 +742,7 @@ void SchedulerDelayAndRepeat::onEnter() { SchedulerTestLayer::onEnter(); schedule(AX_SCHEDULE_SELECTOR(SchedulerDelayAndRepeat::update), 0, 4, 3.f); - CCLOG("update is scheduled should begin after 3 seconds"); + AXLOG("update is scheduled should begin after 3 seconds"); } std::string SchedulerDelayAndRepeat::title() const @@ -1166,8 +1166,8 @@ std::string ScheduleUpdatePriority::subtitle() const bool ScheduleUpdatePriority::onTouchBegan(Touch* /*touch*/, Event* /*event*/) { - int priority = static_cast(CCRANDOM_0_1() * 11) - 5; // -5 ~ 5 - CCLOG("change update priority to %d", priority); + int priority = static_cast(AXRANDOM_0_1() * 11) - 5; // -5 ~ 5 + AXLOG("change update priority to %d", priority); scheduleUpdateWithPriority(priority); return true; } @@ -1313,12 +1313,12 @@ void SchedulerIssue17149::onEnter() void SchedulerIssue17149::update(float dt) { auto classa = new (_memoryPool) ClassA(); - CCLOG("Address one: %p", classa); + AXLOG("Address one: %p", classa); Director::getInstance()->getScheduler()->scheduleUpdate(classa, 1, false); Director::getInstance()->getScheduler()->unscheduleUpdate(classa); auto classb = new (_memoryPool) ClassB(); - CCLOG("Address one: %p", classb); + AXLOG("Address one: %p", classb); Director::getInstance()->getScheduler()->scheduleUpdate(classb, 1, false); unscheduleUpdate(); @@ -1328,14 +1328,14 @@ SchedulerIssue17149::ClassA::ClassA() : _member1(1), _member2(2), _member3(3) {} void SchedulerIssue17149::ClassA::update(float dt) { - CCLOG("i'm ClassA: %d%d%d", _member1, _member2, _member3); + AXLOG("i'm ClassA: %d%d%d", _member1, _member2, _member3); } SchedulerIssue17149::ClassB::ClassB() : _member1(4), _member2(5), _member3(6) {} void SchedulerIssue17149::ClassB::update(float dt) { - CCLOG("i'm ClassB: %d%d%d", _member1, _member2, _member3); + AXLOG("i'm ClassB: %d%d%d", _member1, _member2, _member3); Director::getInstance()->getScheduler()->unscheduleUpdate(this); } @@ -1391,7 +1391,7 @@ void SchedulerRemoveEntryWhileUpdate::TestClass::update(float dt) { if (_cleanedUp) { - CCLOG("Error: cleaned object must not be called."); + AXLOG("Error: cleaned object must not be called."); return; } diff --git a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp index 5df58d1732..bf3fb12ea3 100644 --- a/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp +++ b/tests/cpp-tests/Classes/SpineTest/SpineTest.cpp @@ -140,7 +140,7 @@ bool BatchingExample::init() _title = "Batching"; _atlas = new (__FILE__, __LINE__) Atlas("spineboy.atlas", &textureLoader, true); - CCASSERT(_atlas, "Error reading atlas file."); + AXASSERT(_atlas, "Error reading atlas file."); // This attachment loader configures attachments with data needed for cocos2d-x rendering. // Do not dispose the attachment loader until the skeleton data is disposed! @@ -150,7 +150,7 @@ bool BatchingExample::init() SkeletonJson* json = new (__FILE__, __LINE__) SkeletonJson(_attachmentLoader); json->setScale(0.6f); // Resizes skeleton data to 60% of the size it was in Spine. _skeletonData = json->readSkeletonDataFile("spineboy-pro.json"); - CCASSERT(_skeletonData, + AXASSERT(_skeletonData, (json->getError().isEmpty() ? json->getError().buffer() : "Error reading skeleton data file.")); delete json; diff --git a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp index 0fc08879ea..2aa4c56741 100644 --- a/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp +++ b/tests/cpp-tests/Classes/SpriteFrameCacheTest/SpriteFrameCacheTest.cpp @@ -130,19 +130,19 @@ void SpriteFrameCacheFullCheck::loadSpriteFrames(std::string_view file, axis::ba { auto cache = SpriteFrameCache::getInstance(); - CCASSERT(cache->isSpriteFramesWithFileLoaded("plist which not exists") == false, "Plist not exists"); + AXASSERT(cache->isSpriteFramesWithFileLoaded("plist which not exists") == false, "Plist not exists"); cache->addSpriteFramesWithFile(file); - CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after loaded"); + AXASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after loaded"); cache->removeSpriteFrameByName("not_exists_grossinis_sister.png"); - CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should not be still full"); + AXASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should not be still full"); cache->removeSpriteFrameByName("grossinis_sister1.png"); - CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == false, "Plist should not be full after remove any sprite"); + AXASSERT(cache->isSpriteFramesWithFileLoaded(file) == false, "Plist should not be full after remove any sprite"); cache->addSpriteFramesWithFile(file); - CCASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after reloaded"); + AXASSERT(cache->isSpriteFramesWithFileLoaded(file) == true, "Plist should be full after reloaded"); } class GenericJsonArraySpriteSheetLoader : public SpriteSheetLoader @@ -154,13 +154,13 @@ public: void load(std::string_view filePath, SpriteFrameCache& cache) override { - CCASSERT(!filePath.empty(), "atlas filename should not be nullptr"); + AXASSERT(!filePath.empty(), "atlas filename should not be nullptr"); const auto fullPath = FileUtils::getInstance()->fullPathForFilename(filePath); if (fullPath.empty()) { // return if plist file doesn't exist - CCLOG("GenericJsonArraySpriteSheetLoader: can not find %s", filePath.data()); + AXLOG("GenericJsonArraySpriteSheetLoader: can not find %s", filePath.data()); return; } @@ -197,7 +197,7 @@ public: // append .png texturePath = texturePath.append(".png"); - CCLOG("GenericJsonArraySpriteSheetLoader::load: Trying to use file %s as texture", texturePath.c_str()); + AXLOG("GenericJsonArraySpriteSheetLoader::load: Trying to use file %s as texture", texturePath.c_str()); } addSpriteFramesWithJson(jDoc, texturePath, filePath, cache); @@ -215,7 +215,7 @@ public: void load(std::string_view filePath, std::string_view textureFileName, SpriteFrameCache& cache) override { - 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); rapidjson::Document jDoc; const auto data = FileUtils::getInstance()->getStringFromFile(fullPath); @@ -284,7 +284,7 @@ public: } else { - CCLOG("GenericJsonArraySpriteSheetLoader::reload: Couldn't load texture"); + AXLOG("GenericJsonArraySpriteSheetLoader::reload: Couldn't load texture"); } } @@ -337,7 +337,7 @@ protected: } else { - CCLOG("GenericJsonArraySpriteSheetLoader::addSpriteFramesWithJson: Couldn't load texture"); + AXLOG("GenericJsonArraySpriteSheetLoader::addSpriteFramesWithJson: Couldn't load texture"); } } diff --git a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp index 0e9f4edcf2..42713807ce 100644 --- a/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp +++ b/tests/cpp-tests/Classes/SpritePolygonTest/SpritePolygonTest.cpp @@ -459,7 +459,7 @@ void SpritePolygonTest5::loadDefaultSprites() sprites[i] = Sprite::create(_polygonInfo); sprites[i]->setTag(_tagIndex); _tagIndex++; - sprites[i]->setPosition(s.width * CCRANDOM_0_1(), s.height * CCRANDOM_0_1()); + sprites[i]->setPosition(s.width * AXRANDOM_0_1(), s.height * AXRANDOM_0_1()); this->addChild(sprites[i]); auto drawNode = DrawNode::create(); _drawNodes.pushBack(drawNode); @@ -493,7 +493,7 @@ void SpritePolygonTest5::addSpritePolygon(const Vec2& pos) sprite->addChild(drawNode); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); else if (random < 0.40) diff --git a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp index 01fec9f83e..75e0689d80 100644 --- a/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp +++ b/tests/cpp-tests/Classes/SpriteTest/SpriteTest.cpp @@ -157,7 +157,7 @@ Sprite1::Sprite1() void Sprite1::addNewSpriteWithCoords(Vec2 p) { - int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f); + int idx = (int)(AXRANDOM_0_1() * 1400.0f / 100.0f); int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -167,7 +167,7 @@ void Sprite1::addNewSpriteWithCoords(Vec2 p) sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -228,7 +228,7 @@ void SpriteBatchNode1::addNewSpriteWithCoords(Vec2 p) { auto BatchNode = static_cast(getChildByTag(kTagSpriteBatchNode)); - int idx = CCRANDOM_0_1() * 1400 / 100; + int idx = AXRANDOM_0_1() * 1400 / 100; int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -238,7 +238,7 @@ void SpriteBatchNode1::addNewSpriteWithCoords(Vec2 p) sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -731,8 +731,8 @@ SpriteBatchNodeReorder::SpriteBatchNodeReorder() auto child = static_cast(obj); ssize_t currentIndex = child->getAtlasIndex(); - CCASSERT(prev == currentIndex - 1, "Child order failed"); - ////----CCLOG("children %x - atlasIndex:%d", child, currentIndex); + AXASSERT(prev == currentIndex - 1, "Child order failed"); + ////----AXLOG("children %x - atlasIndex:%d", child, currentIndex); prev = currentIndex; } @@ -741,8 +741,8 @@ SpriteBatchNodeReorder::SpriteBatchNodeReorder() for (const auto& sprite : descendants) { ssize_t currentIndex = sprite->getAtlasIndex(); - CCASSERT(prev == currentIndex - 1, "Child order failed"); - ////----CCLOG("descendant %x - atlasIndex:%d", child, currentIndex); + AXASSERT(prev == currentIndex - 1, "Child order failed"); + ////----AXLOG("descendant %x - atlasIndex:%d", child, currentIndex); prev = currentIndex; } } @@ -1373,10 +1373,10 @@ void SpriteFlip::flipSprites(float dt) bool x = sprite1->isFlippedX(); bool y = sprite2->isFlippedY(); - CCLOG("Pre: %g", sprite1->getContentSize().height); + AXLOG("Pre: %g", sprite1->getContentSize().height); sprite1->setFlippedX(!x); sprite2->setFlippedY(!y); - CCLOG("Post: %g", sprite1->getContentSize().height); + AXLOG("Post: %g", sprite1->getContentSize().height); } std::string SpriteFlip::title() const @@ -1421,10 +1421,10 @@ void SpriteBatchNodeFlip::flipSprites(float dt) bool x = sprite1->isFlippedX(); bool y = sprite2->isFlippedY(); - CCLOG("Pre: %g", sprite1->getContentSize().height); + AXLOG("Pre: %g", sprite1->getContentSize().height); sprite1->setFlippedX(!x); sprite2->setFlippedY(!y); - CCLOG("Post: %g", sprite1->getContentSize().height); + AXLOG("Post: %g", sprite1->getContentSize().height); } std::string SpriteBatchNodeFlip::title() const @@ -1589,9 +1589,9 @@ void SpriteNewTexture::addNewSprite() { auto s = Director::getInstance()->getWinSize(); - auto p = Vec2(CCRANDOM_0_1() * s.width, CCRANDOM_0_1() * s.height); + auto p = Vec2(AXRANDOM_0_1() * s.width, AXRANDOM_0_1() * s.height); - int idx = CCRANDOM_0_1() * 1400 / 100; + int idx = AXRANDOM_0_1() * 1400 / 100; int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -1602,7 +1602,7 @@ void SpriteNewTexture::addNewSprite() sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -1695,11 +1695,11 @@ void SpriteBatchNodeNewTexture::addNewSprite() { auto s = Director::getInstance()->getWinSize(); - auto p = Vec2(CCRANDOM_0_1() * s.width, CCRANDOM_0_1() * s.height); + auto p = Vec2(AXRANDOM_0_1() * s.width, AXRANDOM_0_1() * s.height); auto batch = static_cast(getChildByTag(kTagSpriteBatchNode)); - int idx = CCRANDOM_0_1() * 1400 / 100; + int idx = AXRANDOM_0_1() * 1400 / 100; int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -1709,7 +1709,7 @@ void SpriteBatchNodeNewTexture::addNewSprite() sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -2449,7 +2449,7 @@ SpriteHybrid::SpriteHybrid() // only show 80% of them for (int i = 0; i < 250; i++) { - int spriteIdx = CCRANDOM_0_1() * 14; + int spriteIdx = AXRANDOM_0_1() * 14; char str[25] = {0}; sprintf(str, "grossini_dance_%02d.png", (spriteIdx + 1)); auto frame = SpriteFrameCache::getInstance()->getSpriteFrameByName(str); @@ -2458,10 +2458,10 @@ SpriteHybrid::SpriteHybrid() float x = -1000; float y = -1000; - if (CCRANDOM_0_1() < 0.2f) + if (AXRANDOM_0_1() < 0.2f) { - x = CCRANDOM_0_1() * s.width; - y = CCRANDOM_0_1() * s.height; + x = AXRANDOM_0_1() * s.width; + y = AXRANDOM_0_1() * s.height; } sprite->setPosition(Vec2(x, y)); @@ -2484,7 +2484,7 @@ void SpriteHybrid::reparentSprite(float dt) if (_usingSpriteBatchNode) std::swap(p1, p2); - ////----CCLOG("New parent is: %x", p2); + ////----AXLOG("New parent is: %x", p2); auto& p1Children = p1->getChildren(); for (const auto& node : p1Children) diff --git a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp index d9d2908cf4..41cde7f4a7 100644 --- a/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp +++ b/tests/cpp-tests/Classes/TextInputTest/TextInputTest.cpp @@ -67,7 +67,7 @@ KeyboardNotificationLayer::KeyboardNotificationLayer() : _trackNode(0) void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& info) { - CCLOG("TextInputTest:keyboardWillShowAt(origin:%f,%f, size:%f,%f)", info.end.origin.x, info.end.origin.y, + AXLOG("TextInputTest:keyboardWillShowAt(origin:%f,%f, size:%f,%f)", info.end.origin.x, info.end.origin.y, info.end.size.width, info.end.size.height); if (!_trackNode) @@ -76,7 +76,7 @@ void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& in } auto rectTracked = getRect(_trackNode); - CCLOG("TextInputTest:trackingNodeAt(origin:%f,%f, size:%f,%f)", rectTracked.origin.x, rectTracked.origin.y, + AXLOG("TextInputTest:trackingNodeAt(origin:%f,%f, size:%f,%f)", rectTracked.origin.x, rectTracked.origin.y, rectTracked.size.width, rectTracked.size.height); // if the keyboard area doesn't intersect with the tracking node area, nothing need to do. @@ -87,7 +87,7 @@ void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& in // assume keyboard at the bottom of screen, calculate the vertical adjustment. float adjustVert = info.end.getMaxY() - rectTracked.getMinY(); - CCLOG("TextInputTest:needAdjustVerticalPosition(%f)", adjustVert); + AXLOG("TextInputTest:needAdjustVerticalPosition(%f)", adjustVert); // move all the children node of KeyboardNotificationLayer auto& children = getChildren(); @@ -107,7 +107,7 @@ void KeyboardNotificationLayer::keyboardWillShow(IMEKeyboardNotificationInfo& in bool KeyboardNotificationLayer::onTouchBegan(Touch* touch, Event* event) { - CCLOG("++++++++++++++++++++++++++++++++++++++++++++"); + AXLOG("++++++++++++++++++++++++++++++++++++++++++++"); _beginPos = touch->getLocation(); return true; } @@ -135,7 +135,7 @@ void KeyboardNotificationLayer::onTouchEnded(Touch* touch, Event* event) auto clicked = isScreenPointInRect(endPos, Camera::getVisitingCamera(), _trackNode->getWorldToNodeTransform(), rect, nullptr); this->onClickTrackNode(clicked, endPos); - CCLOG("----------------------------------"); + AXLOG("----------------------------------"); } ////////////////////////////////////////////////////////////////////////// @@ -153,13 +153,13 @@ void TextFieldTTFDefaultTest::onClickTrackNode(bool bClicked, const Vec2& touchP if (bClicked) { // TextFieldTTFTest be clicked - CCLOG("TextFieldTTFDefaultTest:TextFieldTTF attachWithIME"); + AXLOG("TextFieldTTFDefaultTest:TextFieldTTF attachWithIME"); pTextField->attachWithIME(); } else { // TextFieldTTFTest not be clicked - CCLOG("TextFieldTTFDefaultTest:TextFieldTTF detachWithIME"); + AXLOG("TextFieldTTFDefaultTest:TextFieldTTF detachWithIME"); pTextField->detachWithIME(); } } @@ -200,13 +200,13 @@ void TextFieldTTFActionTest::onClickTrackNode(bool bClicked, const Vec2& touchPo if (bClicked) { // TextFieldTTFTest be clicked - CCLOG("TextFieldTTFActionTest:TextFieldTTF attachWithIME"); + AXLOG("TextFieldTTFActionTest:TextFieldTTF attachWithIME"); pTextField->attachWithIME(); } else { // TextFieldTTFTest not be clicked - CCLOG("TextFieldTTFActionTest:TextFieldTTF detachWithIME"); + AXLOG("TextFieldTTFActionTest:TextFieldTTF detachWithIME"); pTextField->detachWithIME(); } } @@ -394,7 +394,7 @@ void TextFieldTTSetCursorFromPoint::onClickTrackNode(bool bClicked, const Vec2& if (bClicked) { // TextFieldTTFTest be clicked - CCLOG("TextFieldTTSetCursorFromPoint:TextFieldTTF attachWithIME"); + AXLOG("TextFieldTTSetCursorFromPoint:TextFieldTTF attachWithIME"); pTextField->attachWithIME(); // Set new position cursor @@ -403,7 +403,7 @@ void TextFieldTTSetCursorFromPoint::onClickTrackNode(bool bClicked, const Vec2& else { // TextFieldTTFTest not be clicked - CCLOG("TextFieldTTSetCursorFromPoint:TextFieldTTF detachWithIME"); + AXLOG("TextFieldTTSetCursorFromPoint:TextFieldTTF detachWithIME"); pTextField->detachWithIME(); } } diff --git a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp index 892c24f229..fd11278b19 100644 --- a/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp +++ b/tests/cpp-tests/Classes/Texture2dTest/Texture2dTest.cpp @@ -222,7 +222,7 @@ void TextureETC1Alpha::addNewSpriteWithCoords(Vec2 p) sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -341,7 +341,7 @@ TextureBMP::TextureBMP() void TextureBMP::addNewSpriteWithCoords(Vec2 p) { - int idx = (int)(CCRANDOM_0_1() * 1400.0f / 100.0f); + int idx = (int)(AXRANDOM_0_1() * 1400.0f / 100.0f); int x = (idx % 5) * 85; int y = (idx / 5) * 121; @@ -351,7 +351,7 @@ void TextureBMP::addNewSpriteWithCoords(Vec2 p) sprite->setPosition(Vec2(p.x, p.y)); ActionInterval* action; - float random = CCRANDOM_0_1(); + float random = AXRANDOM_0_1(); if (random < 0.20) action = ScaleBy::create(3, 2); @@ -1773,7 +1773,7 @@ void TextureAsync::imageLoaded(Texture2D* texture) { auto director = Director::getInstance(); - // CCASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread"); + // AXASSERT( [NSThread currentThread] == [director runningThread], @"FAIL. Callback should be on cocos2d thread"); // IMPORTANT: The order on the callback is not guaranteed. Don't depend on the callback @@ -2019,7 +2019,7 @@ void TextureDrawAtPoint::draw(Renderer* renderer, const Mat4& transform, uint32_ void TextureDrawAtPoint::onDraw(const Mat4& transform, uint32_t flags) { Director* director = Director::getInstance(); - 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, transform); @@ -2058,7 +2058,7 @@ void TextureDrawInRect::draw(Renderer* renderer, const Mat4& transform, uint32_t void TextureDrawInRect::onDraw(const Mat4& transform, uint32_t flags) { Director* director = Director::getInstance(); - 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, transform); diff --git a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp index 6af03ff2c5..e2a289dda2 100644 --- a/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp +++ b/tests/cpp-tests/Classes/TileMapTest/TileMapTest2.cpp @@ -123,7 +123,7 @@ TileMapTestNew::TileMapTestNew() map->getTexture()->setAntiAliasTexParameters(); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // If you are not going to use the Map, you can free it now // NEW since v0.7 @@ -158,7 +158,7 @@ TileMapEditTestNew::TileMapEditTestNew() map->getTexture()->setAliasTexParameters(); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // If you are not going to use the Map, you can free it now // [tilemap releaseMap); @@ -187,7 +187,7 @@ void TileMapEditTestNew::updateMap(float dt) // for(int y=0; y < tilemap.tgaInfo->height; y++) { // Color3B c =[tilemap tileAt:Size(x,y)); // if( c.r != 0 ) { - // ////----CCLOG("%d,%d = %d", x,y,c.r); + // ////----AXLOG("%d,%d = %d", x,y,c.r); // } // } // } @@ -228,7 +228,7 @@ TMXOrthoTestNew::TMXOrthoTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); auto scale = ScaleBy::create(10, 0.1f); auto back = scale->reverse(); @@ -270,7 +270,7 @@ TMXOrthoTest2New::TMXOrthoTest2New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); map->runAction(ScaleBy::create(2, 0.5f)); } @@ -291,7 +291,7 @@ TMXOrthoTest3New::TMXOrthoTest3New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); map->setScale(0.2f); map->setAnchorPoint(Vec2(0.5f, 0.5f)); @@ -313,7 +313,7 @@ TMXOrthoTest4New::TMXOrthoTest4New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s1 = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s1.width, s1.height); + AXLOG("ContentSize: %f, %f", s1.width, s1.height); map->setAnchorPoint(Vec2(0.0f, 0.0f)); @@ -374,7 +374,7 @@ TMXReadWriteTestNew::TMXReadWriteTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); auto layer = map->getLayer("Layer 0"); @@ -407,21 +407,21 @@ TMXReadWriteTestNew::TMXReadWriteTestNew() tile3->runAction(seq3); _gid = layer->getTileGIDAt(Vec2(0, 63)); - ////----CCLOG("Tile GID at:(0,63) is: %d", _gid); + ////----AXLOG("Tile GID at:(0,63) is: %d", _gid); schedule(AX_SCHEDULE_SELECTOR(TMXReadWriteTestNew::updateCol), 2.0f); schedule(AX_SCHEDULE_SELECTOR(TMXReadWriteTestNew::repaintWithGID), 2.05f); schedule(AX_SCHEDULE_SELECTOR(TMXReadWriteTestNew::removeTiles), 1.0f); - ////----CCLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); - ////----CCLOG("++++children: %d", layer->getChildren()->count() ); + ////----AXLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); + ////----AXLOG("++++children: %d", layer->getChildren()->count() ); _gid2 = 0; } void TMXReadWriteTestNew::removeSprite(Node* sender) { - ////----CCLOG("removing tile: %x", sender); + ////----AXLOG("removing tile: %x", sender); auto p = ((Node*)sender)->getParent(); if (p) @@ -429,7 +429,7 @@ void TMXReadWriteTestNew::removeSprite(Node* sender) p->removeChild((Node*)sender, true); } - //////----CCLOG("atlas quantity: %d", p->textureAtlas()->totalQuads()); + //////----AXLOG("atlas quantity: %d", p->textureAtlas()->totalQuads()); } void TMXReadWriteTestNew::updateCol(float dt) @@ -437,8 +437,8 @@ void TMXReadWriteTestNew::updateCol(float dt) auto map = (axis::FastTMXTiledMap*)getChildByTag(kTagTileMap); auto layer = (axis::FastTMXLayer*)map->getChildByTag(0); - ////----CCLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); - ////----CCLOG("++++children: %d", layer->getChildren()->count() ); + ////----AXLOG("++++atlas quantity: %d", layer->textureAtlas()->getTotalQuads()); + ////----AXLOG("++++children: %d", layer->getChildren()->count() ); auto s = layer->getLayerSize(); @@ -499,7 +499,7 @@ TMXHexTestNew::TMXHexTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); } std::string TMXHexTestNew::title() const @@ -545,7 +545,7 @@ TMXIsoTest1New::TMXIsoTest1New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); map->setAnchorPoint(Vec2(0.5f, 0.5f)); } @@ -569,7 +569,7 @@ TMXIsoTest2New::TMXIsoTest2New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // move map to the center of the screen auto ms = map->getMapSize(); @@ -596,7 +596,7 @@ TMXUncompressedTestNew::TMXUncompressedTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // move map to the center of the screen auto ms = map->getMapSize(); @@ -630,7 +630,7 @@ TMXTilesetTestNew::TMXTilesetTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); } std::string TMXTilesetTestNew::title() const @@ -649,13 +649,13 @@ TMXOrthoObjectsTestNew::TMXOrthoObjectsTestNew() addChild(map, -1, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); auto group = map->getObjectGroup("Object Group 1"); auto& objects = group->getObjects(); Value objectsVal = Value(objects); - CCLOG("%s", objectsVal.getDescription().c_str()); + AXLOG("%s", objectsVal.getDescription().c_str()); auto drawNode = DrawNode::create(); Color4F color(1.0, 1.0, 1.0, 1.0); @@ -698,14 +698,14 @@ TMXIsoObjectsTestNew::TMXIsoObjectsTestNew() addChild(map, -1, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); auto group = map->getObjectGroup("Object Group 1"); auto& objects = group->getObjects(); Value objectsVal = Value(objects); - CCLOG("%s", objectsVal.getDescription().c_str()); + AXLOG("%s", objectsVal.getDescription().c_str()); auto drawNode = DrawNode::create(); Color4F color(1.0, 1.0, 1.0, 1.0); @@ -748,7 +748,7 @@ TMXResizeTestNew::TMXResizeTestNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); axis::FastTMXLayer* layer; layer = map->getLayer("Layer 0"); @@ -785,7 +785,7 @@ TMXIsoZorderNew::TMXIsoZorderNew() addChild(map, 0, kTagTileMap); auto s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); map->setPosition(Vec2(-s.width / 2, 0.0f)); _tamara = Sprite::create(s_pathSister1); @@ -852,7 +852,7 @@ TMXOrthoZorderNew::TMXOrthoZorderNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); _tamara = Sprite::create(s_pathSister1); map->addChild(_tamara, (int)map->getChildren().size()); @@ -912,7 +912,7 @@ TMXIsoVertexZNew::TMXIsoVertexZNew() auto s = map->getContentSize(); map->setPosition(Vec2(-s.width / 2, 0.0f)); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you // can use any Sprite and it will work OK. @@ -983,13 +983,13 @@ TMXOrthoVertexZNew::TMXOrthoVertexZNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); // because I'm lazy, I'm reusing a tile as an sprite, but since this method uses vertexZ, you // can use any Sprite and it will work OK. auto layer = map->getLayer("trees"); _tamara = layer->getTileAt(Vec2(0, 11)); - CCLOG("%p vertexZ: %f", _tamara, _tamara->getPositionZ()); + AXLOG("%p vertexZ: %f", _tamara, _tamara->getPositionZ()); _tamara->retain(); auto move = MoveBy::create(10, Vec2(400, 450) * (1 / AX_CONTENT_SCALE_FACTOR())); @@ -1056,7 +1056,7 @@ TMXIsoMoveLayerNew::TMXIsoMoveLayerNew() map->setPosition(Vec2(-700.0f, -50.0f)); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); } std::string TMXIsoMoveLayerNew::title() const @@ -1080,7 +1080,7 @@ TMXOrthoMoveLayerNew::TMXOrthoMoveLayerNew() addChild(map, 0, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); } std::string TMXOrthoMoveLayerNew::title() const @@ -1281,7 +1281,7 @@ TMXBug987New::TMXBug987New() addChild(map, 0, kTagTileMap); Size AX_UNUSED s1 = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s1.width, s1.height); + AXLOG("ContentSize: %f, %f", s1.width, s1.height); map->setAnchorPoint(Vec2(0.0f, 0.0f)); auto layer = map->getLayer("Tile Layer 1"); @@ -1332,9 +1332,9 @@ TMXGIDObjectsTestNew::TMXGIDObjectsTestNew() addChild(map, -1, kTagTileMap); Size AX_UNUSED s = map->getContentSize(); - CCLOG("Contentsize: %f, %f", s.width, s.height); + AXLOG("Contentsize: %f, %f", s.width, s.height); - CCLOG("----> Iterating over all the group objects"); + AXLOG("----> Iterating over all the group objects"); auto drawNode = DrawNode::create(); Color4F color(1.0, 1.0, 1.0, 1.0); @@ -1383,7 +1383,7 @@ TileAnimTestNew::TileAnimTestNew() _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, this); Size AX_UNUSED s = map->getContentSize(); - CCLOG("ContentSize: %f, %f", s.width, s.height); + AXLOG("ContentSize: %f, %f", s.width, s.height); map->setTileAnimEnabled(_animStarted); } diff --git a/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp b/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp index 0bf53bddf0..cd10c7a2d2 100644 --- a/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp +++ b/tests/cpp-tests/Classes/TouchesTest/Paddle.cpp @@ -84,7 +84,7 @@ bool Paddle::containsTouchLocation(Touch* touch) bool Paddle::onTouchBegan(Touch* touch, Event* event) { - CCLOG("Paddle::onTouchBegan id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, + AXLOG("Paddle::onTouchBegan id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, touch->getLocation().y); if (_state != kPaddleStateUngrabbed) @@ -93,7 +93,7 @@ bool Paddle::onTouchBegan(Touch* touch, Event* event) return false; _state = kPaddleStateGrabbed; - CCLOG("return true"); + AXLOG("return true"); return true; } @@ -106,10 +106,10 @@ void Paddle::onTouchMoved(Touch* touch, Event* event) // you get Sets instead of 1 UITouch, so you'd need to loop through the set // in each touchXXX method. - CCLOG("Paddle::onTouchMoved id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, + AXLOG("Paddle::onTouchMoved id = %d, x = %f, y = %f", touch->getID(), touch->getLocation().x, touch->getLocation().y); - CCASSERT(_state == kPaddleStateGrabbed, "Paddle - Unexpected state!"); + AXASSERT(_state == kPaddleStateGrabbed, "Paddle - Unexpected state!"); auto touchPoint = touch->getLocation(); @@ -127,7 +127,7 @@ Paddle* Paddle::clone() const void Paddle::onTouchEnded(Touch* touch, Event* event) { - CCASSERT(_state == kPaddleStateGrabbed, "Paddle - Unexpected state!"); + AXASSERT(_state == kPaddleStateGrabbed, "Paddle - Unexpected state!"); _state = kPaddleStateUngrabbed; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp index 41480b1d45..b47d20a9b3 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIButtonTest/UIButtonTest.cpp @@ -78,7 +78,7 @@ bool UIButtonTest::init() // Create the button Button* button = Button::create("cocosui/animationbuttonnormal.png", "cocosui/animationbuttonpressed.png"); - CCLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, + AXLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, button->getContentSize().height); button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); button->addTouchEventListener(AX_CALLBACK_2(UIButtonTest::touchEvent, this)); @@ -150,11 +150,11 @@ void UIButtonTest::touchEvent(Ref* pSender, Widget::TouchEventType type) void UIButtonTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData normalFileName = _button->getNormalFile(); - CCLOG("normalFileName Name : %s, Type: %d", normalFileName.file.c_str(), normalFileName.type); + AXLOG("normalFileName Name : %s, Type: %d", normalFileName.file.c_str(), normalFileName.type); axis::ResourceData clickedFileName = _button->getPressedFile(); - CCLOG("clickedFileName Name : %s, Type: %d", clickedFileName.file.c_str(), clickedFileName.type); + AXLOG("clickedFileName Name : %s, Type: %d", clickedFileName.file.c_str(), clickedFileName.type); axis::ResourceData disabledFileName = _button->getDisabledFile(); - CCLOG("disabledFileName Name : %s, Type: %d", disabledFileName.file.c_str(), disabledFileName.type); + AXLOG("disabledFileName Name : %s, Type: %d", disabledFileName.file.c_str(), disabledFileName.type); } // UIButtonTest_Scale9 @@ -433,7 +433,7 @@ bool UIButtonTest_Title::init() button->setTitleText("Title Button!"); button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); button->setTitleColor(Color3B::YELLOW); - CCASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColor & getTitleColor not match!"); + AXASSERT(button->getTitleColor() == Color3B::YELLOW, "Button setTitleColor & getTitleColor not match!"); button->addTouchEventListener(AX_CALLBACK_2(UIButtonTest_Title::touchEvent, this)); _uiLayer->addChild(button); button->setFlippedX(true); @@ -661,7 +661,7 @@ bool UIButtonTestZoomScale::init() button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f + 20)); button->setPressedActionEnabled(true); button->addClickEventListener([=](Ref* sender) { - CCLOG("Button clicked, position = (%f, %f)", button->getPosition().x, button->getPosition().y); + AXLOG("Button clicked, position = (%f, %f)", button->getPosition().x, button->getPosition().y); }); button->setName("button"); _uiLayer->addChild(button); @@ -715,11 +715,11 @@ bool UIButtonTextOnly::init() button->setPositionNormalized(Vec2(0.5f, 0.5f)); button->setTitleText("PLAY GAME"); - CCLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, + AXLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, button->getContentSize().height); button->setZoomScale(0.3f); button->setPressedActionEnabled(true); - button->addClickEventListener([](Ref* sender) { CCLOG("clicked!"); }); + button->addClickEventListener([](Ref* sender) { AXLOG("clicked!"); }); _uiLayer->addChild(button); return true; @@ -753,7 +753,7 @@ bool UIButtonIgnoreContentSizeTest::init() button->setZoomScale(0.3f); button->setPressedActionEnabled(true); button->addClickEventListener([=](Ref* sender) { - CCLOG("clicked!"); + AXLOG("clicked!"); button->setScale(1.2f); }); _uiLayer->addChild(button); @@ -768,7 +768,7 @@ bool UIButtonIgnoreContentSizeTest::init() button2->setPressedActionEnabled(true); button2->addClickEventListener([=](Ref* sender) { button2->runAction(ScaleTo::create(1.0f, 1.2f)); - CCLOG("clicked!"); + AXLOG("clicked!"); }); _uiLayer->addChild(button2); @@ -995,7 +995,7 @@ bool UIButtonCloneTest::init() button->setPosition(Vec2(widgetSize.width / 2.0f - 80, widgetSize.height / 2.0f + 40)); _uiLayer->addChild(button); - CCASSERT(button->getTitleRenderer() == nullptr, "Button title render must be nullptr "); + AXASSERT(button->getTitleRenderer() == nullptr, "Button title render must be nullptr "); auto buttonCopy = (Button*)button->clone(); buttonCopy->setPosition(Vec2(widgetSize.width / 2.0f + 80, widgetSize.height / 2.0f + 40)); @@ -1013,9 +1013,9 @@ bool UIButtonCloneTest::init() buttonScale9Copy2->setContentSize(buttonCopy->getContentSize() * 1.5f); this->addChild(buttonScale9Copy2); - CCASSERT(button->getTitleRenderer() == nullptr, "Original Button title render must be nullptr "); + AXASSERT(button->getTitleRenderer() == nullptr, "Original Button title render must be nullptr "); - CCASSERT(buttonCopy->getTitleRenderer() == nullptr, "Copied Button title render must be nullptr "); + AXASSERT(buttonCopy->getTitleRenderer() == nullptr, "Copied Button title render must be nullptr "); return true; } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp index 7981908cd4..36e2bbd618 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UICheckBoxTest/UICheckBoxTest.cpp @@ -101,17 +101,17 @@ void UICheckBoxTest::selectedEvent(Ref* pSender, CheckBox::EventType type) void UICheckBoxTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData backGroundFileName = _checkBox->getBackNormalFile(); - CCLOG("backGroundFile Name : %s, Type: %d", backGroundFileName.file.c_str(), backGroundFileName.type); + AXLOG("backGroundFile Name : %s, Type: %d", backGroundFileName.file.c_str(), backGroundFileName.type); axis::ResourceData backGroundSelectedFileName = _checkBox->getBackPressedFile(); - CCLOG("backGroundSelectedFile Name : %s, Type: %d", backGroundSelectedFileName.file.c_str(), + AXLOG("backGroundSelectedFile Name : %s, Type: %d", backGroundSelectedFileName.file.c_str(), backGroundSelectedFileName.type); axis::ResourceData backGroundDisabledFileName = _checkBox->getBackDisabledFile(); - CCLOG("backGroundDisabledFile Name : %s, Type: %d", backGroundDisabledFileName.file.c_str(), + AXLOG("backGroundDisabledFile Name : %s, Type: %d", backGroundDisabledFileName.file.c_str(), backGroundDisabledFileName.type); axis::ResourceData frontCrossFileName = _checkBox->getCrossNormalFile(); - CCLOG("frontCrossFile Name : %s, Type: %d", frontCrossFileName.file.c_str(), frontCrossFileName.type); + AXLOG("frontCrossFile Name : %s, Type: %d", frontCrossFileName.file.c_str(), frontCrossFileName.type); axis::ResourceData frontCrossDisabledFileName = _checkBox->getCrossDisabledFile(); - CCLOG("frontCrossDisabledFile Name : %s, Type: %d", frontCrossDisabledFileName.file.c_str(), + AXLOG("frontCrossDisabledFile Name : %s, Type: %d", frontCrossDisabledFileName.file.c_str(), frontCrossDisabledFileName.type); } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp index 5e3977ccb0..a7e28ac284 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIFocusTest/UIFocusTest.cpp @@ -163,7 +163,7 @@ void UIFocusTestBase::onFocusChanged(axis::ui::Widget* widgetLostFocus, axis::ui if (widgetLostFocus && widgetGetFocus) { - CCLOG("on focus change, %d widget get focus, %d widget lose focus", widgetGetFocus->getTag(), + AXLOG("on focus change, %d widget get focus, %d widget lose focus", widgetGetFocus->getTag(), widgetLostFocus->getTag()); } } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp index 37e7792398..9b5ebd8831 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIImageViewTest/UIImageViewTest.cpp @@ -77,7 +77,7 @@ bool UIImageViewTest::init() void UIImageViewTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _image->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } // UIImageViewTest_Scale9 @@ -203,11 +203,11 @@ bool UIImageViewTest_ContentSize::init() imageView->addTouchEventListener([=](Ref* sender, Widget::TouchEventType type) { if (type == Widget::TouchEventType::ENDED) { - float width = CCRANDOM_0_1() * 200 + 50; - float height = CCRANDOM_0_1() * 80 + 30; + float width = AXRANDOM_0_1() * 200 + 50; + float height = AXRANDOM_0_1() * 80 + 30; imageView->setContentSize(Size(width, height)); - imageViewChild->setPositionPercent(Vec2(CCRANDOM_0_1(), CCRANDOM_0_1())); + imageViewChild->setPositionPercent(Vec2(AXRANDOM_0_1(), AXRANDOM_0_1())); status->setString(StringUtils::format("child ImageView position percent: %f, %f", imageViewChild->getPositionPercent().x, imageViewChild->getPositionPercent().y)); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp index 9c827650c0..c1967a94b3 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILayoutTest/UILayoutTest.cpp @@ -297,7 +297,7 @@ bool UILayoutTest_BackGroundImage::init() void UILayoutTest_BackGroundImage::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _layout->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } // UILayoutTest_BackGroundImage_Scale9 @@ -767,7 +767,7 @@ bool UILayoutComponentTest::init() _uiLayer->addChild(_baseLayer); Button* button = Button::create("cocosui/animationbuttonnormal.png"); - CCLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, + AXLOG("content size should be greater than 0: width = %f, height = %f", button->getContentSize().width, button->getContentSize().height); button->setPosition(Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f)); button->addTouchEventListener(AX_CALLBACK_2(UILayoutComponentTest::touchEvent, this)); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp index 09343e3133..48f3f91144 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIListViewTest/UIListViewTest.cpp @@ -234,7 +234,7 @@ void UIListViewTest_Vertical::update(float dt) { int itemID = item->getTag() - (int)items.size(); item->setPositionY(item->getPositionY() + _reuseItemOffset); - CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); + AXLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); this->updateItem(itemID, i); } } @@ -245,7 +245,7 @@ void UIListViewTest_Vertical::update(float dt) item->setPositionY(item->getPositionY() - _reuseItemOffset); int itemID = item->getTag() + (int)items.size(); - CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); + AXLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); this->updateItem(itemID, i); } } @@ -282,10 +282,10 @@ void UIListViewTest_Vertical::selectedItemEventScrollView(Ref* pSender, ui::Scro switch (type) { case ui::ScrollView::EventType::SCROLL_TO_BOTTOM: - CCLOG("SCROLL_TO_BOTTOM"); + AXLOG("SCROLL_TO_BOTTOM"); break; case ui::ScrollView::EventType::SCROLL_TO_TOP: - CCLOG("SCROLL_TO_TOP"); + AXLOG("SCROLL_TO_TOP"); break; default: break; @@ -438,7 +438,7 @@ void UIListViewTest_Horizontal::update(float dt) { int itemID = item->getTag() + (int)items.size(); item->setPositionX(item->getPositionX() + _reuseItemOffset); - CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); + AXLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); this->updateItem(itemID, i); } } @@ -450,7 +450,7 @@ void UIListViewTest_Horizontal::update(float dt) item->setPositionX(item->getPositionX() - _reuseItemOffset); int itemID = item->getTag() - (int)items.size(); - CCLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); + AXLOG("itemPos = %f, itemID = %d, templateID = %d", itemPos, itemID, i); this->updateItem(itemID, i); } } @@ -1028,7 +1028,7 @@ void UIListViewTest_Padding::sliderEvent(Ref* pSender, Slider::EventType type) if (slider && slider->getTag() == 0) { int left = slider->getPercent() / 100.f * 50.f; - CCLOG("Left Padding: %d", left); + AXLOG("Left Padding: %d", left); _listView->setLeftPadding(left); _paddingLabels[0]->setString(StringUtils::format("Left\nPadding=%d", left)); } @@ -1036,7 +1036,7 @@ void UIListViewTest_Padding::sliderEvent(Ref* pSender, Slider::EventType type) if (slider && slider->getTag() == 1) { int top = slider->getPercent() / 100.f * 50.f; - CCLOG("Top Padding: %d", top); + AXLOG("Top Padding: %d", top); _listView->setTopPadding(top); _paddingLabels[1]->setString(StringUtils::format("Top\nPadding=%d", top)); } @@ -1044,7 +1044,7 @@ void UIListViewTest_Padding::sliderEvent(Ref* pSender, Slider::EventType type) if (slider && slider->getTag() == 2) { int right = slider->getPercent() / 100.f * 50.f; - CCLOG("Right Padding: %d", right); + AXLOG("Right Padding: %d", right); _listView->setRightPadding(right); _paddingLabels[2]->setString(StringUtils::format("Right\nPadding=%d", right)); } @@ -1052,7 +1052,7 @@ void UIListViewTest_Padding::sliderEvent(Ref* pSender, Slider::EventType type) if (slider && slider->getTag() == 3) { int bottom = slider->getPercent() / 100.f * 50.f; - CCLOG("Bottom Padding: %d", bottom); + AXLOG("Bottom Padding: %d", bottom); _listView->setBottomPadding(bottom); _paddingLabels[3]->setString(StringUtils::format("Bottom\nPadding=%d", bottom)); } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp index 81cbd9a554..b353353d95 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UILoadingBarTest/UILoadingBarTest.cpp @@ -129,7 +129,7 @@ void UILoadingBarTest_Left::update(float delta) void UILoadingBarTest_Left::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _loadingBar->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } // UILoadingBarTest_Right diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp index 761ff19f6c..acc4fbafae 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIPageViewTest/UIPageViewTest.cpp @@ -315,19 +315,19 @@ bool UIPageViewTouchPropagationTest::init() pageView->addTouchEventListener([](Ref* sender, Widget::TouchEventType type) { if (type == Widget::TouchEventType::BEGAN) { - CCLOG("page view touch began"); + AXLOG("page view touch began"); } else if (type == Widget::TouchEventType::MOVED) { - CCLOG("page view touch moved"); + AXLOG("page view touch moved"); } else if (type == Widget::TouchEventType::ENDED) { - CCLOG("page view touch ended"); + AXLOG("page view touch ended"); } else { - CCLOG("page view touch cancelled"); + AXLOG("page view touch cancelled"); } }); _uiLayer->addChild(pageView); @@ -366,7 +366,7 @@ bool UIPageViewTouchPropagationTest::init() auto eventListener = EventListenerTouchOneByOne::create(); eventListener->onTouchBegan = [](Touch* touch, Event* event) -> bool { - CCLOG("layout receives touches"); + AXLOG("layout receives touches"); return true; }; _eventDispatcher->addEventListenerWithSceneGraphPriority(eventListener, this); @@ -409,7 +409,7 @@ void UIPageViewTouchPropagationTest::onButtonClicked(Ref* pSender, Widget::Touch } if (type == Widget::TouchEventType::ENDED) { - CCLOG("button clicked"); + AXLOG("button clicked"); } } @@ -537,7 +537,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() pageView->pushBackCustomItem(outerBox); _displayValueLabel->setString( StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); - CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); + AXLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button); @@ -554,11 +554,11 @@ bool UIPageViewDynamicAddAndRemoveTest::init() } else { - CCLOG("There is no page to remove!"); + AXLOG("There is no page to remove!"); } _displayValueLabel->setString( StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); - CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); + AXLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button2); @@ -572,7 +572,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() pageView->removeAllItems(); _displayValueLabel->setString( StringUtils::format("page count = %d", static_cast(pageView->getItems().size()))); - CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); + AXLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button3); @@ -581,7 +581,7 @@ bool UIPageViewDynamicAddAndRemoveTest::init() button4->setPositionNormalized(Vec2(0.85f, 0.5f)); button4->addClickEventListener([=](Ref* sender) { pageView->scrollToItem(3); - CCLOG("current page index = %zd", pageView->getCurrentPageIndex()); + AXLOG("current page index = %zd", pageView->getCurrentPageIndex()); }); _uiLayer->addChild(button4); @@ -674,14 +674,14 @@ bool UIPageViewJumpToPageTest::init() auto button1 = ui::Button::create(); button1->setPositionNormalized(Vec2(0.1f, 0.75f)); button1->setTitleText("Jump to Page1"); - CCLOG("button1 content Size = %f, %f", button1->getContentSize().width, button1->getContentSize().height); + AXLOG("button1 content Size = %f, %f", button1->getContentSize().width, button1->getContentSize().height); button1->addClickEventListener([=](Ref*) { pageView->setCurrentPageIndex(0); }); _uiLayer->addChild(button1); auto button2 = static_cast(button1->clone()); button2->setTitleText("Jump to Page2"); button2->setPositionNormalized(Vec2(0.1f, 0.65f)); - CCLOG("button2 content Size = %f, %f", button2->getContentSize().width, button2->getContentSize().height); + AXLOG("button2 content Size = %f, %f", button2->getContentSize().width, button2->getContentSize().height); button2->addClickEventListener([=](Ref*) { pageView->setCurrentPageIndex(1); }); _uiLayer->addChild(button2); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp index 5dbd2bbbc8..c553001e1b 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRadioButtonTest/UIRadioButtonTest.cpp @@ -238,7 +238,7 @@ void UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup1(RadioButton* radioBu int index, axis::ui::RadioButtonGroup::EventType type) { - CCASSERT(index == _radioButtonGroups[0]->getSelectedButtonIndex(), "The two indexes must match!"); + AXASSERT(index == _radioButtonGroups[0]->getSelectedButtonIndex(), "The two indexes must match!"); auto text = StringUtils::format("RadioButtonGroup1 : %d", index); _groupEventLabel->setString(text); addLog(text); @@ -248,7 +248,7 @@ void UIRadioButtonTwoGroupsTest::onChangedRadioButtonGroup2(RadioButton* radioBu int index, axis::ui::RadioButtonGroup::EventType type) { - CCASSERT(index == _radioButtonGroups[1]->getSelectedButtonIndex(), "The two indexes must match!"); + AXASSERT(index == _radioButtonGroups[1]->getSelectedButtonIndex(), "The two indexes must match!"); auto text = StringUtils::format("RadioButtonGroup2 : %d", index); _groupEventLabel->setString(text); addLog(text); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp index ee69a885c3..2391846b65 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIRichTextTest/UIRichTextTest.cpp @@ -65,10 +65,10 @@ bool UIRichTextTest::init() std::string str1 = config->getValue("Chinese").asString(); std::string str2 = config->getValue("Japanese").asString(); - CCLOG("str1:%s ascii length = %d, utf8 length = %d, substr = %s", str1.c_str(), + AXLOG("str1:%s ascii length = %d, utf8 length = %d, substr = %s", str1.c_str(), static_cast(str1.length()), StringUtils::getCharacterCountInUTF8String(str1), Helper::getSubStringOfUTF8String(str1, 0, 5).c_str()); - CCLOG("str2:%s ascii length = %d, utf8 length = %d, substr = %s", str2.c_str(), + AXLOG("str2:%s ascii length = %d, utf8 length = %d, substr = %s", str2.c_str(), static_cast(str2.length()), StringUtils::getCharacterCountInUTF8String(str2), Helper::getSubStringOfUTF8String(str2, 0, 2).c_str()); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp index 7a9120796c..59b3940c07 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScale9SpriteTest.cpp @@ -828,15 +828,15 @@ bool UIS9Flip::init() statusLabel->setString("Scale9Disabled"); } - CCLOG("scaleX = %f", flipXSprite->getScaleX()); - CCLOG("scaleY = %f", flipYSprite->getScale()); + AXLOG("scaleX = %f", flipXSprite->getScaleX()); + AXLOG("scaleY = %f", flipYSprite->getScale()); if (flipXSprite->isFlippedX()) { - CCLOG("xxxxxxx"); + AXLOG("xxxxxxx"); } if (flipYSprite->isFlippedY()) { - CCLOG("YYYYYY"); + AXLOG("YYYYYY"); } if (flipXSprite->isFlippedX()) @@ -890,10 +890,10 @@ bool UIS9ChangeAnchorPoint::init() { normalSprite->setAnchorPoint(Vec2::ZERO); normalSprite->setScale9Enabled(true); - CCLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x, + AXLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x, normalSprite->getPosition().y, normalSprite->getAnchorPoint().x, normalSprite->getAnchorPoint().y); - CCLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width, + AXLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width, normalSprite->getContentSize().height); } }); @@ -908,10 +908,10 @@ bool UIS9ChangeAnchorPoint::init() { normalSprite->setAnchorPoint(Vec2::ANCHOR_TOP_RIGHT); normalSprite->setScale9Enabled(false); - CCLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x, + AXLOG("position = %f, %f, anchor point = %f, %f", normalSprite->getPosition().x, normalSprite->getPosition().y, normalSprite->getAnchorPoint().x, normalSprite->getAnchorPoint().y); - CCLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width, + AXLOG("tests:content size : width = %f, height = %f", normalSprite->getContentSize().width, normalSprite->getContentSize().height); } }); @@ -939,14 +939,14 @@ bool UIS9NinePatchTest::init() playerSprite->setPosition(x, y); playerSprite->setContentSize(preferedSize); auto capInsets = playerSprite->getCapInsets(); - CCLOG("player sprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width, + AXLOG("player sprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); this->addChild(playerSprite); auto animationBtnSprite = ui::Scale9Sprite::createWithSpriteFrameName("animationbuttonpressed.png"); animationBtnSprite->setPosition(x - 100, y - 100); capInsets = animationBtnSprite->getCapInsets(); - CCLOG("animationBtnSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, + AXLOG("animationBtnSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); this->addChild(animationBtnSprite); @@ -954,7 +954,7 @@ bool UIS9NinePatchTest::init() monsterSprite->setPosition(x + 100, y - 100); capInsets = monsterSprite->getCapInsets(); monsterSprite->setContentSize(preferedSize); - CCLOG("monsterSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width, + AXLOG("monsterSprite capInset = %g, %g %g, %g", capInsets.origin.x, capInsets.origin.y, capInsets.size.width, capInsets.size.height); this->addChild(monsterSprite); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp index f195a097eb..06717ea6a4 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIScrollViewTest/UIScrollViewTest.cpp @@ -820,13 +820,13 @@ bool UIScrollViewStopScrollingTest::init() switch (e) { case ui::ScrollView::EventType::SCROLLING_BEGAN: - CCLOG("scrolling began!"); + AXLOG("scrolling began!"); break; case ui::ScrollView::EventType::SCROLLING_ENDED: - CCLOG("scrolling ended!"); + AXLOG("scrolling ended!"); break; case ui::ScrollView::EventType::AUTOSCROLL_ENDED: - CCLOG("auto-scrolling ended!"); + AXLOG("auto-scrolling ended!"); break; default: break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp index 33235d3d50..ef2312bea2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UISliderTest/UISliderTest.cpp @@ -103,18 +103,18 @@ void UISliderTest::sliderEvent(Ref* pSender, Slider::EventType type) void UISliderTest::printWidgetResources(axis::Ref* /*sender*/) { axis::ResourceData textureFile = _slider->getBackFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); axis::ResourceData progressBarTextureFile = _slider->getProgressBarFile(); - CCLOG("progressBarTextureFile Name : %s, Type: %d", progressBarTextureFile.file.c_str(), + AXLOG("progressBarTextureFile Name : %s, Type: %d", progressBarTextureFile.file.c_str(), progressBarTextureFile.type); axis::ResourceData slidBallNormalTextureFile = _slider->getBallNormalFile(); - CCLOG("slidBallNormalTextureFile Name : %s, Type: %d", slidBallNormalTextureFile.file.c_str(), + AXLOG("slidBallNormalTextureFile Name : %s, Type: %d", slidBallNormalTextureFile.file.c_str(), slidBallNormalTextureFile.type); axis::ResourceData slidBallPressedTextureFile = _slider->getBallPressedFile(); - CCLOG("slidBallPressedTextureFile Name : %s, Type: %d", slidBallPressedTextureFile.file.c_str(), + AXLOG("slidBallPressedTextureFile Name : %s, Type: %d", slidBallPressedTextureFile.file.c_str(), slidBallPressedTextureFile.type); axis::ResourceData slidBallDisabledTextureFile = _slider->getBallDisabledFile(); - CCLOG("slidBallDisabledTextureFile Name : %s, Type: %d", slidBallDisabledTextureFile.file.c_str(), + AXLOG("slidBallDisabledTextureFile Name : %s, Type: %d", slidBallDisabledTextureFile.file.c_str(), slidBallDisabledTextureFile.type); } @@ -365,15 +365,15 @@ bool UISliderNewEventCallbackTest::init() AX_UNUSED_PARAM(slider); if (type == Slider::EventType::ON_SLIDEBALL_DOWN) { - CCLOG("slider button pressed!"); + AXLOG("slider button pressed!"); } else if (type == Slider::EventType::ON_PERCENTAGE_CHANGED) { - CCLOG("slider is moving! percent = %f", 100.0f * slider->getPercent() / slider->getMaxPercent()); + AXLOG("slider is moving! percent = %f", 100.0f * slider->getPercent() / slider->getMaxPercent()); } else if (type == Slider::EventType::ON_SLIDEBALL_UP) { - CCLOG("slider button is released."); + AXLOG("slider button is released."); } }); _uiLayer->addChild(slider); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp index 2eb6bb84d6..aaa09af90c 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextAtlasTest/UITextAtlasTest.cpp @@ -76,7 +76,7 @@ bool UITextAtlasTest::init() void UITextAtlasTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _textAtlas->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } // UITextAtlasETC1ShadowTest @@ -126,5 +126,5 @@ bool UITextAtlasETC1ShadowTest::init() void UITextAtlasETC1ShadowTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _textAtlas->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp index 024b761686..366c55bf89 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextBMFontTest/UITextBMFontTest.cpp @@ -69,5 +69,5 @@ bool UITextBMFontTest::init() void UITextBMFontTest::printWidgetResources(axis::Ref* sender) { axis::ResourceData textureFile = _textBMFont->getRenderFile(); - CCLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); + AXLOG("textureFile Name : %s, Type: %d", textureFile.file.c_str(), textureFile.type); } diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp index 14caab74aa..60cad84610 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextFieldTest/UITextFieldTest.cpp @@ -560,7 +560,7 @@ void UITextFieldTest_PlaceHolderColor::textFieldEvent(Ref* pSender, TextField::E case TextField::EventType::INSERT_TEXT: { _displayValueLabel->setString(StringUtils::format("insert words")); - CCLOG("%f, %f", dynamic_cast(pSender)->getContentSize().width, + AXLOG("%f, %f", dynamic_cast(pSender)->getContentSize().width, dynamic_cast(pSender)->getContentSize().height); } break; diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp index eb07f3fe35..a0dad0210e 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UITextTest/UITextTest.cpp @@ -148,14 +148,14 @@ bool UILabelTest_Effect::init() // create the label stroke and shadow Text* outline_label = Text::create(); outline_label->setString("Outline"); - CCLOG("content size without outline: %f %f", outline_label->getContentSize().width, + AXLOG("content size without outline: %f %f", outline_label->getContentSize().width, outline_label->getContentSize().height); outline_label->enableOutline(Color4B::GREEN, 4); outline_label->setPosition( Vec2(widgetSize.width / 2.0f, widgetSize.height / 2.0f - shadow_label->getContentSize().height - 50)); _uiLayer->addChild(outline_label); - CCLOG("content size after applying outline: %f %f", outline_label->getContentSize().width, + AXLOG("content size after applying outline: %f %f", outline_label->getContentSize().width, outline_label->getContentSize().height); // create buttons to disable effect and add @@ -166,7 +166,7 @@ bool UILabelTest_Effect::init() disableOutlineBtn->setPressedActionEnabled(true); disableOutlineBtn->addClickEventListener([=](Ref*) { outline_label->disableEffect(LabelEffect::OUTLINE); - CCLOG("content size after disable outline: %f %f", outline_label->getContentSize().width, + AXLOG("content size after disable outline: %f %f", outline_label->getContentSize().width, outline_label->getContentSize().height); }); this->addChild(disableOutlineBtn); diff --git a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp index 2d18c9f9da..ffe3732bb2 100644 --- a/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp +++ b/tests/cpp-tests/Classes/UITest/CocoStudioGUITest/UIWebViewTest/UIWebViewTest.cpp @@ -174,7 +174,7 @@ bool WebViewTest::init() bool WebViewTest::onWebViewShouldStartLoading(ui::WebView* sender, std::string_view url) { - CCLOG("onWebViewShouldStartLoading, url is %s", url.data()); + AXLOG("onWebViewShouldStartLoading, url is %s", url.data()); // don't do any OpenGL operation here!! It's forbidden! return true; } @@ -183,10 +183,10 @@ void WebViewTest::onWebViewDidFinishLoading(ui::WebView* sender, std::string_vie { auto node = (ui::Button*)this->getChildByName("evalJs"); node->setTitleText("start loading..."); - CCLOG("onWebViewDidFinishLoading, url is %s", url.data()); + AXLOG("onWebViewDidFinishLoading, url is %s", url.data()); } void WebViewTest::onWebViewDidFailLoading(ui::WebView* sender, std::string_view url) { - CCLOG("onWebViewDidFailLoading, url is %s", url.data()); + AXLOG("onWebViewDidFailLoading, url is %s", url.data()); } diff --git a/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp b/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp index 5dea731bc9..b568c3efbc 100644 --- a/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp +++ b/tests/cpp-tests/Classes/UnitTest/UnitTest.cpp @@ -96,51 +96,51 @@ void TemplateVectorTest::onEnter() UnitTestDemo::onEnter(); Vector vec; - CCASSERT(vec.empty(), "vec should be empty."); - CCASSERT(vec.capacity() == 0, "vec.capacity should be 0."); - CCASSERT(vec.size() == 0, "vec.size should be 0."); - CCASSERT(vec.max_size() > 0, "vec.max_size should > 0."); + AXASSERT(vec.empty(), "vec should be empty."); + AXASSERT(vec.capacity() == 0, "vec.capacity should be 0."); + AXASSERT(vec.size() == 0, "vec.size should be 0."); + AXASSERT(vec.max_size() > 0, "vec.max_size should > 0."); auto node1 = Node::create(); node1->setTag(1); vec.pushBack(node1); - CCASSERT(node1->getReferenceCount() == 2, "node1->getReferenceCount should be 2."); + AXASSERT(node1->getReferenceCount() == 2, "node1->getReferenceCount should be 2."); auto node2 = Node::create(); node2->setTag(2); vec.pushBack(node2); - CCASSERT(vec.getIndex(node1) == 0, "node1 should at index 0 in vec."); - CCASSERT(vec.getIndex(node2) == 1, "node2 should at index 1 in vec."); + AXASSERT(vec.getIndex(node1) == 0, "node1 should at index 0 in vec."); + AXASSERT(vec.getIndex(node2) == 1, "node2 should at index 1 in vec."); auto node3 = Node::create(); node3->setTag(3); vec.insert(1, node3); - CCASSERT(vec.at(0)->getTag() == 1, "The element at 0, tag should be 1."); - CCASSERT(vec.at(1)->getTag() == 3, "The element at 1, tag should be 3."); - CCASSERT(vec.at(2)->getTag() == 2, "The element at 2, tag should be 2."); + AXASSERT(vec.at(0)->getTag() == 1, "The element at 0, tag should be 1."); + AXASSERT(vec.at(1)->getTag() == 3, "The element at 1, tag should be 3."); + AXASSERT(vec.at(2)->getTag() == 2, "The element at 2, tag should be 2."); // Test copy constructor Vector vec2(vec); - CCASSERT(vec2.size() == vec.size(), "vec2 and vec should have equal size."); + AXASSERT(vec2.size() == vec.size(), "vec2 and vec should have equal size."); ssize_t size = vec.size(); for (ssize_t i = 0; i < size; ++i) { - CCASSERT(vec2.at(i) == vec.at(i), "The element at the same index in vec2 and vec2 should be equal."); - CCASSERT(vec.at(i)->getReferenceCount() == 3, "The reference count of element in vec is 3. "); - CCASSERT(vec2.at(i)->getReferenceCount() == 3, "The reference count of element in vec2 is 3. "); + AXASSERT(vec2.at(i) == vec.at(i), "The element at the same index in vec2 and vec2 should be equal."); + AXASSERT(vec.at(i)->getReferenceCount() == 3, "The reference count of element in vec is 3. "); + AXASSERT(vec2.at(i)->getReferenceCount() == 3, "The reference count of element in vec2 is 3. "); } // Test copy assignment operator Vector vec3; vec3 = vec2; - CCASSERT(vec3.size() == vec2.size(), "vec3 and vec2 should have equal size."); + AXASSERT(vec3.size() == vec2.size(), "vec3 and vec2 should have equal size."); size = vec3.size(); for (ssize_t i = 0; i < size; ++i) { - CCASSERT(vec3.at(i) == vec2.at(i), "The element at the same index in vec3 and vec2 should be equal."); - CCASSERT(vec3.at(i)->getReferenceCount() == 4, "The reference count of element in vec3 is 4. "); - CCASSERT(vec2.at(i)->getReferenceCount() == 4, "The reference count of element in vec2 is 4. "); - CCASSERT(vec.at(i)->getReferenceCount() == 4, "The reference count of element in vec is 4. "); + AXASSERT(vec3.at(i) == vec2.at(i), "The element at the same index in vec3 and vec2 should be equal."); + AXASSERT(vec3.at(i)->getReferenceCount() == 4, "The reference count of element in vec3 is 4. "); + AXASSERT(vec2.at(i)->getReferenceCount() == 4, "The reference count of element in vec2 is 4. "); + AXASSERT(vec.at(i)->getReferenceCount() == 4, "The reference count of element in vec is 4. "); } // Test move constructor @@ -166,75 +166,75 @@ void TemplateVectorTest::onEnter() for (const auto& child : vec4) { AX_UNUSED_PARAM(child); - CCASSERT(child->getReferenceCount() == 2, "child's reference count should be 2."); + AXASSERT(child->getReferenceCount() == 2, "child's reference count should be 2."); } // Test init Vector with capacity Vector vec5(10); - CCASSERT(vec5.capacity() == 10, "vec5's capacity should be 10."); + AXASSERT(vec5.capacity() == 10, "vec5's capacity should be 10."); vec5.reserve(20); - CCASSERT(vec5.capacity() == 20, "vec5's capacity should be 20."); + AXASSERT(vec5.capacity() == 20, "vec5's capacity should be 20."); - CCASSERT(vec5.size() == 0, "vec5's size should be 0."); - CCASSERT(vec5.empty(), "vec5 is empty now."); + AXASSERT(vec5.size() == 0, "vec5's size should be 0."); + AXASSERT(vec5.empty(), "vec5 is empty now."); auto toRemovedNode = Node::create(); vec5.pushBack(toRemovedNode); - CCASSERT(toRemovedNode->getReferenceCount() == 2, "toRemovedNode's reference count is 2."); + AXASSERT(toRemovedNode->getReferenceCount() == 2, "toRemovedNode's reference count is 2."); // Test move assignment operator vec5 = createVector(); - CCASSERT(toRemovedNode->getReferenceCount() == 1, "toRemovedNode's reference count is 1."); - CCASSERT(vec5.size() == 20, "size should be 20"); + AXASSERT(toRemovedNode->getReferenceCount() == 1, "toRemovedNode's reference count is 1."); + AXASSERT(vec5.size() == 20, "size should be 20"); for (const auto& child : vec5) { AX_UNUSED_PARAM(child); - CCASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); + AXASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); } // Test Vector::find - CCASSERT(vec.find(node3) == (vec.begin() + 1), "node3 is the 2nd element in vec."); - CCASSERT(std::find(std::begin(vec), std::end(vec), node2) == (vec.begin() + 2), "node2 is the 3rd element in vec."); + AXASSERT(vec.find(node3) == (vec.begin() + 1), "node3 is the 2nd element in vec."); + AXASSERT(std::find(std::begin(vec), std::end(vec), node2) == (vec.begin() + 2), "node2 is the 3rd element in vec."); - CCASSERT(vec.front()->getTag() == 1, "vec's front element's tag is 1."); - CCASSERT(vec.back()->getTag() == 2, "vec's back element's tag is 2."); + AXASSERT(vec.front()->getTag() == 1, "vec's front element's tag is 1."); + AXASSERT(vec.back()->getTag() == 2, "vec's back element's tag is 2."); - CCASSERT(vec.getRandomObject(), "vec getRandomObject should return true."); - CCASSERT(!vec.contains(Node::create()), "vec doesn't contain a empty Node instance."); - CCASSERT(vec.contains(node1), "vec contains node1."); - CCASSERT(vec.contains(node2), "vec contains node2."); - CCASSERT(vec.contains(node3), "vec contains node3."); - CCASSERT(vec.equals(vec2), "vec is equal to vec2."); - CCASSERT(vec.equals(vec3), "vec is equal to vec3."); + AXASSERT(vec.getRandomObject(), "vec getRandomObject should return true."); + AXASSERT(!vec.contains(Node::create()), "vec doesn't contain a empty Node instance."); + AXASSERT(vec.contains(node1), "vec contains node1."); + AXASSERT(vec.contains(node2), "vec contains node2."); + AXASSERT(vec.contains(node3), "vec contains node3."); + AXASSERT(vec.equals(vec2), "vec is equal to vec2."); + AXASSERT(vec.equals(vec3), "vec is equal to vec3."); // Insert vec5.insert(2, node1); - CCASSERT(vec5.at(2)->getTag() == 1, "vec5's 3rd element's tag is 1."); - CCASSERT(vec5.size() == 21, "vec5's size is 21."); + AXASSERT(vec5.at(2)->getTag() == 1, "vec5's 3rd element's tag is 1."); + AXASSERT(vec5.size() == 21, "vec5's size is 21."); vec5.back()->setTag(100); vec5.popBack(); - CCASSERT(vec5.size() == 20, "vec5's size is 20."); - CCASSERT(vec5.back()->getTag() != 100, "the back element of vec5's tag is 100."); + AXASSERT(vec5.size() == 20, "vec5's size is 20."); + AXASSERT(vec5.back()->getTag() != 100, "the back element of vec5's tag is 100."); // Erase and clear Vector vec6 = createVector(); Vector vec7 = vec6; // Copy for check - CCASSERT(vec6.size() == 20, "vec6's size is 20."); + AXASSERT(vec6.size() == 20, "vec6's size is 20."); vec6.erase(vec6.begin() + 1); // - CCASSERT(vec6.size() == 19, "vec6's size is 19."); - CCASSERT((*(vec6.begin() + 1))->getTag() == 1002, "The 2rd element in vec6's tag is 1002."); + AXASSERT(vec6.size() == 19, "vec6's size is 19."); + AXASSERT((*(vec6.begin() + 1))->getTag() == 1002, "The 2rd element in vec6's tag is 1002."); vec6.erase(vec6.begin() + 2, vec6.begin() + 10); - CCASSERT(vec6.size() == 11, "vec6's size is 11."); - CCASSERT(vec6.at(0)->getTag() == 1000, "vec6's first element's tag is 1000."); - CCASSERT(vec6.at(1)->getTag() == 1002, "vec6's second element's tag is 1002."); - CCASSERT(vec6.at(2)->getTag() == 1011, "vec6's third element's tag is 1011."); - CCASSERT(vec6.at(3)->getTag() == 1012, "vec6's fouth element's tag is 1012."); + AXASSERT(vec6.size() == 11, "vec6's size is 11."); + AXASSERT(vec6.at(0)->getTag() == 1000, "vec6's first element's tag is 1000."); + AXASSERT(vec6.at(1)->getTag() == 1002, "vec6's second element's tag is 1002."); + AXASSERT(vec6.at(2)->getTag() == 1011, "vec6's third element's tag is 1011."); + AXASSERT(vec6.at(3)->getTag() == 1012, "vec6's fouth element's tag is 1012."); vec6.erase(3); - CCASSERT(vec6.at(3)->getTag() == 1013, "vec6's 4th element's tag is 1013."); + AXASSERT(vec6.at(3)->getTag() == 1013, "vec6's 4th element's tag is 1013."); vec6.eraseObject(vec6.at(2)); - CCASSERT(vec6.at(2)->getTag() == 1013, "vec6's 3rd element's tag is 1013."); + AXASSERT(vec6.at(2)->getTag() == 1013, "vec6's 3rd element's tag is 1013."); vec6.clear(); auto objA = Node::create(); // retain count is 1 @@ -257,9 +257,9 @@ void TemplateVectorTest::onEnter() { array2.eraseObject(obj); } - CCASSERT(objA->getReferenceCount() == 4, "objA's reference count is 4."); + AXASSERT(objA->getReferenceCount() == 4, "objA's reference count is 4."); } - CCASSERT(objA->getReferenceCount() == 1, "objA's reference count is 1."); + AXASSERT(objA->getReferenceCount() == 1, "objA's reference count is 1."); { Vector array1; @@ -267,25 +267,25 @@ void TemplateVectorTest::onEnter() array1.pushBack(objA); // retain count is 2 array1.pushBack(objA); // retain count is 3 array1.pushBack(objA); // retain count is 4 - CCASSERT(objA->getReferenceCount() == 4, "objA's reference count is 4."); + AXASSERT(objA->getReferenceCount() == 4, "objA's reference count is 4."); array1.eraseObject(objA, true); // Remove all occurrences in the Vector. - CCASSERT(objA->getReferenceCount() == 1, "objA's reference count is 1."); + AXASSERT(objA->getReferenceCount() == 1, "objA's reference count is 1."); array1.pushBack(objA); // retain count is 2 array1.pushBack(objA); // retain count is 3 array1.pushBack(objA); // retain count is 4 array1.eraseObject(objA, false); - CCASSERT(objA->getReferenceCount() == 3, + AXASSERT(objA->getReferenceCount() == 3, "objA's reference count is 3."); // Only remove the first occurrence in the Vector. } // Check the retain count in vec7 - CCASSERT(vec7.size() == 20, "vec7's size is 20."); + AXASSERT(vec7.size() == 20, "vec7's size is 20."); for (const auto& child : vec7) { AX_UNUSED_PARAM(child); - CCASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); + AXASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); } // Sort @@ -294,32 +294,32 @@ void TemplateVectorTest::onEnter() for (int i = 0; i < 20; ++i) { - CCASSERT(vecForSort.at(i)->getTag() - 1000 == (19 - i), "vecForSort's element's tag is invalid."); + AXASSERT(vecForSort.at(i)->getTag() - 1000 == (19 - i), "vecForSort's element's tag is invalid."); } // Reverse vecForSort.reverse(); for (int i = 0; i < 20; ++i) { - CCASSERT(vecForSort.at(i)->getTag() - 1000 == i, "vecForSort's element's tag is invalid."); + AXASSERT(vecForSort.at(i)->getTag() - 1000 == i, "vecForSort's element's tag is invalid."); } // Swap Vector vecForSwap = createVector(); vecForSwap.swap(2, 4); - CCASSERT(vecForSwap.at(2)->getTag() == 1004, "vecForSwap's 3nd element's tag is 1004."); - CCASSERT(vecForSwap.at(4)->getTag() == 1002, "vecForSwap's 5rd element's tag is 1002."); + AXASSERT(vecForSwap.at(2)->getTag() == 1004, "vecForSwap's 3nd element's tag is 1004."); + AXASSERT(vecForSwap.at(4)->getTag() == 1002, "vecForSwap's 5rd element's tag is 1002."); vecForSwap.swap(vecForSwap.at(2), vecForSwap.at(4)); - CCASSERT(vecForSwap.at(2)->getTag() == 1002, "vecForSwap's 3rd element's tag is 1002."); - CCASSERT(vecForSwap.at(4)->getTag() == 1004, "vecForSwap's 5rd element's tag is 1004."); + AXASSERT(vecForSwap.at(2)->getTag() == 1002, "vecForSwap's 3rd element's tag is 1002."); + AXASSERT(vecForSwap.at(4)->getTag() == 1004, "vecForSwap's 5rd element's tag is 1004."); // shrinkToFit Vector vecForShrink = createVector(); vecForShrink.reserve(100); - CCASSERT(vecForShrink.capacity() == 100, "vecForShrink's capacity is 100."); + AXASSERT(vecForShrink.capacity() == 100, "vecForShrink's capacity is 100."); vecForShrink.pushBack(Node::create()); vecForShrink.shrinkToFit(); - CCASSERT(vecForShrink.capacity() == 21, "vecForShrink's capacity is 21."); + AXASSERT(vecForShrink.capacity() == 21, "vecForShrink's capacity is 21."); // get random object // Set the seed by time @@ -335,21 +335,21 @@ void TemplateVectorTest::onEnter() // Self assignment Vector vecSelfAssign = createVector(); vecSelfAssign = vecSelfAssign; - CCASSERT(vecSelfAssign.size() == 20, "vecSelfAssign's size is 20."); + AXASSERT(vecSelfAssign.size() == 20, "vecSelfAssign's size is 20."); for (const auto& child : vecSelfAssign) { AX_UNUSED_PARAM(child); - CCASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); + AXASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); } vecSelfAssign = std::move(vecSelfAssign); - CCASSERT(vecSelfAssign.size() == 20, "vecSelfAssign's size is 20."); + AXASSERT(vecSelfAssign.size() == 20, "vecSelfAssign's size is 20."); for (const auto& child : vecSelfAssign) { AX_UNUSED_PARAM(child); - CCASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); + AXASSERT(child->getReferenceCount() == 2, "child's reference count is 2."); } // const at @@ -387,17 +387,17 @@ void TemplateMapTest::onEnter() // Default constructor Map map1; - CCASSERT(map1.empty(), "map1 is empty."); - CCASSERT(map1.size() == 0, "map1's size is 0."); - CCASSERT(map1.keys().empty(), "map1's keys are empty."); - CCASSERT(map1.keys(Node::create()).empty(), "map1's keys don't contain a empty Node."); + AXASSERT(map1.empty(), "map1 is empty."); + AXASSERT(map1.size() == 0, "map1's size is 0."); + AXASSERT(map1.keys().empty(), "map1's keys are empty."); + AXASSERT(map1.keys(Node::create()).empty(), "map1's keys don't contain a empty Node."); // Move constructor auto map2 = createMap(); for (const auto& e : map2) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 2, "e.second element's reference count is 2."); + AXASSERT(e.second->getReferenceCount() == 2, "e.second element's reference count is 2."); } // Copy constructor @@ -405,7 +405,7 @@ void TemplateMapTest::onEnter() for (const auto& e : map3) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 3, "e.second's reference count is 3."); + AXASSERT(e.second->getReferenceCount() == 3, "e.second's reference count is 3."); } // Move assignment operator @@ -413,11 +413,11 @@ void TemplateMapTest::onEnter() auto unusedNode = Node::create(); map4.insert("unused", unusedNode); map4 = createMap(); - CCASSERT(unusedNode->getReferenceCount() == 1, "unusedNode's reference count is 1."); + AXASSERT(unusedNode->getReferenceCount() == 1, "unusedNode's reference count is 1."); for (const auto& e : map4) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); + AXASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); } // Copy assignment operator @@ -426,16 +426,16 @@ void TemplateMapTest::onEnter() for (const auto& e : map5) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 3, "e.second's reference count is 3."); + AXASSERT(e.second->getReferenceCount() == 3, "e.second's reference count is 3."); } // Check size - CCASSERT(map4.size() == map5.size(), "map4's size is equal to map5.size."); + AXASSERT(map4.size() == map5.size(), "map4's size is equal to map5.size."); for (const auto& e : map4) { AX_UNUSED_PARAM(e); - CCASSERT(e.second == map5.find(e.first)->second, "e.second can't be found in map5."); + AXASSERT(e.second == map5.find(e.first)->second, "e.second can't be found in map5."); } // bucket_count, bucket_size(n), bucket @@ -479,7 +479,7 @@ void TemplateMapTest::onEnter() // find auto nodeToFind = map4.find("10"); AX_UNUSED_PARAM(nodeToFind); - CCASSERT(nodeToFind->second->getTag() == 1010, "nodeToFind's tag value is 1010."); + AXASSERT(nodeToFind->second->getTag() == 1010, "nodeToFind's tag value is 1010."); // insert Map map6; @@ -493,29 +493,29 @@ void TemplateMapTest::onEnter() map6.insert("insert02", node2); map6.insert("insert03", node3); - CCASSERT(node1->getReferenceCount() == 2, "node1's reference count is 2."); - CCASSERT(node2->getReferenceCount() == 2, "node2's reference count is 2."); - CCASSERT(node3->getReferenceCount() == 2, "node3's reference count is 2."); - CCASSERT(map6.at("insert01") == node1, "The element at insert01 is equal to node1."); - CCASSERT(map6.at("insert02") == node2, "The element at insert02 is equal to node2."); - CCASSERT(map6.at("insert03") == node3, "The element at insert03 is equal to node3."); + AXASSERT(node1->getReferenceCount() == 2, "node1's reference count is 2."); + AXASSERT(node2->getReferenceCount() == 2, "node2's reference count is 2."); + AXASSERT(node3->getReferenceCount() == 2, "node3's reference count is 2."); + AXASSERT(map6.at("insert01") == node1, "The element at insert01 is equal to node1."); + AXASSERT(map6.at("insert02") == node2, "The element at insert02 is equal to node2."); + AXASSERT(map6.at("insert03") == node3, "The element at insert03 is equal to node3."); // erase StringMap mapForErase = createMap(); mapForErase.erase(mapForErase.find("9")); - CCASSERT(mapForErase.find("9") == mapForErase.end(), "9 is already removed."); - CCASSERT(mapForErase.size() == 19, "mapForErase's size is 19."); + AXASSERT(mapForErase.find("9") == mapForErase.end(), "9 is already removed."); + AXASSERT(mapForErase.size() == 19, "mapForErase's size is 19."); mapForErase.erase("7"); - CCASSERT(mapForErase.find("7") == mapForErase.end(), "7 is already removed."); - CCASSERT(mapForErase.size() == 18, "mapForErase's size is 18."); + AXASSERT(mapForErase.find("7") == mapForErase.end(), "7 is already removed."); + AXASSERT(mapForErase.size() == 18, "mapForErase's size is 18."); std::vector itemsToRemove; itemsToRemove.push_back("2"); itemsToRemove.push_back("3"); itemsToRemove.push_back("4"); mapForErase.erase(itemsToRemove); - CCASSERT(mapForErase.size() == 15, "mapForErase's size is 15."); + AXASSERT(mapForErase.size() == 15, "mapForErase's size is 15."); // clear StringMap mapForClear = createMap(); @@ -525,7 +525,7 @@ void TemplateMapTest::onEnter() for (const auto& e : mapForClearCopy) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); + AXASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); } // get random object @@ -542,21 +542,21 @@ void TemplateMapTest::onEnter() // Self assignment StringMap mapForSelfAssign = createMap(); mapForSelfAssign = mapForSelfAssign; - CCASSERT(mapForSelfAssign.size() == 20, "mapForSelfAssign's size is 20."); + AXASSERT(mapForSelfAssign.size() == 20, "mapForSelfAssign's size is 20."); for (const auto& e : mapForSelfAssign) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); + AXASSERT(e.second->getReferenceCount() == 2, "e.second's reference count is 2."); } mapForSelfAssign = std::move(mapForSelfAssign); - CCASSERT(mapForSelfAssign.size() == 20, "mapForSelfAssign's size is 20."); + AXASSERT(mapForSelfAssign.size() == 20, "mapForSelfAssign's size is 20."); for (const auto& e : mapForSelfAssign) { AX_UNUSED_PARAM(e); - CCASSERT(e.second->getReferenceCount() == 2, "e.second's reference's count is 2."); + AXASSERT(e.second->getReferenceCount() == 2, "e.second's reference's count is 2."); } } @@ -578,37 +578,37 @@ void ValueTest::onEnter() UnitTestDemo::onEnter(); Value v1; - CCASSERT(v1.getType() == Value::Type::NONE, "v1's value type should be VALUE::Type::NONE."); - CCASSERT(v1.isNull(), "v1 is null."); + AXASSERT(v1.getType() == Value::Type::NONE, "v1's value type should be VALUE::Type::NONE."); + AXASSERT(v1.isNull(), "v1 is null."); Value v2(100); - CCASSERT(v2.getType() == Value::Type::INTEGER, "v2's value type should be VALUE::Type::INTEGER."); - CCASSERT(!v2.isNull(), "v2 is not null."); + AXASSERT(v2.getType() == Value::Type::INTEGER, "v2's value type should be VALUE::Type::INTEGER."); + AXASSERT(!v2.isNull(), "v2 is not null."); Value v3(101.4f); - CCASSERT(v3.getType() == Value::Type::FLOAT, "v3's value type should be VALUE::Type::FLOAT."); - CCASSERT(!v3.isNull(), "v3 is not null."); + AXASSERT(v3.getType() == Value::Type::FLOAT, "v3's value type should be VALUE::Type::FLOAT."); + AXASSERT(!v3.isNull(), "v3 is not null."); Value v4(106.1); - CCASSERT(v4.getType() == Value::Type::DOUBLE, "v4's value type should be VALUE::Type::DOUBLE."); - CCASSERT(!v4.isNull(), "v4 is not null."); + AXASSERT(v4.getType() == Value::Type::DOUBLE, "v4's value type should be VALUE::Type::DOUBLE."); + AXASSERT(!v4.isNull(), "v4 is not null."); unsigned char byte = 50; Value v5(byte); - CCASSERT(v5.getType() == Value::Type::INT_UI32, "v5's value type should be Value::Type::INT_UI32."); - CCASSERT(!v5.isNull(), "v5 is not null."); + AXASSERT(v5.getType() == Value::Type::INT_UI32, "v5's value type should be Value::Type::INT_UI32."); + AXASSERT(!v5.isNull(), "v5 is not null."); Value v6(true); - CCASSERT(v6.getType() == Value::Type::BOOLEAN, "v6's value type is Value::Type::BOOLEAN."); - CCASSERT(!v6.isNull(), "v6 is not null."); + AXASSERT(v6.getType() == Value::Type::BOOLEAN, "v6's value type is Value::Type::BOOLEAN."); + AXASSERT(!v6.isNull(), "v6 is not null."); Value v7("string"); - CCASSERT(v7.getType() == Value::Type::STRING, "v7's value type is Value::type::STRING."); - CCASSERT(!v7.isNull(), "v7 is not null."); + AXASSERT(v7.getType() == Value::Type::STRING, "v7's value type is Value::type::STRING."); + AXASSERT(!v7.isNull(), "v7 is not null."); Value v8(std::string("string2")); - CCASSERT(v8.getType() == Value::Type::STRING, "v8's value type is Value::Type::STRING."); - CCASSERT(!v8.isNull(), "v8 is not null."); + AXASSERT(v8.getType() == Value::Type::STRING, "v8's value type is Value::Type::STRING."); + AXASSERT(!v8.isNull(), "v8 is not null."); auto createValueVector = [&]() { ValueVector ret; @@ -619,8 +619,8 @@ void ValueTest::onEnter() }; Value v9(createValueVector()); - CCASSERT(v9.getType() == Value::Type::VECTOR, "v9's value type is Value::Type::VECTOR."); - CCASSERT(!v9.isNull(), "v9 is not null."); + AXASSERT(v9.getType() == Value::Type::VECTOR, "v9's value type is Value::Type::VECTOR."); + AXASSERT(!v9.isNull(), "v9 is not null."); auto createValueMap = [&]() { ValueMap ret; @@ -631,8 +631,8 @@ void ValueTest::onEnter() }; Value v10(createValueMap()); - CCASSERT(v10.getType() == Value::Type::MAP, "v10's value type is Value::Type::MAP."); - CCASSERT(!v10.isNull(), "v10 is not null."); + AXASSERT(v10.getType() == Value::Type::MAP, "v10's value type is Value::Type::MAP."); + AXASSERT(!v10.isNull(), "v10 is not null."); auto createValueMapIntKey = [&]() { ValueMapIntKey ret; @@ -643,8 +643,8 @@ void ValueTest::onEnter() }; Value v11(createValueMapIntKey()); - CCASSERT(v11.getType() == Value::Type::INT_KEY_MAP, "v11's value type is Value::Type::INT_KEY_MAP."); - CCASSERT(!v11.isNull(), "v11 is not null."); + AXASSERT(v11.getType() == Value::Type::INT_KEY_MAP, "v11's value type is Value::Type::INT_KEY_MAP."); + AXASSERT(!v11.isNull(), "v11 is not null."); } std::string ValueTest::subtitle() const @@ -690,7 +690,7 @@ static void doUTFConversion() isSuccess = memcmp(utf8Str.data(), originalUTF8.data(), originalUTF8.length() + 1) == 0; } - CCASSERT(isSuccess, "StringUtils::UTF16ToUTF8 failed"); + AXASSERT(isSuccess, "StringUtils::UTF16ToUTF8 failed"); //--------------------------- std::u16string utf16Str; @@ -701,12 +701,12 @@ static void doUTFConversion() isSuccess = memcmp(utf16Str.data(), originalUTF16.data(), originalUTF16.length() + 1) == 0; } - CCASSERT(isSuccess && (utf16Str.length() == TEST_CODE_NUM), "StringUtils::UTF8ToUTF16 failed"); + AXASSERT(isSuccess && (utf16Str.length() == TEST_CODE_NUM), "StringUtils::UTF8ToUTF16 failed"); //--------------------------- auto vec1 = StringUtils::getChar16VectorFromUTF16String(originalUTF16); - CCASSERT(vec1.size() == originalUTF16.length(), "StringUtils::getChar16VectorFromUTF16String failed"); + AXASSERT(vec1.size() == originalUTF16.length(), "StringUtils::getChar16VectorFromUTF16String failed"); //--------------------------- std::vector vec2(vec1); @@ -718,35 +718,35 @@ static void doUTFConversion() std::vector vec3(vec2); StringUtils::trimUTF16Vector(vec2); - CCASSERT(vec1.size() == vec2.size(), "StringUtils::trimUTF16Vector failed"); + AXASSERT(vec1.size() == vec2.size(), "StringUtils::trimUTF16Vector failed"); for (size_t i = 0; i < vec2.size(); i++) { - CCASSERT(vec1.at(i) == vec2.at(i), "StringUtils::trimUTF16Vector failed"); + AXASSERT(vec1.at(i) == vec2.at(i), "StringUtils::trimUTF16Vector failed"); } //--------------------------- - CCASSERT(StringUtils::getCharacterCountInUTF8String(originalUTF8) == TEST_CODE_NUM, + AXASSERT(StringUtils::getCharacterCountInUTF8String(originalUTF8) == TEST_CODE_NUM, "StringUtils::getCharacterCountInUTF8String failed"); //--------------------------- - CCASSERT(StringUtils::getIndexOfLastNotChar16(vec3, 0x2009) == (vec1.size() - 1), + AXASSERT(StringUtils::getIndexOfLastNotChar16(vec3, 0x2009) == (vec1.size() - 1), "StringUtils::getIndexOfLastNotChar16 failed"); //--------------------------- - CCASSERT(originalUTF16.length() == TEST_CODE_NUM, + AXASSERT(originalUTF16.length() == TEST_CODE_NUM, "The length of the original utf16 string isn't equal to TEST_CODE_NUM"); //--------------------------- size_t whiteCodeNum = sizeof(WHITE_SPACE_CODE) / sizeof(WHITE_SPACE_CODE[0]); for (size_t i = 0; i < whiteCodeNum; i++) { - CCASSERT(StringUtils::isUnicodeSpace(WHITE_SPACE_CODE[i]), "StringUtils::isUnicodeSpace failed"); + AXASSERT(StringUtils::isUnicodeSpace(WHITE_SPACE_CODE[i]), "StringUtils::isUnicodeSpace failed"); } - CCASSERT(!StringUtils::isUnicodeSpace(0xFFFF), "StringUtils::isUnicodeSpace failed"); + AXASSERT(!StringUtils::isUnicodeSpace(0xFFFF), "StringUtils::isUnicodeSpace failed"); - CCASSERT(!StringUtils::isCJKUnicode(0xFFFF) && StringUtils::isCJKUnicode(0x3100), + AXASSERT(!StringUtils::isCJKUnicode(0xFFFF) && StringUtils::isCJKUnicode(0x3100), "StringUtils::isCJKUnicode failed"); } @@ -1449,7 +1449,7 @@ static void __checkMathUtilResult(const char* description, const float* a1, cons { log("Wrong: a1[%d]=%f, a2[%d]=%f", i, a1[i], i, a2[i]); } - CCASSERT(r, "The optimized instruction is implemented in a wrong way, please check it!"); + AXASSERT(r, "The optimized instruction is implemented in a wrong way, please check it!"); } } diff --git a/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp b/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp index 996f147e80..0992449398 100644 --- a/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp +++ b/tests/cpp-tests/Classes/UserDefaultTest/UserDefaultTest.cpp @@ -69,7 +69,7 @@ UserDefaultTest::UserDefaultTest() // ss << buffer[i] << " "; // } // -// CCLOG("%s is %s", key, ss.str().c_str()); +// AXLOG("%s is %s", key, ss.str().c_str()); // } // template diff --git a/tests/cpp-tests/Classes/ZipTest/ZipTests.cpp b/tests/cpp-tests/Classes/ZipTest/ZipTests.cpp index 696e91d650..4cb246174c 100644 --- a/tests/cpp-tests/Classes/ZipTest/ZipTests.cpp +++ b/tests/cpp-tests/Classes/ZipTest/ZipTests.cpp @@ -64,11 +64,11 @@ static void unzipTest(Label* label, if (fu->isFileExist(newLocal)) { - CCLOG("Remove file %s", newLocal.c_str()); + AXLOG("Remove file %s", newLocal.c_str()); fu->removeFile(newLocal); } - CCLOG("Copy %s to %s", zipFile.data(), newLocal.c_str()); + AXLOG("Copy %s to %s", zipFile.data(), newLocal.c_str()); auto writeSuccess = fu->writeDataToFile(fu->getDataFromFile(zipFile), newLocal); if (!writeSuccess) { @@ -79,7 +79,7 @@ static void unzipTest(Label* label, unzFile fp = unzOpen(newLocal.c_str()); if (!fp) { - CCLOG("Failed to open zip file %s", newLocal.c_str()); + AXLOG("Failed to open zip file %s", newLocal.c_str()); label->setString("Failed to open zip file"); return; } @@ -93,7 +93,7 @@ static void unzipTest(Label* label, unzGetCurrentFileInfo(fp, &fileInfo, fileName, sizeof(fileName) - 1, nullptr, 0, nullptr, 0); - CCASSERT(strncmp("10k.txt", fileName, 7) == 0, "file name should be 10k.txt"); + AXASSERT(strncmp("10k.txt", fileName, 7) == 0, "file name should be 10k.txt"); if (password.empty()) { diff --git a/tests/fairygui-tests/Classes/BasicsScene.cpp b/tests/fairygui-tests/Classes/BasicsScene.cpp index 8a8853689c..691849fcfc 100644 --- a/tests/fairygui-tests/Classes/BasicsScene.cpp +++ b/tests/fairygui-tests/Classes/BasicsScene.cpp @@ -133,7 +133,7 @@ void BasicsScene::playPopup() void BasicsScene::onClickMenu(EventContext* context) { GObject* itemObject = (GObject*)context->getData(); - CCLOG("click %s", itemObject->getText().c_str()); + AXLOG("click %s", itemObject->getText().c_str()); } void BasicsScene::playWindow() diff --git a/tests/fairygui-tests/Classes/TreeViewScene.cpp b/tests/fairygui-tests/Classes/TreeViewScene.cpp index 37da86bb5a..f825c0eb6d 100644 --- a/tests/fairygui-tests/Classes/TreeViewScene.cpp +++ b/tests/fairygui-tests/Classes/TreeViewScene.cpp @@ -59,7 +59,7 @@ void TreeViewScene::continueInit() void TreeViewScene::onClickNode(EventContext* context) { GTreeNode* node = ((GObject*)context->getData())->treeNode(); - CCLOG("click node %s", node->getText().c_str()); + AXLOG("click node %s", node->getText().c_str()); } void TreeViewScene::renderTreeNode(GTreeNode* node, GComponent* obj) diff --git a/tests/lua-tests/project/Classes/lua_assetsmanager_test_sample.cpp b/tests/lua-tests/project/Classes/lua_assetsmanager_test_sample.cpp index e7ccc209c0..667170f1f2 100644 --- a/tests/lua-tests/project/Classes/lua_assetsmanager_test_sample.cpp +++ b/tests/lua-tests/project/Classes/lua_assetsmanager_test_sample.cpp @@ -67,7 +67,7 @@ static int lua_cocos2dx_createDownloadDir(lua_State* L) return 1; } - CCLOG("'createDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 0); + AXLOG("'createDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 0); return 0; } @@ -92,7 +92,7 @@ static int lua_cocos2dx_deleteDownloadDir(lua_State* L) #if AX_TARGET_OS_TVOS // Not implemented. "system" is not present on tvOS - CCLOG("'lua_cocos2dx_deleteDownloadDir' not implemented on tvOS"); + AXLOG("'lua_cocos2dx_deleteDownloadDir' not implemented on tvOS"); return 0; #endif @@ -100,7 +100,7 @@ static int lua_cocos2dx_deleteDownloadDir(lua_State* L) return 0; } - CCLOG("'resetDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 1); + AXLOG("'resetDownloadDir' function wrong number of arguments: %d, was expecting %d\n", argc, 1); return 0; #if COCOS2D_DEBUG >= 1 @@ -132,7 +132,7 @@ static int lua_cocos2dx_addSearchPath(lua_State* L) FileUtils::getInstance()->addSearchPath(pathToSave, before); return 0; } - CCLOG("'addSearchPath' function wrong number of arguments: %d, was expecting %d\n", argc, 2); + AXLOG("'addSearchPath' function wrong number of arguments: %d, was expecting %d\n", argc, 2); return 0; #if COCOS2D_DEBUG >= 1 diff --git a/tests/lua-tests/project/Classes/lua_test_bindings.cpp b/tests/lua-tests/project/Classes/lua_test_bindings.cpp index 23625cf6a5..260ce65393 100644 --- a/tests/lua-tests/project/Classes/lua_test_bindings.cpp +++ b/tests/lua-tests/project/Classes/lua_test_bindings.cpp @@ -131,7 +131,7 @@ DrawNode3D* DrawNode3D::create() void DrawNode3D::ensureCapacity(int count) { - CCASSERT(count >= 0, "capacity must be >= 0"); + AXASSERT(count >= 0, "capacity must be >= 0"); if (_buffer.size() + count > _buffer.capacity()) { @@ -316,12 +316,12 @@ ValueTypeJudgeInTable* ValueTypeJudgeInTable::create(ValueMap valueMap) Value::Type type = iter.second.getTypeFamily(); if (type == Value::Type::STRING) { - CCLOG("The type of index %d is string", index); + AXLOG("The type of index %d is string", index); } if (type == Value::Type::INTEGER || type == Value::Type::DOUBLE || type == Value::Type::FLOAT) { - CCLOG("The type of index %d is number", index); + AXLOG("The type of index %d is number", index); } ++index; @@ -365,7 +365,7 @@ int lua_cocos2dx_DrawNode3D_getBlendFunc(lua_State* L) blendfunc_to_luaval(L, ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:getBlendFunc", argc, 0); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:getBlendFunc", argc, 0); return 0; #if COCOS2D_DEBUG >= 1 @@ -416,7 +416,7 @@ int lua_cocos2dx_DrawNode3D_setBlendFunc(lua_State* L) return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:setBlendFunc", argc, 1); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:setBlendFunc", argc, 1); return 0; #if COCOS2D_DEBUG >= 1 @@ -469,7 +469,7 @@ int lua_cocos2dx_DrawNode3D_drawLine(lua_State* L) cobj->drawLine(arg0, arg1, arg2); return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawLine", argc, 3); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawLine", argc, 3); return 0; #if COCOS2D_DEBUG >= 1 @@ -513,7 +513,7 @@ int lua_cocos2dx_DrawNode3D_clear(lua_State* L) cobj->clear(); return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:clear", argc, 0); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:clear", argc, 0); return 0; #if COCOS2D_DEBUG >= 1 @@ -591,7 +591,7 @@ int lua_cocos2dx_DrawNode3D_drawCube(lua_State* L) cobj->drawCube(&arg0[0], arg1); return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawCube", argc, 2); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "ax.DrawNode3D:drawCube", argc, 2); return 0; #if COCOS2D_DEBUG >= 1 @@ -626,7 +626,7 @@ int lua_cocos2dx_DrawNode3D_create(lua_State* L) object_to_luaval(L, "ax.DrawNode3D", (axis::DrawNode3D*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.DrawNode3D:create", argc, 0); + AXLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.DrawNode3D:create", argc, 0); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: @@ -680,7 +680,7 @@ int lua_cocos2dx_ValueTypeJudgeInTable_create(lua_State* L) (axis::ValueTypeJudgeInTable*)ret); return 1; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.ValueTypeJudgeInTable:create", argc, 1); + AXLOG("%s has wrong number of arguments: %d, was expecting %d\n ", "ax.ValueTypeJudgeInTable:create", argc, 1); return 0; #if COCOS2D_DEBUG >= 1 tolua_lerror: diff --git a/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua b/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua index ed2ea46a72..dcfc5804f5 100644 --- a/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua +++ b/tests/lua-tests/src/NewEventDispatcherTest/NewEventDispatcherTest.lua @@ -910,7 +910,7 @@ function RemoveListenerAfterAddingTest:onEnter() local function item1Callback(tag, sender) local function onTouchBegan(touch, event) - CCASSERT(false, "Should not come here!") + AXASSERT(false, "Should not come here!") return true end diff --git a/tools/bindings-generator/targets/lua/templates/public_field.c b/tools/bindings-generator/targets/lua/templates/public_field.c index bfa3ff7c96..33daeceb3d 100644 --- a/tools/bindings-generator/targets/lua/templates/public_field.c +++ b/tools/bindings-generator/targets/lua/templates/public_field.c @@ -89,7 +89,7 @@ int ${signature_name}_set${name}(lua_State* tolua_S) return 0; } - CCLOG("%s has wrong number of arguments: %d, was expecting %d \n", "${generator.scriptname_from_native($namespaced_class_name, $namespace_name)}:${name}",argc, 1); + AXLOG("%s has wrong number of arguments: %d, was expecting %d \n", "${generator.scriptname_from_native($namespaced_class_name, $namespace_name)}:${name}",argc, 1); return 0; \#if COCOS2D_DEBUG >= 1