Merge pull request #751 from dumganhar/jsb2.0

JSB2.0 for Creator
This commit is contained in:
Wang Nan
2017-08-17 16:04:19 +08:00
committed by GitHub
375 changed files with 97031 additions and 125320 deletions
File diff suppressed because it is too large Load Diff
-1
View File
@@ -30,7 +30,6 @@
#include "renderer/CCGLProgramCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCRenderState.h"
#include "base/CCDirector.h"
#include "base/CCStencilStateManager.hpp"
-5
View File
@@ -33,7 +33,6 @@ THE SOFTWARE.
#include "renderer/CCGLProgramCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCRenderState.h"
#include "renderer/CCTexture2D.h"
#include "platform/CCGL.h"
@@ -390,10 +389,8 @@ void Grid3D::beforeBlit()
CHECK_GL_ERROR_DEBUG();
glEnable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(true);
glDepthMask(true);
RenderState::StateBlock::_defaultState->setDepthWrite(true);
}
}
@@ -405,10 +402,8 @@ void Grid3D::afterBlit()
glEnable(GL_DEPTH_TEST);
else
glDisable(GL_DEPTH_TEST);
RenderState::StateBlock::_defaultState->setDepthTest(_oldDepthTestValue);
glDepthMask(_oldDepthWriteValue);
RenderState::StateBlock::_defaultState->setDepthWrite(_oldDepthWriteValue);
}
}
-1
View File
@@ -41,7 +41,6 @@ THE SOFTWARE.
#include "2d/CCComponent.h"
#include "renderer/CCGLProgram.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCMaterial.h"
#include "math/TransformUtils.h"
#include "editor-support/creator/CCCameraNode.h"
-1
View File
@@ -29,7 +29,6 @@ THE SOFTWARE.
#include "base/CCDirector.h"
#include "base/ccUTF8.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCFrameBuffer.h"
NS_CC_BEGIN
+19 -19
View File
@@ -1,20 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opengl32.lib;glew32.lib;libzlib.lib;libiconv.lib;freetype.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>
<ClCompile />
<ProjectReference>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup />
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ImportGroup Label="PropertySheets" />
<PropertyGroup Label="UserMacros" />
<PropertyGroup>
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup>
<Link>
<AdditionalDependencies>opengl32.lib;glew32.lib;libzlib.lib;libiconv.lib;freetype.lib;winmm.lib;ws2_32.lib;Psapi.lib;Iphlpapi.lib;Userenv.lib;%(AdditionalDependencies)</AdditionalDependencies>
<AdditionalLibraryDirectories>$(OutDir);%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
<IgnoreAllDefaultLibraries>false</IgnoreAllDefaultLibraries>
</Link>
<ClCompile />
<ProjectReference>
<UseLibraryDependencyInputs>false</UseLibraryDependencyInputs>
</ProjectReference>
</ItemDefinitionGroup>
<ItemGroup />
</Project>
-155
View File
@@ -200,8 +200,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClCompile Include="..\audio\win32\AudioDecoderOgg.cpp" />
<ClCompile Include="..\audio\win32\AudioEngine-win32.cpp" />
<ClCompile Include="..\audio\win32\AudioPlayer.cpp" />
<ClCompile Include="..\audio\win32\MciPlayer.cpp" />
<ClCompile Include="..\audio\win32\SimpleAudioEngine.cpp" />
<ClCompile Include="..\base\base64.cpp" />
<ClCompile Include="..\base\CCAsyncTaskPool.cpp" />
<ClCompile Include="..\base\CCAutoreleasePool.cpp" />
@@ -231,7 +229,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClCompile Include="..\base\CCStencilStateManager.cpp" />
<ClCompile Include="..\base\CCNS.cpp" />
<ClCompile Include="..\base\CCProfiling.cpp" />
<ClCompile Include="..\base\CCProperties.cpp" />
<ClCompile Include="..\base\ccRandom.cpp" />
<ClCompile Include="..\base\CCRef.cpp" />
<ClCompile Include="..\base\CCScheduler.cpp" />
@@ -248,68 +245,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClCompile Include="..\base\TGAlib.cpp" />
<ClCompile Include="..\base\ZipUtils.cpp" />
<ClCompile Include="..\cocos2d.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBAnimationManager.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBFileLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBKeyframe.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBReader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBSequence.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCBSequenceProperty.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCControlButtonLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCControlLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCLabelBMFontLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCLabelTTFLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerColorLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerGradientLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCMenuItemImageLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCMenuItemLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCNode+CCBRelativePositioning.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCNodeLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCNodeLoaderLibrary.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCParticleSystemQuadLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCScale9SpriteLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCScrollViewLoader.cpp" />
<ClCompile Include="..\editor-support\cocosbuilder\CCSpriteLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCBoneNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCSkeletonNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCSkinNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCActionFrame.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCActionFrameEasing.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCActionManagerEx.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCActionNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCActionObject.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCArmature.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCArmatureAnimation.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCArmatureDataManager.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCArmatureDefine.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCBatchNode.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCBone.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCColliderDetector.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCComAttribute.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCComAudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCComController.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCComRender.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCDataReaderHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCDatas.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCDecorativeDisplay.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCDisplayFactory.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCDisplayManager.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCInputDelegate.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCComExtensionData.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCProcessBase.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCSkin.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCSpriteFrameCacheHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCTransformHelp.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp" />
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp" />
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp" />
<ClCompile Include="..\editor-support\cocostudio\WidgetCallBackHandlerProtocol.cpp" />
<ClCompile Include="..\editor-support\creator\CCCameraNode.cpp" />
<ClCompile Include="..\editor-support\creator\CCGraphicsNode.cpp" />
<ClCompile Include="..\editor-support\creator\CCScale9Sprite.cpp" />
@@ -352,29 +287,22 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClCompile Include="..\platform\win32\CCUtils-win32.cpp" />
<ClCompile Include="..\renderer\CCBatchCommand.cpp" />
<ClCompile Include="..\renderer\CCCustomCommand.cpp" />
<ClCompile Include="..\renderer\CCFrameBuffer.cpp" />
<ClCompile Include="..\renderer\CCGLProgram.cpp" />
<ClCompile Include="..\renderer\CCGLProgramCache.cpp" />
<ClCompile Include="..\renderer\CCGLProgramState.cpp" />
<ClCompile Include="..\renderer\CCGLProgramStateCache.cpp" />
<ClCompile Include="..\renderer\ccGLStateCache.cpp" />
<ClCompile Include="..\renderer\CCGroupCommand.cpp" />
<ClCompile Include="..\renderer\CCMaterial.cpp" />
<ClCompile Include="..\renderer\CCMeshCommand.cpp" />
<ClCompile Include="..\renderer\CCPass.cpp" />
<ClCompile Include="..\renderer\CCPrimitive.cpp" />
<ClCompile Include="..\renderer\CCPrimitiveCommand.cpp" />
<ClCompile Include="..\renderer\CCQuadCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderCommand.cpp" />
<ClCompile Include="..\renderer\CCRenderer.cpp" />
<ClCompile Include="..\renderer\CCRenderState.cpp" />
<ClCompile Include="..\renderer\ccShaders.cpp" />
<ClCompile Include="..\renderer\CCTechnique.cpp" />
<ClCompile Include="..\renderer\CCTexture2D.cpp" />
<ClCompile Include="..\renderer\CCTextureAtlas.cpp" />
<ClCompile Include="..\renderer\CCTextureCache.cpp" />
<ClCompile Include="..\renderer\CCTrianglesCommand.cpp" />
<ClCompile Include="..\renderer\CCVertexAttribBinding.cpp" />
<ClCompile Include="..\renderer\CCVertexIndexBuffer.cpp" />
<ClCompile Include="..\renderer\CCVertexIndexData.cpp" />
<ClCompile Include="..\storage\local-storage\LocalStorage.cpp" />
@@ -530,8 +458,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClInclude Include="..\..\external\sources\unzip\unzip.h" />
<ClInclude Include="..\..\external\sources\xxhash\xxhash.h" />
<ClInclude Include="..\audio\include\AudioEngine.h" />
<ClInclude Include="..\audio\include\Export.h" />
<ClInclude Include="..\audio\include\SimpleAudioEngine.h" />
<ClInclude Include="..\audio\win32\AudioCache.h" />
<ClInclude Include="..\audio\win32\AudioDecoder.h" />
<ClInclude Include="..\audio\win32\AudioDecoderManager.h" />
@@ -540,7 +466,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClInclude Include="..\audio\win32\AudioEngine-win32.h" />
<ClInclude Include="..\audio\win32\AudioMacros.h" />
<ClInclude Include="..\audio\win32\AudioPlayer.h" />
<ClInclude Include="..\audio\win32\MciPlayer.h" />
<ClInclude Include="..\base\base64.h" />
<ClInclude Include="..\base\CCAsyncTaskPool.h" />
<ClInclude Include="..\base\CCAutoreleasePool.h" />
@@ -575,7 +500,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClInclude Include="..\base\CCStencilStateManager.h" />
<ClInclude Include="..\base\CCNS.h" />
<ClInclude Include="..\base\CCProfiling.h" />
<ClInclude Include="..\base\CCProperties.h" />
<ClInclude Include="..\base\CCProtocols.h" />
<ClInclude Include="..\base\ccRandom.h" />
<ClInclude Include="..\base\CCRef.h" />
@@ -598,78 +522,6 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClInclude Include="..\base\utlist.h" />
<ClInclude Include="..\base\ZipUtils.h" />
<ClInclude Include="..\cocos2d.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBAnimationManager.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBFileLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBKeyframe.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBMemberVariableAssigner.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBReader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBSelectorResolver.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBSequence.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCBSequenceProperty.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCControlButtonLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCControlLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCLabelBMFontLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCLabelTTFLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerColorLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerGradientLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuItemImageLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuItemLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCNode+CCBRelativePositioning.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoaderLibrary.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoaderListener.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCParticleSystemQuadLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCScale9SpriteLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCScrollViewLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CCSpriteLoader.h" />
<ClInclude Include="..\editor-support\cocosbuilder\CocosBuilder.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCBoneNode.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCSkeletonNode.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCSkinNode.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h" />
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h" />
<ClInclude Include="..\editor-support\cocostudio\CCActionFrame.h" />
<ClInclude Include="..\editor-support\cocostudio\CCActionFrameEasing.h" />
<ClInclude Include="..\editor-support\cocostudio\CCActionManagerEx.h" />
<ClInclude Include="..\editor-support\cocostudio\CCActionNode.h" />
<ClInclude Include="..\editor-support\cocostudio\CCActionObject.h" />
<ClInclude Include="..\editor-support\cocostudio\CCArmature.h" />
<ClInclude Include="..\editor-support\cocostudio\CCArmatureAnimation.h" />
<ClInclude Include="..\editor-support\cocostudio\CCArmatureDataManager.h" />
<ClInclude Include="..\editor-support\cocostudio\CCArmatureDefine.h" />
<ClInclude Include="..\editor-support\cocostudio\CCBatchNode.h" />
<ClInclude Include="..\editor-support\cocostudio\CCBone.h" />
<ClInclude Include="..\editor-support\cocostudio\CCColliderDetector.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComAttribute.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComAudio.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComBase.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComController.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComRender.h" />
<ClInclude Include="..\editor-support\cocostudio\CCDataReaderHelper.h" />
<ClInclude Include="..\editor-support\cocostudio\CCDatas.h" />
<ClInclude Include="..\editor-support\cocostudio\CCDecorativeDisplay.h" />
<ClInclude Include="..\editor-support\cocostudio\CCDisplayFactory.h" />
<ClInclude Include="..\editor-support\cocostudio\CCDisplayManager.h" />
<ClInclude Include="..\editor-support\cocostudio\CCInputDelegate.h" />
<ClInclude Include="..\editor-support\cocostudio\CCComExtensionData.h" />
<ClInclude Include="..\editor-support\cocostudio\CCProcessBase.h" />
<ClInclude Include="..\editor-support\cocostudio\CCSkin.h" />
<ClInclude Include="..\editor-support\cocostudio\CCSpriteFrameCacheHelper.h" />
<ClInclude Include="..\editor-support\cocostudio\CCTransformHelp.h" />
<ClInclude Include="..\editor-support\cocostudio\CCTween.h" />
<ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h" />
<ClInclude Include="..\editor-support\cocostudio\CocosStudioExport.h" />
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h" />
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h" />
<ClInclude Include="..\editor-support\cocostudio\WidgetCallBackHandlerProtocol.h" />
<ClInclude Include="..\editor-support\creator\CCCameraNode.h" />
<ClInclude Include="..\editor-support\creator\CCGraphicsNode.h" />
<ClInclude Include="..\editor-support\creator\CCScale9Sprite.h" />
@@ -725,30 +577,23 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)"
<ClInclude Include="..\platform\win32\compat\stdint.h" />
<ClInclude Include="..\renderer\CCBatchCommand.h" />
<ClInclude Include="..\renderer\CCCustomCommand.h" />
<ClInclude Include="..\renderer\CCFrameBuffer.h" />
<ClInclude Include="..\renderer\CCGLProgram.h" />
<ClInclude Include="..\renderer\CCGLProgramCache.h" />
<ClInclude Include="..\renderer\CCGLProgramState.h" />
<ClInclude Include="..\renderer\CCGLProgramStateCache.h" />
<ClInclude Include="..\renderer\ccGLStateCache.h" />
<ClInclude Include="..\renderer\CCGroupCommand.h" />
<ClInclude Include="..\renderer\CCMaterial.h" />
<ClInclude Include="..\renderer\CCMeshCommand.h" />
<ClInclude Include="..\renderer\CCPass.h" />
<ClInclude Include="..\renderer\CCPrimitive.h" />
<ClInclude Include="..\renderer\CCPrimitiveCommand.h" />
<ClInclude Include="..\renderer\CCQuadCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommand.h" />
<ClInclude Include="..\renderer\CCRenderCommandPool.h" />
<ClInclude Include="..\renderer\CCRenderer.h" />
<ClInclude Include="..\renderer\CCRenderState.h" />
<ClInclude Include="..\renderer\ccShaders.h" />
<ClInclude Include="..\renderer\CCTechnique.h" />
<ClInclude Include="..\renderer\CCTexture2D.h" />
<ClInclude Include="..\renderer\CCTextureAtlas.h" />
<ClInclude Include="..\renderer\CCTextureCache.h" />
<ClInclude Include="..\renderer\CCTrianglesCommand.h" />
<ClInclude Include="..\renderer\CCVertexAttribBinding.h" />
<ClInclude Include="..\renderer\CCVertexIndexBuffer.h" />
<ClInclude Include="..\renderer\CCVertexIndexData.h" />
<ClInclude Include="..\storage\local-storage\LocalStorage.h" />
+3 -528
View File
@@ -46,12 +46,6 @@
<Filter Include="storage">
<UniqueIdentifier>{44bdf58f-4af2-433c-b4af-58dc05ef96b5}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio">
<UniqueIdentifier>{dbdbbfad-71fc-4f1d-a809-b43651f87267}</UniqueIdentifier>
</Filter>
<Filter Include="cocosdenshion">
<UniqueIdentifier>{3bd71d42-dfa4-4649-bb01-ad607fdca1c2}</UniqueIdentifier>
</Filter>
<Filter Include="ui">
<UniqueIdentifier>{704c4ce6-b7ad-4406-9414-71169734bbc1}</UniqueIdentifier>
</Filter>
@@ -64,12 +58,6 @@
<Filter Include="extension\GUI\CCScrollView">
<UniqueIdentifier>{a1f539bc-d5be-4224-a4d2-01c0b6f17d6e}</UniqueIdentifier>
</Filter>
<Filter Include="cocosdenshion\Header Files">
<UniqueIdentifier>{f42979de-0079-4eba-b469-81ebff9ec588}</UniqueIdentifier>
</Filter>
<Filter Include="cocosdenshion\Source Files">
<UniqueIdentifier>{f42ec238-cddc-475a-b343-6d0984cb9681}</UniqueIdentifier>
</Filter>
<Filter Include="network">
<UniqueIdentifier>{31338a7d-ebe1-4867-9c17-d3645122a864}</UniqueIdentifier>
</Filter>
@@ -94,51 +82,6 @@
<Filter Include="ui\UIWidgets\ScrollWidget">
<UniqueIdentifier>{6ac0e3c8-d5b1-44d9-8c41-21662a767cc6}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\TimelineAction">
<UniqueIdentifier>{c75d4c37-d555-4a5b-a0ba-4bc9a3d846e1}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\json">
<UniqueIdentifier>{a9901b6a-0c7b-4adb-8e17-105c872d744d}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\json\rapidjson">
<UniqueIdentifier>{a9a3bf20-9daf-465d-9525-cce2ab0d85a3}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\json\rapidjson\internal">
<UniqueIdentifier>{0cf2210c-3544-41ed-9d4e-88987a1c7bcf}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\components">
<UniqueIdentifier>{dc6e53e4-e518-403f-b2a9-97f6f7cd0961}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature">
<UniqueIdentifier>{22a4587f-d4ca-44fa-a734-ded122cd79e5}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature\animation">
<UniqueIdentifier>{137efcbb-0d14-4f1c-a856-7b1669a6d2af}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature\datas">
<UniqueIdentifier>{4825cd2d-ca8b-434c-8c79-2d3d3258086f}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature\display">
<UniqueIdentifier>{57ba2fcb-04bd-4b2f-9ae6-375992ad363a}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature\physics">
<UniqueIdentifier>{acdfaa6f-1374-4611-a5e7-9038dc6900c4}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\armature\utils">
<UniqueIdentifier>{f195e2f1-1030-4848-9498-f8142bf89009}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\action">
<UniqueIdentifier>{d48c8016-e933-48dd-a5c0-202b0a84b82a}</UniqueIdentifier>
</Filter>
<Filter Include="cocosbuilder">
<UniqueIdentifier>{e25a6c9d-eaf2-446f-b9b2-d89fd21a9bdd}</UniqueIdentifier>
</Filter>
<Filter Include="cocosbuilder\Header Files">
<UniqueIdentifier>{bbba68d3-e519-4e06-8a01-d8ee89b544f2}</UniqueIdentifier>
</Filter>
<Filter Include="cocosbuilder\Source Files">
<UniqueIdentifier>{8579ed15-b266-4f80-818d-a3a9251c4248}</UniqueIdentifier>
</Filter>
<Filter Include="ui\UIWidgets\EditBox">
<UniqueIdentifier>{89eb6312-dc7f-4fda-b9b2-ab67c31ddd55}</UniqueIdentifier>
</Filter>
@@ -160,9 +103,6 @@
<Filter Include="external\clipper">
<UniqueIdentifier>{ff65e340-b79d-4f87-9b4c-ed46bda5d20f}</UniqueIdentifier>
</Filter>
<Filter Include="cocostudio\TimelineAction\Skeleton">
<UniqueIdentifier>{ca5e1475-3bfd-4aae-ad54-2e19d5021b92}</UniqueIdentifier>
</Filter>
<Filter Include="creator">
<UniqueIdentifier>{691a1234-91c6-4c12-992d-3973f4da830f}</UniqueIdentifier>
</Filter>
@@ -595,9 +535,6 @@
<ClCompile Include="..\base\CCIMEDispatcher.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCMeshCommand.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\base\ObjectFactory.cpp">
<Filter>base</Filter>
</ClCompile>
@@ -640,21 +577,12 @@
<ClCompile Include="..\..\extensions\GUI\CCScrollView\CCTableViewCell.cpp">
<Filter>extension\GUI\CCScrollView</Filter>
</ClCompile>
<ClCompile Include="..\audio\win32\MciPlayer.cpp">
<Filter>cocosdenshion\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\audio\win32\SimpleAudioEngine.cpp">
<Filter>cocosdenshion\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\network\HttpClient.cpp">
<Filter>network\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\network\SocketIO.cpp">
<Filter>network\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\network\WebSocket-libwebsockets.cpp">
<Filter>network\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ui\UIScale9Sprite.cpp">
<Filter>ui\BaseClasses</Filter>
</ClCompile>
@@ -736,171 +664,6 @@
<ClCompile Include="..\ui\UIScrollViewBar.cpp">
<Filter>ui\UIWidgets\ScrollWidget</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.cpp">
<Filter>cocostudio\TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.cpp">
<Filter>cocostudio\TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.cpp">
<Filter>cocostudio\TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoLoader.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\DictionaryHelper.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCComAttribute.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCComAudio.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCComController.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCComRender.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCInputDelegate.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCArmature.cpp">
<Filter>cocostudio\armature</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCBone.cpp">
<Filter>cocostudio\armature</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCArmatureAnimation.cpp">
<Filter>cocostudio\armature\animation</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCProcessBase.cpp">
<Filter>cocostudio\armature\animation</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCTween.cpp">
<Filter>cocostudio\armature\animation</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCDatas.cpp">
<Filter>cocostudio\armature\datas</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCBatchNode.cpp">
<Filter>cocostudio\armature\display</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCDecorativeDisplay.cpp">
<Filter>cocostudio\armature\display</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCDisplayFactory.cpp">
<Filter>cocostudio\armature\display</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCDisplayManager.cpp">
<Filter>cocostudio\armature\display</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCSkin.cpp">
<Filter>cocostudio\armature\display</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCColliderDetector.cpp">
<Filter>cocostudio\armature\physics</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCArmatureDataManager.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCArmatureDefine.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCDataReaderHelper.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCSpriteFrameCacheHelper.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCTransformHelp.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCUtilMath.cpp">
<Filter>cocostudio\armature\utils</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCActionFrame.cpp">
<Filter>cocostudio\action</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCActionFrameEasing.cpp">
<Filter>cocostudio\action</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCActionManagerEx.cpp">
<Filter>cocostudio\action</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCActionNode.cpp">
<Filter>cocostudio\action</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCActionObject.cpp">
<Filter>cocostudio\action</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBAnimationManager.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBFileLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBKeyframe.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBReader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBSequence.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCBSequenceProperty.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCControlButtonLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCControlLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCLabelBMFontLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCLabelTTFLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerColorLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerGradientLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCLayerLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCMenuItemImageLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCMenuItemLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCNode+CCBRelativePositioning.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCNodeLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCNodeLoaderLibrary.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCParticleSystemQuadLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCScale9SpriteLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCScrollViewLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocosbuilder\CCSpriteLoader.cpp">
<Filter>cocosbuilder\Source Files</Filter>
</ClCompile>
<ClCompile Include="..\ui\UIEditBox\UIEditBox.cpp">
<Filter>ui\UIWidgets\EditBox</Filter>
</ClCompile>
@@ -967,18 +730,9 @@
<ClCompile Include="..\ui\UILayoutComponent.cpp">
<Filter>ui\Layouts</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\WidgetCallBackHandlerProtocol.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.cpp">
<Filter>cocostudio\TimelineAction</Filter>
</ClCompile>
<ClCompile Include="..\base\CCAsyncTaskPool.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CocoStudio.cpp">
<Filter>cocostudio\json</Filter>
</ClCompile>
<ClCompile Include="..\..\external\sources\poly2tri\common\shapes.cc">
<Filter>external\poly2tri\common</Filter>
</ClCompile>
@@ -994,24 +748,6 @@
<ClCompile Include="..\..\external\sources\poly2tri\sweep\sweep_context.cc">
<Filter>external\poly2tri\sweep</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCPass.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCRenderState.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCTechnique.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCMaterial.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\base\CCProperties.cpp">
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\renderer\CCVertexAttribBinding.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="..\base\CCNinePatchImageParser.cpp">
<Filter>base</Filter>
</ClCompile>
@@ -1019,27 +755,12 @@
<Filter>base</Filter>
</ClCompile>
<ClCompile Include="..\base\CCNinePatchImageParser.cpp" />
<ClCompile Include="..\renderer\CCFrameBuffer.cpp">
<Filter>renderer</Filter>
</ClCompile>
<ClCompile Include="CCAutoPolygon.cpp">
<Filter>2d</Filter>
</ClCompile>
<ClCompile Include="..\..\external\sources\clipper\clipper.cpp">
<Filter>external\clipper</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCBoneNode.cpp">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCSkeletonNode.cpp">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\ActionTimeline\CCSkinNode.cpp">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClCompile>
<ClCompile Include="..\editor-support\cocostudio\CCComExtensionData.cpp">
<Filter>cocostudio\components</Filter>
</ClCompile>
<ClCompile Include="..\network\CCDownloader.cpp">
<Filter>network\Source Files</Filter>
</ClCompile>
@@ -1143,6 +864,9 @@
<ClCompile Include="..\ui\UIEditBox\UIEditBoxImpl-common.cpp">
<Filter>ui\UIWidgets\EditBox</Filter>
</ClCompile>
<ClCompile Include="..\network\WebSocket-libwebsockets.cpp">
<Filter>network\Source Files</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\cocos2d.h" />
@@ -1590,9 +1314,6 @@
<ClInclude Include="..\base\CCIMEDispatcher.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCMeshCommand.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\base\ObjectFactory.h">
<Filter>base</Filter>
</ClInclude>
@@ -1644,15 +1365,6 @@
<ClInclude Include="..\..\extensions\ExtensionMacros.h">
<Filter>extension</Filter>
</ClInclude>
<ClInclude Include="..\audio\include\Export.h">
<Filter>cocosdenshion\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\audio\win32\MciPlayer.h">
<Filter>cocosdenshion\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\audio\include\SimpleAudioEngine.h">
<Filter>cocosdenshion\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\network\HttpClient.h">
<Filter>network\Header Files</Filter>
</ClInclude>
@@ -1740,198 +1452,6 @@
<ClInclude Include="..\ui\UIScrollView.h">
<Filter>ui\UIWidgets\ScrollWidget</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CocosStudioExport.h">
<Filter>cocostudio</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimeline.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCFrame.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimeLine.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCTimelineMacro.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CocoLoader.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CocoStudio.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\DictionaryHelper.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComAttribute.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComAudio.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComBase.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComController.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComRender.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCInputDelegate.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCArmature.h">
<Filter>cocostudio\armature</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCBone.h">
<Filter>cocostudio\armature</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCArmatureAnimation.h">
<Filter>cocostudio\armature\animation</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCProcessBase.h">
<Filter>cocostudio\armature\animation</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCTween.h">
<Filter>cocostudio\armature\animation</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCDatas.h">
<Filter>cocostudio\armature\datas</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCBatchNode.h">
<Filter>cocostudio\armature\display</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCDecorativeDisplay.h">
<Filter>cocostudio\armature\display</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCDisplayFactory.h">
<Filter>cocostudio\armature\display</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCDisplayManager.h">
<Filter>cocostudio\armature\display</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCSkin.h">
<Filter>cocostudio\armature\display</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCColliderDetector.h">
<Filter>cocostudio\armature\physics</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCArmatureDataManager.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCArmatureDefine.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCDataReaderHelper.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCSpriteFrameCacheHelper.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCTransformHelp.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCUtilMath.h">
<Filter>cocostudio\armature\utils</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCActionFrame.h">
<Filter>cocostudio\action</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCActionFrameEasing.h">
<Filter>cocostudio\action</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCActionManagerEx.h">
<Filter>cocostudio\action</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCActionNode.h">
<Filter>cocostudio\action</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCActionObject.h">
<Filter>cocostudio\action</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBAnimationManager.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBFileLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBKeyframe.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBMemberVariableAssigner.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBReader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBSelectorResolver.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBSequence.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCBSequenceProperty.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCControlButtonLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCControlLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCLabelBMFontLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCLabelTTFLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerColorLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerGradientLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCLayerLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuItemImageLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuItemLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCMenuLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCNode+CCBRelativePositioning.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoaderLibrary.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCNodeLoaderListener.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCParticleSystemQuadLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCScale9SpriteLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCScrollViewLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CCSpriteLoader.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocosbuilder\CocosBuilder.h">
<Filter>cocosbuilder\Header Files</Filter>
</ClInclude>
<ClInclude Include="..\ui\UIEditBox\UIEditBox.h">
<Filter>ui\UIWidgets\EditBox</Filter>
</ClInclude>
@@ -2007,18 +1527,6 @@
<ClInclude Include="..\ui\UILayoutComponent.h">
<Filter>ui\Layouts</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CSParseBinary_generated.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CSParse3DBinary_generated.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\WidgetCallBackHandlerProtocol.h">
<Filter>cocostudio\json</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCActionTimelineNode.h">
<Filter>cocostudio\TimelineAction</Filter>
</ClInclude>
<ClInclude Include="..\base\CCAsyncTaskPool.h">
<Filter>base</Filter>
</ClInclude>
@@ -2028,24 +1536,6 @@
<ClInclude Include="..\platform\CCPlatformMacros.h">
<Filter>platform</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCPass.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCRenderState.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCTechnique.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCMaterial.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\base\CCProperties.h">
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\renderer\CCVertexAttribBinding.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="..\base\CCNinePatchImageParser.h">
<Filter>base</Filter>
</ClInclude>
@@ -2053,27 +1543,12 @@
<Filter>base</Filter>
</ClInclude>
<ClInclude Include="..\base\CCNinePatchImageParser.h" />
<ClInclude Include="..\renderer\CCFrameBuffer.h">
<Filter>renderer</Filter>
</ClInclude>
<ClInclude Include="CCAutoPolygon.h">
<Filter>2d</Filter>
</ClInclude>
<ClInclude Include="..\..\external\sources\clipper\clipper.hpp">
<Filter>external\clipper</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCBoneNode.h">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCSkeletonNode.h">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\ActionTimeline\CCSkinNode.h">
<Filter>cocostudio\TimelineAction\Skeleton</Filter>
</ClInclude>
<ClInclude Include="..\editor-support\cocostudio\CCComExtensionData.h">
<Filter>cocostudio\components</Filter>
</ClInclude>
<ClInclude Include="..\network\CCDownloader.h">
<Filter>network\Header Files</Filter>
</ClInclude>
+3 -8
View File
@@ -123,7 +123,6 @@ base/CCEventTouch.cpp \
base/CCIMEDispatcher.cpp \
base/CCNS.cpp \
base/CCProfiling.cpp \
base/CCProperties.cpp \
base/CCRef.cpp \
base/CCScheduler.cpp \
base/CCScriptSupport.cpp \
@@ -150,25 +149,18 @@ renderer/CCGLProgramCache.cpp \
renderer/CCGLProgramState.cpp \
renderer/CCGLProgramStateCache.cpp \
renderer/CCGroupCommand.cpp \
renderer/CCMaterial.cpp \
renderer/CCMeshCommand.cpp \
renderer/CCPass.cpp \
renderer/CCPrimitive.cpp \
renderer/CCPrimitiveCommand.cpp \
renderer/CCQuadCommand.cpp \
renderer/CCRenderCommand.cpp \
renderer/CCRenderState.cpp \
renderer/CCRenderer.cpp \
renderer/CCTechnique.cpp \
renderer/CCTexture2D.cpp \
renderer/CCTextureAtlas.cpp \
renderer/CCTextureCache.cpp \
renderer/CCTrianglesCommand.cpp \
renderer/CCVertexAttribBinding.cpp \
renderer/CCVertexIndexBuffer.cpp \
renderer/CCVertexIndexData.cpp \
renderer/ccGLStateCache.cpp \
renderer/CCFrameBuffer.cpp \
renderer/ccShaders.cpp \
storage/local-storage/LocalStorage-android.cpp \
../external/sources/ConvertUTF/ConvertUTFWrapper.cpp \
@@ -231,6 +223,7 @@ storage/local-storage/LocalStorage-android.cpp \
../external/sources/Box2D/Dynamics/b2World.cpp \
../external/sources/Box2D/Dynamics/b2WorldCallbacks.cpp \
../external/sources/Box2D/Rope/b2Rope.cpp \
../external/sources/Box2D/b2ObjectDestroyNotifier.cpp
LOCAL_C_INCLUDES := $(LOCAL_PATH) \
$(LOCAL_PATH)/platform \
@@ -295,6 +288,8 @@ include $(BUILD_STATIC_LIBRARY)
#==============================================================
#$(call import-module,.)
$(call import-module,android)
# $(call import-module,editor-support/cocostudio)
# $(call import-module,editor-support/cocosbuilder)
$(call import-module,editor-support/dragonbones/proj.android)
$(call import-module,editor-support/spine)
$(call import-module,editor-support/creator)
@@ -24,82 +24,6 @@
__BEGIN_DECLS
/*
* Bitmask Operations
*
* Note this doesn't provide any locking/exclusion, and isn't atomic.
* Additionally no bounds checking is done on the bitmask array.
*
* Example:
*
* int num_resources;
* unsigned int resource_bits[BITS_TO_WORDS(num_resources)];
* bitmask_init(resource_bits, num_resources);
* ...
* int bit = bitmask_ffz(resource_bits, num_resources);
* bitmask_set(resource_bits, bit);
* ...
* if (bitmask_test(resource_bits, bit)) { ... }
* ...
* bitmask_clear(resource_bits, bit);
*
*/
#define BITS_PER_WORD (sizeof(unsigned int) * 8)
#define BITS_TO_WORDS(x) (((x) + BITS_PER_WORD - 1) / BITS_PER_WORD)
#define BIT_IN_WORD(x) ((x) % BITS_PER_WORD)
#define BIT_WORD(x) ((x) / BITS_PER_WORD)
#define BIT_MASK(x) (1 << BIT_IN_WORD(x))
static inline void bitmask_init(unsigned int *bitmask, int num_bits)
{
memset(bitmask, 0, BITS_TO_WORDS(num_bits)*sizeof(unsigned int));
}
static inline int bitmask_ffz(unsigned int *bitmask, int num_bits)
{
int bit, result;
size_t i;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++) {
bit = ffs(~bitmask[i]);
if (bit) {
// ffs is 1-indexed, return 0-indexed result
bit--;
result = BITS_PER_WORD * i + bit;
if (result >= num_bits)
return -1;
return result;
}
}
return -1;
}
static inline int bitmask_weight(unsigned int *bitmask, int num_bits)
{
size_t i;
int weight = 0;
for (i = 0; i < BITS_TO_WORDS(num_bits); i++)
weight += __builtin_popcount(bitmask[i]);
return weight;
}
static inline void bitmask_set(unsigned int *bitmask, int bit)
{
bitmask[BIT_WORD(bit)] |= BIT_MASK(bit);
}
static inline void bitmask_clear(unsigned int *bitmask, int bit)
{
bitmask[BIT_WORD(bit)] &= ~BIT_MASK(bit);
}
static inline bool bitmask_test(unsigned int *bitmask, int bit)
{
return bitmask[BIT_WORD(bit)] & BIT_MASK(bit);
}
static inline int popcount(unsigned int x)
{
return __builtin_popcount(x);
+1 -1
View File
@@ -38,7 +38,7 @@
#include <OpenalSoft/al.h>
#endif
#include "platform/CCPlatformMacros.h"
#include "audio/apple/AudioMacros.h"
#include "audio/win32/AudioMacros.h"
NS_CC_BEGIN
namespace experimental{
+1 -1
View File
@@ -90,7 +90,7 @@ bool Configuration::init()
Configuration::~Configuration()
{
CC_SAFE_DELETE(_loadedEvent);
CC_SAFE_RELEASE(_loadedEvent);
}
std::string Configuration::getInfo() const
+7 -23
View File
@@ -47,8 +47,6 @@ THE SOFTWARE.
#include "renderer/CCTextureCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCRenderState.h"
#include "renderer/CCFrameBuffer.h"
#include "base/CCUserDefault.h"
#include "base/ccFPSImages.h"
#include "base/CCScheduler.h"
@@ -144,7 +142,6 @@ bool Director::init(void)
_winSizeInPoints = Size::ZERO;
_openGLView = nullptr;
_defaultFBO = nullptr;
_contentScaleFactor = 1.0f;
@@ -173,7 +170,6 @@ bool Director::init(void)
initMatrixStack();
_renderer = new (std::nothrow) Renderer;
RenderState::initialize();
return true;
}
@@ -190,14 +186,13 @@ Director::~Director(void)
CC_SAFE_RELEASE(_notificationNode);
CC_SAFE_RELEASE(_scheduler);
CC_SAFE_RELEASE(_actionManager);
CC_SAFE_DELETE(_defaultFBO);
delete _eventBeforeUpdate;
delete _eventAfterUpdate;
delete _eventAfterDraw;
delete _eventAfterVisit;
delete _eventProjectionChanged;
delete _eventResetDirector;
CC_SAFE_RELEASE(_eventBeforeUpdate);
CC_SAFE_RELEASE(_eventAfterUpdate);
CC_SAFE_RELEASE(_eventAfterDraw);
CC_SAFE_RELEASE(_eventAfterVisit);
CC_SAFE_RELEASE(_eventProjectionChanged);
CC_SAFE_RELEASE(_eventResetDirector);
delete _renderer;
@@ -276,7 +271,7 @@ void Director::drawScene()
}
_renderer->clear();
experimental::FrameBuffer::clearAllFBOs();
/* to avoid flickr, nextScene MUST be here: after tick and before draw.
* FIXME: Which bug is this one. It seems that it can't be reproduced with v0.9
*/
@@ -392,9 +387,6 @@ void Director::setOpenGLView(GLView *openGLView)
{
_eventDispatcher->setEnabled(true);
}
_defaultFBO = experimental::FrameBuffer::getOrCreateDefaultFBO(_openGLView);
_defaultFBO->retain();
}
}
@@ -683,9 +675,6 @@ void Director::setDepthTest(bool on)
void Director::setClearColor(const Color4F& clearColor)
{
_renderer->setClearColor(clearColor);
auto defaultFBO = experimental::FrameBuffer::getOrCreateDefaultFBO(_openGLView);
if(defaultFBO) defaultFBO->setClearColor(clearColor);
}
static void GLToClipTransform(Mat4 *transformOut)
@@ -1035,8 +1024,6 @@ void Director::reset()
GL::invalidateStateCache();
RenderState::finalize();
destroyTextureCache();
}
@@ -1061,9 +1048,6 @@ void Director::restartDirector()
{
reset();
// RenderState need to be reinitialized
RenderState::initialize();
// Texture cache need to be reinitialized
initTextureCache();
-3
View File
@@ -610,9 +610,6 @@ protected:
/* Renderer for the Director */
Renderer *_renderer;
/* Default FrameBufferObject*/
experimental::FrameBuffer* _defaultFBO;
/* Console for the director */
Console *_console;
+2 -2
View File
@@ -59,11 +59,11 @@ public:
CC_CONSTRUCTOR_ACCESS:
/** Constructor */
Event(Type type);
public:
protected:
/** Destructor.
*/
virtual ~Event();
public:
/** Gets the event type.
*
* @return The event type.
+1
View File
@@ -48,6 +48,7 @@ public:
EventAcceleration(const Acceleration& acc);
private:
virtual ~EventAcceleration() {}
Acceleration _acc;
friend class EventListenerAcceleration;
};
+2
View File
@@ -66,6 +66,8 @@ public:
*/
inline const std::string& getEventName() const { return _eventName; };
protected:
virtual ~EventCustom() {}
void* _userData; ///< User data
std::string _eventName;
};
+4 -3
View File
@@ -833,9 +833,10 @@ void EventDispatcher::dispatchEvent(Event* event)
void EventDispatcher::dispatchCustomEvent(const std::string &eventName, void *optionalUserData)
{
EventCustom ev(eventName);
ev.setUserData(optionalUserData);
dispatchEvent(&ev);
EventCustom* ev = new EventCustom(eventName);
ev->setUserData(optionalUserData);
dispatchEvent(ev);
ev->release();
}
bool EventDispatcher::hasEventListener(const EventListener::ListenerID& listenerID) const
+2
View File
@@ -54,6 +54,8 @@ public:
EventFocus(ui::Widget* widgetLoseFocus, ui::Widget* widgetGetFocus);
private:
virtual ~EventFocus() {}
ui::Widget *_widgetGetFocus;
ui::Widget *_widgetLoseFocus;
+2
View File
@@ -228,6 +228,8 @@ public:
EventKeyboard(KeyCode keyCode, bool isPressed);
private:
virtual ~EventKeyboard() {}
KeyCode _keyCode;
bool _isPressed;
+2
View File
@@ -174,6 +174,8 @@ public:
private:
virtual ~EventMouse() {}
MouseEventType _mouseEventType;
int _mouseButton;
float _x;
+2
View File
@@ -88,6 +88,8 @@ public:
#endif
private:
virtual ~EventTouch() {}
EventCode _eventCode;
std::vector<Touch*> _touches;
File diff suppressed because it is too large Load Diff
-615
View File
@@ -1,615 +0,0 @@
/**
Copyright 2013 BlackBerry Inc.
Copyright (c) 2015-2016 Chukong Technologies
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original file from GamePlay3D: http://gameplay3d.org
This file was modified to fit the cocos2d-x project
*/
#ifndef __cocos2d_libs__CCProperties__
#define __cocos2d_libs__CCProperties__
#include <string>
#include <functional>
#include <cstdint>
#include <vector>
#include "renderer/CCTexture2D.h"
#include "platform/CCPlatformMacros.h"
#include "base/CCRef.h"
#include "base/ccTypes.h"
#include "base/CCVector.h"
NS_CC_BEGIN
class Properties;
class Vec2;
class Vec3;
class Vec4;
class Mat4;
class Data;
class Data;
/**
* Defines a properties file for loading text files.
*
* A properties file has very simple syntax and can contain only namespaces and
* name/value pairs (the properties of a namespace).
* The file can have any file extension a user specifies.
*
* Here's an example of a simple
* file that uses all the available features of the markup language:
@verbatim
// This is a comment.
// This property is in the default namespace:
integerProperty = 5
// This line defines a namespace of type "mynamespace" without an ID:
mynamespace
{
// This namespace can be retrieved by searching for its ID, "spriteTexture",
// or by its name "texture":
texture spriteTexture
{
fileName = sprite.png
width = 64
height = 64
}
// This property is in the "space" namespace:
booleanProperty = true
// It's legal to have a name without a value if you leave out the '=' character:
foo
// In fact, the '=' character is optional if you'd rather write:
bar 23
// But don't write this or you'll get an error:
// illegalProperty =
// Or this:
// = 15
// Properties objects let you retrieve values as various types.
floatProperty = 3.333
stringProperty = This is a string.
vector3Property = 1.0, 5.0, 3.55
colorProperty = 1.0, 0.4, 0.0, 1.0
}
@endverbatim
* Retrieving information out of a file like this could be done in two ways. If the
* available namespaces and name/value pairs are known in advance they can be queried by ID or name.
* For example, if the namespace "spriteTexture" and its properties are required then they can
* be retrieved with a call to getNamespace() followed by calls to getString() and getInt().
* A namespace is stored and retrieved as a Properties object.
* Reading the spriteTexture properties out of the file above in this way could be done with the following code:
@verbatim
// Create the top-level Properties object.
Properties* properties = Properties::createNonRefCounted("example.properties");
// Retrieve the "spriteTexture" namespace.
Properties* spriteTexture = properties->getNamespace("spriteTexture");
// Get the values of known texture properties out of the namespace.
const char* fileName = spriteTexture->getString("fileName");
int width = spriteTexture->getInt("width");
int height = spriteTexture->getInt("height");
// Deleting the top-level Properties object will clean up all nested namespaces.
SAFE_DELETE(properties);
@endverbatim
* On the other hand, if the structure of the file is not known in advance its
* namespaces and name/value pairs can be retrieved one by one using the getNextNamespace()
* and getNextProperty() methods. The following method prints the contents of any properties file
* to the console:
@verbatim
void printProperties(Properties* properties)
{
// Print the name and ID of the current namespace.
const char* spacename = properties->getNamespace();
const char* id = properties->getId();
GP_WARN("Namespace: %s ID: %s\n{", spacename, id);
// Print all properties in this namespace.
const char* name = properties->getNextProperty();
const char* value = NULL;
while (name != NULL)
{
value = properties->getString(name);
GP_WARN("%s = %s", name, value);
name = properties->getNextProperty();
}
GP_WARN("}\n");
// Print the properties of every namespace within this one.
Properties* space = properties->getNextNamespace();
while (space != NULL)
{
printProperties(space);
space = properties->getNextNamespace();
}
}
@endverbatim
* Note that this method does not keep track of the namespace hierarchy, but could be
* modified to do so. Also note that nothing in a properties file indicates the type
* of a property. If the type is unknown, its string can be retrieved and interpreted
* as necessary.
*/
class CC_DLL Properties
{
public:
/**
* Data types supported by the properties class.
*/
enum Type
{
NONE,
STRING,
NUMBER,
VECTOR2,
VECTOR3,
VECTOR4,
MATRIX
};
/**
* Creates a Properties runtime settings from the specified URL, where the URL is of
* the format "<file-path>.<extension>#<namespace-id>/<namespace-id>/.../<namespace-id>"
* (and "#<namespace-id>/<namespace-id>/.../<namespace-id>" is optional).
*
* @param url The URL to create the properties from.
*
* @return The created Properties or NULL if there was an error.
* @script{create}
*/
static Properties* createNonRefCounted(const std::string& url);
/**
* Destructor.
*/
~Properties();
/**
* Get the name of the next property.
*
* If a valid next property is returned, the value of the property can be
* retrieved using any of the get methods in this class, passing NULL for
// the property name.
*
* @return The name of the next property, or NULL if there are no properties remaining.
*/
const char* getNextProperty();
/**
* Get the next namespace.
*/
Properties* getNextNamespace();
/**
* Rewind the getNextProperty() and getNextNamespace() iterators
* to the beginning of the file.
*/
void rewind();
/**
* Get a specific namespace by ID or name. This method will optionally
* perform a depth-first search on all namespaces and inner namespaces
* within this Property.
*
* @param id The ID or name of the namespace to find.
* @param searchNames If true, namespace names are used in the search,
* instead of namespace IDs. By default this parameter is false
* and namespace IDs are searched.
* @param recurse If true, perform a depth-first search, otherwise search
* only the immediate child namespaces.
*
* @return A properties object with the given ID or name.
*/
Properties* getNamespace(const char* id, bool searchNames = false, bool recurse = true) const;
/**
* Get the name of this Property's namespace.
*
* @return The name of this Property's namespace.
*/
const char* getNamespace() const;
/**
* Get the ID of this Property's namespace. The ID should be a unique identifier,
* but its uniqueness is not enforced.
*
* @return The ID of this Property's namespace.
*/
const char* getId() const;
/**
* Check if a property with the given name is specified in this Properties object.
*
* @param name The name of the property to query.
*
* @return True if the property exists, false otherwise.
*/
bool exists(const char* name) const;
/**
* Returns the type of a property.
*
* @param name The name of the property to interpret, or NULL to return the current property's type.
*
* @return The type of the property.
*/
Type getType(const char* name = NULL) const;
/**
* Get the value of the given property as a string. This can always be retrieved,
* whatever the intended type of the property.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param defaultValue The default value to return if the specified property does not exist.
*
* @return The value of the given property as a string, or the empty string if no property with that name exists.
*/
const char* getString(const char* name = NULL, const char* defaultValue = NULL) const;
/**
* Sets the value of the property with the specified name.
*
* If there is no property in this namespace with the current name,
* one is added. Otherwise, the value of the first property with the
* specified name is updated.
*
* If name is NULL, the value current property (see getNextProperty) is
* set, unless there is no current property, in which case false
* is returned.
*
* @param name The name of the property to set.
* @param value The property value.
*
* @return True if the property was set, false otherwise.
*/
bool setString(const char* name, const char* value);
/**
* Interpret the value of the given property as a boolean.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param defaultValue the default value to return if the specified property does not exist within the properties file.
*
* @return true if the property exists and its value is "true", otherwise false.
*/
bool getBool(const char* name = NULL, bool defaultValue = false) const;
/**
* Interpret the value of the given property as an integer.
* If the property does not exist, zero will be returned.
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
*
* @return The value of the given property interpreted as an integer.
* Zero if the property does not exist or could not be scanned.
*/
int getInt(const char* name = NULL) const;
/**
* Interpret the value of the given property as a floating-point number.
* If the property does not exist, zero will be returned.
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
*
* @return The value of the given property interpreted as a float.
* Zero if the property does not exist or could not be scanned.
*/
float getFloat(const char* name = NULL) const;
/**
* Interpret the value of the given property as a long integer.
* If the property does not exist, zero will be returned.
* If the property exists but could not be scanned, an error will be logged and zero will be returned.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
*
* @return The value of the given property interpreted as a long.
* Zero if the property does not exist or could not be scanned.
*/
long getLong(const char* name = NULL) const;
/**
* Interpret the value of the given property as a Matrix.
* If the property does not exist, out will be set to the identity matrix.
* If the property exists but could not be scanned, an error will be logged and out will be set
* to the identity matrix.
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The matrix to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getMat4(const char* name, Mat4* out) const;
/**
* Interpret the value of the given property as a Vector2.
* If the property does not exist, out will be set to Vector2(0.0f, 0.0f).
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Vector2(0.0f, 0.0f).
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The vector to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getVec2(const char* name, Vec2* out) const;
/**
* Interpret the value of the given property as a Vector3.
* If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f).
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Vector3(0.0f, 0.0f, 0.0f).
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The vector to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getVec3(const char* name, Vec3* out) const;
/**
* Interpret the value of the given property as a Vector4.
* If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The vector to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getVec4(const char* name, Vec4* out) const;
/**
* Interpret the value of the given property as a Quaternion specified as an axis angle.
* If the property does not exist, out will be set to Quaternion().
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Quaternion().
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The quaternion to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getQuaternionFromAxisAngle(const char* name, Quaternion* out) const;
/**
* Interpret the value of the given property as an RGB color in hex and write this color to a Vector3.
* E.g. 0xff0000 represents red and sets the vector to (1, 0, 0).
* If the property does not exist, out will be set to Vector3(0.0f, 0.0f, 0.0f).
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Vector3(0.0f, 0.0f, 0.0f).
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The vector to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getColor(const char* name, Vec3* out) const;
/**
* Interpret the value of the given property as an RGBA color in hex and write this color to a Vector4.
* E.g. 0xff0000ff represents opaque red and sets the vector to (1, 0, 0, 1).
* If the property does not exist, out will be set to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
* If the property exists but could not be scanned, an error will be logged and out will be set
* to Vector4(0.0f, 0.0f, 0.0f, 0.0f).
*
* @param name The name of the property to interpret, or NULL to return the current property's value.
* @param out The vector to set to this property's interpreted value.
*
* @return True on success, false if the property does not exist or could not be scanned.
*/
bool getColor(const char* name, Vec4* out) const;
/**
* Gets the file path for the given property if the file exists.
*
* This method will first search for the file relative to the working directory.
* If the file is not found then it will search relative to the directory the bundle file is in.
*
* @param name The name of the property.
* @param path The string to copy the path to if the file exists.
*
* @return True if the property exists and the file exists, false otherwise.
*
* @script{ignore}
*/
bool getPath(const char* name, std::string* path) const;
/**
* Returns the value of a variable that is set in this Properties object.
*
* Variables take on the format ${name} and are inherited from parent Property objects.
*
* @param name Name of the variable to get.
* @param defaultValue Value to return if the variable is not found.
*
* @return The value of the specified variable, or defaultValue if not found.
*/
const char* getVariable(const char* name, const char* defaultValue = NULL) const;
/**
* Sets the value of the specified variable.
*
* @param name Name of the variable to set.
* @param value The value to set.
*/
void setVariable(const char* name, const char* value);
/**
* Attempts to parse the specified string as a Vector2 value.
*
* On error, false is returned and the output is set to all zero values.
*
* @param str The string to parse.
* @param out The value to populate if successful.
*
* @return True if a valid Vector2 was parsed, false otherwise.
*/
static bool parseVec2(const char* str, Vec2* out);
/**
* Attempts to parse the specified string as a Vector3 value.
*
* On error, false is returned and the output is set to all zero values.
*
* @param str The string to parse.
* @param out The value to populate if successful.
*
* @return True if a valid Vector3 was parsed, false otherwise.
*/
static bool parseVec3(const char* str, Vec3* out);
/**
* Attempts to parse the specified string as a Vector4 value.
*
* On error, false is returned and the output is set to all zero values.
*
* @param str The string to parse.
* @param out The value to populate if successful.
*
* @return True if a valid Vector4 was parsed, false otherwise.
*/
static bool parseVec4(const char* str, Vec4* out);
/**
* Attempts to parse the specified string as an axis-angle value.
*
* The specified string is expected to contain four comma-separated
* values, where the first three values represents the axis and the
* fourth value represents the angle, in degrees.
*
* On error, false is returned and the output is set to all zero values.
*
* @param str The string to parse.
* @param out A Quaternion populated with the orientation of the axis-angle, if successful.
*
* @return True if a valid axis-angle was parsed, false otherwise.
*/
static bool parseAxisAngle(const char* str, Quaternion* out);
/**
* Attempts to parse the specified string as an RGB color value.
*
* @param str The string to parse.
* @param out The value to populate if successful.
*
* @return True if a valid RGB color was parsed, false otherwise.
*/
static bool parseColor(const char* str, Vec3* out);
/**
* Attempts to parse the specified string as an RGBA color value.
*
* @param str The string to parse.
* @param out The value to populate if successful.
*
* @return True if a valid RGBA color was parsed, false otherwise.
*/
static bool parseColor(const char* str, Vec4* out);
private:
/**
* Internal structure containing a single property.
*/
struct Property
{
std::string name;
std::string value;
Property(const std::string& aname, const std::string& avalue) : name(aname), value(avalue) { }
};
/**
* Constructor.
*/
Properties();
/**
* Constructs the Properties class from a file.
*
* @param stream The stream used for reading the properties from file.
*/
Properties(Data* data, ssize_t* dataIdx);
Properties(const Properties& copy);
/**
* Constructor. Read from the beginning of namespace specified.
*/
Properties(Data* data, ssize_t* dataIdx, const std::string& name, const char* id, const char* parentID, Properties* parent);
// Data manipulation methods
void readProperties();
void skipWhiteSpace();
char* trimWhiteSpace(char* str);
signed char readChar();
char* readLine(char* output, int num);
bool seekFromCurrent(int offset);
bool eof();
// Called after createNonRefCounted(); copies info from parents into derived namespaces.
void resolveInheritance(const char* id = NULL);
// Called by resolveInheritance().
void mergeWith(Properties* overrides);
// Clones the Properties object.
Properties* clone();
void setDirectoryPath(const std::string* path);
void setDirectoryPath(const std::string& path);
/**
* Reads the next character from the Data. Returns EOF if the end of the Data is reached.
*/
// XXX: hack in order to simulate GamePlay's Stream with Cocos2d's Data
ssize_t *_dataIdx;
Data *_data;
std::string _namespace;
std::string _id;
std::string _parentID;
std::vector<Property> _properties;
std::vector<Property>::iterator _propertiesItr;
std::vector<Properties*> _namespaces;
std::vector<Properties*>::const_iterator _namespacesItr;
std::vector<Property>* _variables;
std::string* _dirPath;
Properties* _parent;
};
}
#endif // __cocos2d_libs__CCProperties__
-28
View File
@@ -41,16 +41,7 @@ static void untrackRef(Ref* ref);
Ref::Ref()
: _referenceCount(1) // when the Ref is created, the reference count of it is 1
#if CC_ENABLE_SCRIPT_BINDING
, _luaID (0)
, _rooted(false)
#endif
{
#if CC_ENABLE_SCRIPT_BINDING
static unsigned int uObjectCount = 0;
_ID = ++uObjectCount;
#endif
#if CC_REF_LEAK_DETECTION
trackRef(this);
#endif
@@ -58,25 +49,6 @@ Ref::Ref()
Ref::~Ref()
{
#if CC_ENABLE_SCRIPT_BINDING
// if the object is referenced by Lua engine, remove it
if (_luaID)
{
ScriptEngineManager::getInstance()->getScriptEngine()->removeScriptObjectByObject(this);
}
#if !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
else
{
ScriptEngineProtocol* pEngine = ScriptEngineManager::getInstance()->getScriptEngine();
if (pEngine != nullptr && pEngine->getScriptType() == kScriptTypeJavascript)
{
pEngine->removeScriptObjectByObject(this);
}
}
#endif // !CC_ENABLE_GC_FOR_NATIVE_OBJECTS
#endif // CC_ENABLE_SCRIPT_BINDING
#if CC_REF_LEAK_DETECTION
if (_referenceCount != 0)
untrackRef(this);
-14
View File
@@ -123,7 +123,6 @@ protected:
*/
Ref();
public:
/**
* Destructor
*
@@ -138,19 +137,6 @@ protected:
friend class AutoreleasePool;
#if CC_ENABLE_SCRIPT_BINDING
public:
/// object id, ScriptSupport need public _ID
unsigned int _ID;
/// Lua reference id
int _luaID;
/**
When true, it means that the object was already rooted.
*/
bool _rooted;
#endif
// Memory leak diagnostic data (only included when CC_REF_LEAK_DETECTION is defined and its value isn't zero)
#if CC_REF_LEAK_DETECTION
public:
+1 -2
View File
@@ -432,8 +432,6 @@ public:
bool isCurrentTargetSalvaged () const { return _currentTargetSalvaged; };
protected:
/** Schedules the 'callback' function for a given target with a given priority.
The 'callback' selector will be called every frame.
The lower the priority, the earlier it is called.
@@ -443,6 +441,7 @@ protected:
*/
void schedulePerFrame(const ccSchedulerFunc& callback, void *target, int priority, bool paused);
protected:
void removeHashElement(struct _hashSelectorEntry *element);
void removeUpdateFromHash(struct _listEntry *entry);
@@ -27,7 +27,6 @@
#include "renderer/CCGLProgramCache.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCRenderState.h"
#if (CC_TARGET_PLATFORM == CC_PLATFORM_MAC || CC_TARGET_PLATFORM == CC_PLATFORM_WIN32 || CC_TARGET_PLATFORM == CC_PLATFORM_LINUX)
#define CC_CLIPPING_NODE_OPENGLES 0
#else
@@ -145,7 +144,6 @@ void StencilStateManager::onBeforeVisit()
// enable stencil use
glEnable(GL_STENCIL_TEST);
// RenderState::StateBlock::_defaultState->setStencilTest(true);
// check for OpenGL error while enabling stencil test
CHECK_GL_ERROR_DEBUG();
@@ -153,7 +151,6 @@ void StencilStateManager::onBeforeVisit()
// all bits on the stencil buffer are readonly, except the current layer bit,
// this means that operation like glClear or glStencilOp will be masked with this value
glStencilMask(mask_layer);
// RenderState::StateBlock::_defaultState->setStencilWrite(mask_layer);
// manually save the depth test state
@@ -166,7 +163,6 @@ void StencilStateManager::onBeforeVisit()
// it should never prevent something else to be drawn,
// only disabling depth buffer update should do
glDepthMask(GL_FALSE);
RenderState::StateBlock::_defaultState->setDepthWrite(false);
///////////////////////////////////
// CLEAR STENCIL BUFFER
@@ -193,14 +189,8 @@ void StencilStateManager::onBeforeVisit()
// if not in inverted mode: set the current layer value to 1 in the stencil buffer
// if in inverted mode: set the current layer value to 0 in the stencil buffer
glStencilFunc(GL_NEVER, mask_layer, mask_layer);
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_NEVER, mask_layer, mask_layer);
glStencilOp(!_inverted ? GL_REPLACE : GL_ZERO, GL_KEEP, GL_KEEP);
// RenderState::StateBlock::_defaultState->setStencilOperation(
// !_inverted ? RenderState::STENCIL_OP_REPLACE : RenderState::STENCIL_OP_ZERO,
// RenderState::STENCIL_OP_KEEP,
// RenderState::STENCIL_OP_KEEP);
// enable alpha test only if the alpha threshold < 1,
// indeed if alpha threshold == 1, every pixel will be drawn anyways
@@ -241,7 +231,6 @@ void StencilStateManager::onAfterDrawStencil()
// restore the depth test state
glDepthMask(_currentDepthWriteMask);
RenderState::StateBlock::_defaultState->setDepthWrite(_currentDepthWriteMask != 0);
//if (currentDepthTestEnabled) {
// glEnable(GL_DEPTH_TEST);
@@ -257,10 +246,8 @@ void StencilStateManager::onAfterDrawStencil()
// else
// do not draw the pixel but keep the current layer in the stencil buffer
glStencilFunc(GL_EQUAL, _mask_layer_le, _mask_layer_le);
// RenderState::StateBlock::_defaultState->setStencilFunction(RenderState::STENCIL_EQUAL, _mask_layer_le, _mask_layer_le);
glStencilOp(GL_KEEP, GL_KEEP, GL_KEEP);
// RenderState::StateBlock::_defaultState->setStencilOperation(RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP, RenderState::STENCIL_OP_KEEP);
// draw (according to the stencil test function) this node and its children
@@ -273,18 +260,13 @@ void StencilStateManager::onAfterVisit()
// manually restore the stencil state
glStencilFunc(_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
// RenderState::StateBlock::_defaultState->setStencilFunction((RenderState::StencilFunction)_currentStencilFunc, _currentStencilRef, _currentStencilValueMask);
glStencilOp(_currentStencilFail, _currentStencilPassDepthFail, _currentStencilPassDepthPass);
// RenderState::StateBlock::_defaultState->setStencilOperation((RenderState::StencilOperation)_currentStencilFail,
// (RenderState::StencilOperation)_currentStencilPassDepthFail,
// (RenderState::StencilOperation)_currentStencilPassDepthPass);
glStencilMask(_currentStencilWriteMask);
if (!_currentStencilEnabled)
{
glDisable(GL_STENCIL_TEST);
// RenderState::StateBlock::_defaultState->setStencilTest(false);
}
// we are done using this layer, decrement
-7
View File
@@ -49,7 +49,6 @@ THE SOFTWARE.
#include "base/CCMap.h"
#include "base/CCNS.h"
#include "base/CCProfiling.h"
#include "base/CCProperties.h"
#include "base/CCRef.h"
#include "base/CCRefPtr.h"
#include "base/CCScheduler.h"
@@ -147,23 +146,17 @@ THE SOFTWARE.
#include "renderer/CCGLProgramCache.h"
#include "renderer/CCGLProgramState.h"
#include "renderer/CCGroupCommand.h"
#include "renderer/CCMaterial.h"
#include "renderer/CCPass.h"
#include "renderer/CCPrimitive.h"
#include "renderer/CCPrimitiveCommand.h"
#include "renderer/CCQuadCommand.h"
#include "renderer/CCRenderCommand.h"
#include "renderer/CCRenderCommandPool.h"
#include "renderer/CCRenderState.h"
#include "renderer/CCRenderer.h"
#include "renderer/CCTechnique.h"
#include "renderer/CCTexture2D.h"
#include "renderer/CCTextureCache.h"
#include "renderer/CCTrianglesCommand.h"
#include "renderer/CCVertexAttribBinding.h"
#include "renderer/CCVertexIndexBuffer.h"
#include "renderer/CCVertexIndexData.h"
#include "renderer/CCFrameBuffer.h"
#include "renderer/ccGLStateCache.h"
#include "renderer/ccShaders.h"
@@ -1,41 +0,0 @@
LOCAL_PATH := $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE := cocosbuilder_static
LOCAL_MODULE_FILENAME := libcocosbuilder
LOCAL_ARM_MODE := arm
LOCAL_SRC_FILES := CCBAnimationManager.cpp \
CCBFileLoader.cpp \
CCBKeyframe.cpp \
CCBReader.cpp \
CCBSequence.cpp \
CCBSequenceProperty.cpp \
CCControlButtonLoader.cpp \
CCControlLoader.cpp \
CCLabelBMFontLoader.cpp \
CCLabelTTFLoader.cpp \
CCLayerColorLoader.cpp \
CCLayerGradientLoader.cpp \
CCLayerLoader.cpp \
CCMenuItemImageLoader.cpp \
CCMenuItemLoader.cpp \
CCNode+CCBRelativePositioning.cpp \
CCNodeLoader.cpp \
CCNodeLoaderLibrary.cpp \
CCParticleSystemQuadLoader.cpp \
CCScale9SpriteLoader.cpp \
CCScrollViewLoader.cpp \
CCSpriteLoader.cpp
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/..
LOCAL_C_INCLUDES := $(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../../2d \
LOCAL_STATIC_LIBRARIES := cocos_extension_static
include $(BUILD_STATIC_LIBRARY)
File diff suppressed because it is too large Load Diff
@@ -1,272 +0,0 @@
#ifndef __CCB_CCBANIMATION_MANAGER_H__
#define __CCB_CCBANIMATION_MANAGER_H__
#include "base/CCMap.h"
#include "2d/CCActionInterval.h"
#include "2d/CCActionInstant.h"
#include "2d/CCActionEase.h"
#include "extensions/ExtensionMacros.h"
#include "editor-support/cocosbuilder/CCBSequence.h"
#include "editor-support/cocosbuilder/CCBKeyframe.h"
#include "editor-support/cocosbuilder/CCBSequenceProperty.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"
namespace cocosbuilder {
class CC_DLL CCBAnimationManagerDelegate
{
public:
virtual ~CCBAnimationManagerDelegate() {}
virtual void completedAnimationSequenceNamed(const char *name) = 0;
};
class CC_DLL CCBAnimationManager : public cocos2d::Ref
{
public:
bool _jsControlled;
/**
* @js ctor
*/
CCBAnimationManager();
/**
* @js NA
* @lua NA
*/
~CCBAnimationManager();
cocos2d::Ref *_owner;
virtual bool init();
cocos2d::Vector<CCBSequence*>& getSequences();
void setSequences(const cocos2d::Vector<CCBSequence*>& seq);
int getAutoPlaySequenceId();
void setAutoPlaySequenceId(int autoPlaySequenceId);
cocos2d::Node* getRootNode();
void setRootNode(cocos2d::Node* pRootNode); // weak reference
void addDocumentCallbackNode(cocos2d::Node *node);
void addDocumentCallbackName(const std::string& name);
void addDocumentCallbackControlEvents(cocos2d::extension::Control::EventType eventType);
void addDocumentOutletNode(cocos2d::Node *node);
void addDocumentOutletName(const std::string& name);
void setDocumentControllerName(const std::string &name);
std::string getDocumentControllerName();
cocos2d::ValueVector& getDocumentCallbackNames();
cocos2d::Vector<cocos2d::Node*>& getDocumentCallbackNodes();
cocos2d::ValueVector& getDocumentCallbackControlEvents();
cocos2d::ValueVector& getDocumentOutletNames();
cocos2d::Vector<cocos2d::Node*>& getDocumentOutletNodes();
std::string getLastCompletedSequenceName();
cocos2d::ValueVector& getKeyframeCallbacks();
const cocos2d::Size& getRootContainerSize();
void setRootContainerSize(const cocos2d::Size &rootContainerSize);
CCBAnimationManagerDelegate* getDelegate();
void setDelegate(CCBAnimationManagerDelegate* pDelegate); // retain
const char* getRunningSequenceName();
const cocos2d::Size& getContainerSize(cocos2d::Node* pNode);
void addNode(cocos2d::Node *pNode, const std::unordered_map<int, cocos2d::Map<std::string, CCBSequenceProperty*>>& seq);
void setBaseValue(const cocos2d::Value& value, cocos2d::Node *pNode, const std::string& propName);
void setObject(cocos2d::Ref* obj, cocos2d::Node *pNode, const std::string& propName);
void moveAnimationsFromNode(cocos2d::Node* fromNode, cocos2d::Node* toNode);
void runAnimationsForSequenceNamedTweenDuration(const char *pName, float fTweenDuration);
void runAnimationsForSequenceNamed(const char *pName);
void runAnimationsForSequenceIdTweenDuration(int nSeqId, float fTweenDuraiton);
/**
* when this function bound to js ,the second param are callfunc_selector
* @lua NA
*/
void setAnimationCompletedCallback(cocos2d::Ref *target, cocos2d::SEL_CallFunc callbackFunc);
void debug();
/**
* @js setCallFuncForJSCallbackNamed
*/
void setCallFunc(cocos2d::CallFunc *callFunc, const std::string &callbackNamed);
cocos2d::Sequence* actionForCallbackChannel(CCBSequenceProperty* channel);
cocos2d::Sequence* actionForSoundChannel(CCBSequenceProperty* channel);
// return -1 if timeline not exsit
int getSequenceId(const char* pSequenceName);
// get timeline duration
float getSequenceDuration(const char* pSequenceName);
private:
const cocos2d::Value& getBaseValue(cocos2d::Node *pNode, const std::string& propName);
Ref* getObject(cocos2d::Node *pNode, const std::string& propName);
CCBSequence* getSequence(int nSequenceId);
cocos2d::ActionInterval* getAction(CCBKeyframe *pKeyframe0, CCBKeyframe *pKeyframe1, const std::string& propName, cocos2d::Node *pNode);
void setAnimatedProperty(const std::string& propName,cocos2d::Node *pNode, const cocos2d::Value& value, Ref* obj, float fTweenDuraion);
void setFirstFrame(cocos2d::Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
cocos2d::ActionInterval* getEaseAction(cocos2d::ActionInterval *pAction, CCBKeyframe::EasingType easingType, float fEasingOpt);
void runAction(cocos2d::Node *pNode, CCBSequenceProperty *pSeqProp, float fTweenDuration);
void sequenceCompleted();
private:
cocos2d::Vector<CCBSequence*> _sequences;
std::unordered_map<cocos2d::Node*, std::unordered_map<int, cocos2d::Map<std::string, CCBSequenceProperty*>>> _nodeSequences;
std::unordered_map<cocos2d::Node*, std::unordered_map<std::string, cocos2d::Value>> _baseValues;
std::unordered_map<cocos2d::Node*, std::unordered_map<std::string, cocos2d::Ref*>> _objects;
int _autoPlaySequenceId;
cocos2d::Node *_rootNode;
cocos2d::Size _rootContainerSize;
CCBAnimationManagerDelegate *_delegate;
CCBSequence *_runningSequence;
cocos2d::ValueVector _documentOutletNames;
cocos2d::Vector<cocos2d::Node*> _documentOutletNodes;
cocos2d::ValueVector _documentCallbackNames;
cocos2d::Vector<cocos2d::Node*> _documentCallbackNodes;
cocos2d::ValueVector _documentCallbackControlEvents;
cocos2d::ValueVector _keyframeCallbacks;
cocos2d::Map<std::string, cocos2d::CallFunc*> _keyframeCallFuncs;
std::string _documentControllerName;
std::string _lastCompletedSequenceName;
cocos2d::SEL_CallFunc _animationCompleteCallbackFunc;
cocos2d::Ref *_target;
};
class CC_DLL CCBSetSpriteFrame : public cocos2d::ActionInstant
{
public:
/** creates a Place action with a position */
static CCBSetSpriteFrame* create(cocos2d::SpriteFrame *pSpriteFrame);
/**
* @js NA
* @lua NA
*/
~CCBSetSpriteFrame();
bool initWithSpriteFrame(cocos2d::SpriteFrame *pSpriteFrame);
// Overrides
virtual void update(float time) override;
virtual CCBSetSpriteFrame* clone() const override;
virtual CCBSetSpriteFrame* reverse() const override;
private:
cocos2d::SpriteFrame *_spriteFrame;
};
class CC_DLL CCBSoundEffect : public cocos2d::ActionInstant
{
public:
static CCBSoundEffect* actionWithSoundFile(const std::string &file, float pitch, float pan, float gain);
/**
* @js NA
* @lua NA
*/
~CCBSoundEffect();
bool initWithSoundFile(const std::string &file, float pitch, float pan, float gain);
// Overrides
virtual void update(float time) override;
virtual CCBSoundEffect* clone() const override;
virtual CCBSoundEffect* reverse() const override;
private:
std::string _soundFile;
float _pitch, _pan, _gain;
};
class CC_DLL CCBRotateTo : public cocos2d::ActionInterval
{
public:
static CCBRotateTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
// Override
virtual void update(float time) override;
virtual CCBRotateTo* clone() const override;
virtual CCBRotateTo* reverse() const override;
virtual void startWithTarget(cocos2d::Node *pNode) override;
private:
float _startAngle;
float _dstAngle;
float _diffAngle;
};
class CC_DLL CCBRotateXTo: public cocos2d::ActionInterval
{
public:
static CCBRotateXTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
// Overrides
virtual void startWithTarget(cocos2d::Node *pNode) override;
virtual CCBRotateXTo* clone() const override;
virtual CCBRotateXTo* reverse() const override;
virtual void update(float time) override;
private:
float _startAngle;
float _dstAngle;
float _diffAngle;
};
class CC_DLL CCBRotateYTo: public cocos2d::ActionInterval
{
public:
static CCBRotateYTo* create(float fDuration, float fAngle);
bool initWithDuration(float fDuration, float fAngle);
// Override
virtual void startWithTarget(cocos2d::Node *pNode) override;
virtual CCBRotateYTo* clone() const override;
virtual CCBRotateYTo* reverse() const override;
virtual void update(float time) override;
private:
float _startAngle;
float _dstAngle;
float _diffAngle;
};
class CC_DLL CCBEaseInstant : public cocos2d::ActionEase
{
public:
static CCBEaseInstant* create(cocos2d::ActionInterval *pAction);
virtual CCBEaseInstant* clone() const override;
virtual CCBEaseInstant* reverse() const override;
virtual void update(float dt) override;
};
}
#endif // __CCB_CCBANIMATION_MANAGER_H__
@@ -1,18 +0,0 @@
#include "editor-support/cocosbuilder/CCBFileLoader.h"
using namespace cocos2d;
namespace cocosbuilder {
#define PROPERTY_CCBFILE "ccbFile"
void CCBFileLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CCBFILE) == 0) {
((CCBFile*)pNode)->setCCBFileNode(pCCBFileNode);
} else {
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, ccbReader);
}
}
}
@@ -1,32 +0,0 @@
#ifndef _CCB_CCBFILELOADER_H_
#define _CCB_CCBFILELOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL CCBFileLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~CCBFileLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(CCBFileLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(CCBFile);
virtual void onHandlePropTypeCCBFile(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Node * pCCBFileNode, CCBReader * ccbReader);
};
}
#endif
@@ -1,71 +0,0 @@
#include "editor-support/cocosbuilder/CCBKeyframe.h"
using namespace cocos2d;
namespace cocosbuilder {
CCBKeyframe::CCBKeyframe()
: _object(nullptr)
, _time(0.0f)
, _easingType(EasingType::INSTANT)
, _easingOpt(0.0f)
{}
CCBKeyframe::~CCBKeyframe()
{
CC_SAFE_RELEASE(_object);
}
const Value& CCBKeyframe::getValue() const
{
return _value;
}
void CCBKeyframe::setValue(const Value& value)
{
_value = value;
}
Ref* CCBKeyframe::getObject() const
{
return _object;
}
void CCBKeyframe::setObject(Ref* obj)
{
CC_SAFE_RETAIN(obj);
CC_SAFE_RELEASE(_object);
_object = obj;
}
float CCBKeyframe::getTime()
{
return _time;
}
void CCBKeyframe::setTime(float fTime)
{
_time = fTime;
}
CCBKeyframe::EasingType CCBKeyframe::getEasingType()
{
return _easingType;
}
void CCBKeyframe::setEasingType(CCBKeyframe::EasingType easingType)
{
_easingType = easingType;
}
float CCBKeyframe::getEasingOpt()
{
return _easingOpt;
}
void CCBKeyframe::setEasingOpt(float fEasingOpt)
{
_easingOpt = fEasingOpt;
}
}
@@ -1,71 +0,0 @@
#ifndef __CCB_KEYFRAME_H__
#define __CCB_KEYFRAME_H__
#include "base/CCRef.h"
#include "base/CCValue.h"
namespace cocosbuilder {
class CC_DLL CCBKeyframe : public cocos2d::Ref
{
public:
enum class EasingType
{
INSTANT,
LINEAR,
CUBIC_IN,
CUBIC_OUT,
CUBIC_INOUT,
ELASTIC_IN,
ELASTIC_OUT,
ELASTIC_INOUT,
BOUNCE_IN,
BOUNCE_OUT,
BOUNCE_INOUT,
BACK_IN,
BACK_OUT,
BACK_INOUT,
};
/**
* @js ctor
*/
CCBKeyframe();
/**
* @js NA
* @lua NA
*/
~CCBKeyframe();
const cocos2d::Value& getValue() const;
void setValue(const cocos2d::Value& value);
cocos2d::Ref* getObject() const;
void setObject(cocos2d::Ref* obj);
float getTime();
void setTime(float fTime);
EasingType getEasingType();
void setEasingType(EasingType easingType);
float getEasingOpt();
void setEasingOpt(float fEasingOpt);
private:
cocos2d::Value _value;
cocos2d::Ref* _object;
float _time;
EasingType _easingType;
float _easingOpt;
};
}
#endif // __CCB_KEYFRAME_H__
@@ -1,58 +0,0 @@
#ifndef _CCB_CCBMEMBERVARIABLEASSIGNER_H_
#define _CCB_CCBMEMBERVARIABLEASSIGNER_H_
namespace cocosbuilder {
#define CCB_MEMBERVARIABLEASSIGNER_GLUE(TARGET, MEMBERVARIABLENAME, MEMBERVARIABLETYPE, MEMBERVARIABLE) \
if (pTarget == TARGET && 0 == strcmp(pMemberVariableName, (MEMBERVARIABLENAME))) { \
MEMBERVARIABLETYPE pOldVar = MEMBERVARIABLE; \
MEMBERVARIABLE = dynamic_cast<MEMBERVARIABLETYPE>(pNode); \
CC_ASSERT(MEMBERVARIABLE); \
if (pOldVar != MEMBERVARIABLE) { \
CC_SAFE_RELEASE(pOldVar); \
MEMBERVARIABLE->retain(); \
} \
return true; \
}
#define CCB_MEMBERVARIABLEASSIGNER_GLUE_WEAK(TARGET, MEMBERVARIABLENAME, MEMBERVARIABLETYPE, MEMBERVARIABLE) \
if (pTarget == TARGET && 0 == strcmp(pMemberVariableName, MEMBERVARIABLENAME)) { \
MEMBERVARIABLE = dynamic_cast<MEMBERVARIABLETYPE>(pNode); \
CC_ASSERT(MEMBERVARIABLE); \
return true; \
}
class CC_DLL CCBMemberVariableAssigner {
public:
/**
* @js NA
* @lua NA
*/
virtual ~CCBMemberVariableAssigner() {};
/**
* The callback function of assigning member variable.
* @note The member variable must be Node or its subclass.
* @param target The custom class.
* @param memberVariableName The name of the member variable.
* @param node The member variable.
* @return Whether the assignment was successful.
*/
virtual bool onAssignCCBMemberVariable(cocos2d::Ref* target, const char* memberVariableName, cocos2d::Node* node) = 0;
/**
* The callback function of assigning custom properties.
* @note The member variable must be Integer, Float, Boolean or String.
* @param target The custom class.
* @param memberVariableName The name of the member variable.
* @param value The value of the property.
* @return Whether the assignment was successful.
*/
virtual bool onAssignCCBCustomProperty(cocos2d::Ref* target, const char* memberVariableName, const cocos2d::Value& value) { return false; };
};
}
#endif
File diff suppressed because it is too large Load Diff
@@ -1,405 +0,0 @@
#ifndef _CCB_CCBREADER_H_
#define _CCB_CCBREADER_H_
#include <set>
#include <string>
#include <vector>
#include "2d/CCNode.h"
#include "base/CCData.h"
#include "base/CCMap.h"
#include "editor-support/cocosbuilder/CCBSequence.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"
#include "editor-support/cocosbuilder/CCBAnimationManager.h"
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(T, METHOD) static T * METHOD() { \
T * ptr = new (std::nothrow) T(); \
if(ptr != NULL) { \
ptr->autorelease(); \
return ptr; \
} \
CC_SAFE_DELETE(ptr); \
return NULL; \
}
#define CCB_STATIC_NEW_AUTORELEASE_OBJECT_WITH_INIT_METHOD(T, METHOD) static T * METHOD() { \
T * ptr = new (std::nothrow) T(); \
if(ptr != NULL && ptr->init()) { \
ptr->autorelease(); \
return ptr; \
} \
CC_SAFE_DELETE(ptr); \
return NULL; \
}
#define CCB_VERSION 5
namespace cocosbuilder {
/**
* @addtogroup cocosbuilder
* @{
*/
class CCBFile : public cocos2d::Node
{
private:
cocos2d::Node *_CCBFileNode;
public:
CCBFile();
static CCBFile* create();
cocos2d::Node* getCCBFileNode();
void setCCBFileNode(Node *pNode); // retain
};
/* Forward declaration. */
class NodeLoader;
class NodeLoaderLibrary;
class NodeLoaderListener;
class CCBMemberVariableAssigner;
class CCBSelectorResolver;
class CCBAnimationManager;
class CCBKeyframe;
/**
* @brief Parse CCBI file which is generated by CocosBuilder
*/
class CC_DLL CCBReader : public cocos2d::Ref
{
public:
enum class PropertyType {
POSITION = 0,
SIZE,
POINT,
POINT_LOCK,
SCALE_LOCK,
DEGREES,
INTEGER,
FLOAT,
FLOAT_VAR,
CHECK,
SPRITEFRAME,
TEXTURE,
BYTE,
COLOR3,
COLOR4F_VAR,
FLIP,
BLEND_MODE,
FNT_FILE,
TEXT,
FONT_TTF,
INTEGER_LABELED,
BLOCK,
ANIMATION,
CCB_FILE,
STRING,
BLOCK_CONTROL,
FLOAT_SCALE,
FLOAT_XY
};
enum class FloatType {
_0 = 0,
_1,
MINUS1,
_05,
INTEGER,
FULL
};
enum class PlatformType {
ALL = 0,
IOS,
MAC
};
enum class TargetType {
NONE = 0,
DOCUMENT_ROOT = 1,
OWNER = 2,
};
enum class PositionType
{
RELATIVE_BOTTOM_LEFT,
RELATIVE_TOP_LEFT,
RELATIVE_TOP_RIGHT,
RELATIVE_BOTTOM_RIGHT,
PERCENT,
MULTIPLY_RESOLUTION,
};
enum class SizeType
{
ABSOLUTE,
PERCENT,
RELATIVE_CONTAINER,
HORIZONTAL_PERCENT,
VERTICAL_PERCENT,
MULTIPLY_RESOLUTION,
};
enum class ScaleType
{
ABSOLUTE,
MULTIPLY_RESOLUTION
};
/**
* @js NA
* @lua NA
*/
CCBReader(NodeLoaderLibrary *pNodeLoaderLibrary, CCBMemberVariableAssigner *pCCBMemberVariableAssigner = NULL, CCBSelectorResolver *pCCBSelectorResolver = NULL, NodeLoaderListener *pNodeLoaderListener = NULL);
/**
* @js NA
* @lua NA
*/
CCBReader(CCBReader *ccbReader);
/**
* @js NA
* @lua NA
*/
virtual ~CCBReader();
/**
* @js NA
* @lua NA
*/
CCBReader();
void setCCBRootPath(const char* ccbRootPath);
const std::string& getCCBRootPath() const;
cocos2d::Node* readNodeGraphFromFile(const char *pCCBFileName);
cocos2d::Node* readNodeGraphFromFile(const char *pCCBFileName, cocos2d::Ref *pOwner);
cocos2d::Node* readNodeGraphFromFile(const char *pCCBFileName, cocos2d::Ref *pOwner, const cocos2d::Size &parentSize);
/**
* @js NA
* @lua NA
*/
cocos2d::Node* readNodeGraphFromData(std::shared_ptr<cocos2d::Data> data, cocos2d::Ref *pOwner, const cocos2d::Size &parentSize);
/**
@lua NA
*/
cocos2d::Scene* createSceneWithNodeGraphFromFile(const char *pCCBFileName);
/**
@lua NA
*/
cocos2d::Scene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, cocos2d::Ref *pOwner);
/**
@lua NA
*/
cocos2d::Scene* createSceneWithNodeGraphFromFile(const char *pCCBFileName, cocos2d::Ref *pOwner, const cocos2d::Size &parentSize);
/**
* @js NA
* @lua NA
*/
CCBMemberVariableAssigner* getCCBMemberVariableAssigner();
/**
* @js NA
* @lua NA
*/
CCBSelectorResolver* getCCBSelectorResolver();
/**
* @js getActionManager
* @lua getActionManager
*/
CCBAnimationManager* getAnimationManager();
/**
* @js setActionManager
* @lua setActionManager
*/
void setAnimationManager(CCBAnimationManager *pAnimationManager);
/** Used in NodeLoader::parseProperties()
* @js NA
* @lua NA
*/
std::set<std::string>* getAnimatedProperties();
/**
* @js NA
* @lua NA
*/
std::set<std::string>& getLoadedSpriteSheet();
/**
* @js NA
* @lua NA
*/
cocos2d::Ref* getOwner();
/* Utility methods.
* @js NA
* @lua NA
*/
static std::string lastPathComponent(const char* pString);
/**
* @js NA
* @lua NA
*/
static std::string deletePathExtension(const char* pString);
/**
* @js NA
* @lua NA
*/
static std::string toLowerCase(const char* pString);
/**
* @js NA
* @lua NA
*/
static bool endsWith(const char* pString, const char* pEnding);
/* Parse methods.
* @js NA
* @lua NA
*/
int readInt(bool pSigned);
/**
* @js NA
* @lua NA
*/
unsigned char readByte();
/**
* @js NA
* @lua NA
*/
bool readBool();
std::string readUTF8();
/**
* @js NA
* @lua NA
*/
float readFloat();
/**
* @js NA
* @lua NA
*/
std::string readCachedString();
/**
* @js NA
* @lua NA
*/
bool isJSControlled();
bool readCallbackKeyframesForSeq(CCBSequence* seq);
bool readSoundKeyframesForSeq(CCBSequence* seq);
cocos2d::ValueVector getOwnerCallbackNames();
cocos2d::Vector<cocos2d::Node*>& getOwnerCallbackNodes();
cocos2d::ValueVector& getOwnerCallbackControlEvents();
cocos2d::ValueVector getOwnerOutletNames();
cocos2d::Vector<cocos2d::Node*>& getOwnerOutletNodes();
cocos2d::Vector<cocos2d::Node*>& getNodesWithAnimationManagers();
cocos2d::Vector<CCBAnimationManager*>& getAnimationManagersForNodes();
typedef cocos2d::Map<cocos2d::Node*, CCBAnimationManager*> CCBAnimationManagerMap;
typedef std::shared_ptr<CCBAnimationManagerMap> CCBAnimationManagerMapPtr;
/**
* @js NA
* @lua NA
*/
CCBAnimationManagerMapPtr getAnimationManagers();
/**
* @js NA
* @lua NA
*/
void setAnimationManagers(CCBAnimationManagerMapPtr x);
/**
* @js NA
* @lua NA
*/
void addOwnerCallbackName(const std::string& name);
/**
* @js NA
* @lua NA
*/
void addOwnerCallbackNode(cocos2d::Node *node);
void addOwnerCallbackControlEvents(cocos2d::extension::Control::EventType type);
/**
* @js NA
* @lua NA
*/
void addDocumentCallbackName(const std::string& name);
/**
* @js NA
* @lua NA
*/
void addDocumentCallbackNode(cocos2d::Node *node);
void addDocumentCallbackControlEvents(cocos2d::extension::Control::EventType eventType);
/**
* @js NA
* @lua NA
*/
static float getResolutionScale();
static void setResolutionScale(float scale);
/**
* @js NA
* @lua NA
*/
cocos2d::Node* readFileWithCleanUp(bool bCleanUp, CCBAnimationManagerMapPtr am);
void addOwnerOutletName(const std::string& name);
void addOwnerOutletNode(cocos2d::Node *node);
private:
void cleanUpNodeGraph(cocos2d::Node *pNode);
bool readSequences();
CCBKeyframe* readKeyframe(PropertyType type);
bool readHeader();
bool readStringCache();
//void readStringCacheEntry();
cocos2d::Node* readNodeGraph();
cocos2d::Node* readNodeGraph(cocos2d::Node * pParent);
bool getBit();
void alignBits();
bool init();
friend class NodeLoader;
private:
std::shared_ptr<cocos2d::Data> _data;
unsigned char *_bytes;
int _currentByte;
int _currentBit;
std::vector<std::string> _stringCache;
std::set<std::string> _loadedSpriteSheets;
cocos2d::Ref *_owner;
CCBAnimationManager* _animationManager; //retain
CCBAnimationManagerMapPtr _animationManagers;
std::set<std::string> *_animatedProps;
NodeLoaderLibrary *_nodeLoaderLibrary;
NodeLoaderListener *_nodeLoaderListener;
CCBMemberVariableAssigner *_CCBMemberVariableAssigner;
CCBSelectorResolver *_CCBSelectorResolver;
std::vector<std::string> _ownerOutletNames;
cocos2d::Vector<cocos2d::Node*> _ownerOutletNodes;
cocos2d::Vector<cocos2d::Node*> _nodesWithAnimationManagers;
cocos2d::Vector<CCBAnimationManager*> _animationManagersForNodes;
std::vector<std::string> _ownerCallbackNames;
cocos2d::Vector<cocos2d::Node*> _ownerCallbackNodes;
cocos2d::ValueVector _ownerOwnerCallbackControlEvents;
std::string _CCBRootPath;
bool _jsControlled;
};
// end of effects group
/// @}
}
#endif
@@ -1,46 +0,0 @@
#ifndef _CCB_CCBSELECTORRESOLVER_H_
#define _CCB_CCBSELECTORRESOLVER_H_
#include "extensions//GUI/CCControlExtension/CCInvocation.h"
namespace cocosbuilder {
#define CCB_SELECTORRESOLVER_CCMENUITEM_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && strcmp(pSelectorName, SELECTORNAME) == 0) { \
return CC_MENU_SELECTOR(METHOD); \
}
#define CCB_SELECTORRESOLVER_CCCONTROL_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && strcmp(pSelectorName, SELECTORNAME) == 0) { \
return cccontrol_selector(METHOD); \
}
#define CCB_SELECTORRESOLVER_CALLFUNC_GLUE(TARGET, SELECTORNAME, METHOD) if(pTarget == TARGET && strcmp(pSelectorName, SELECTORNAME) == 0) { \
return CC_CALLFUNCN_SELECTOR(METHOD); \
}
class CC_DLL CCBSelectorResolver {
public:
/**
* @js NA
* @lua NA
*/
virtual ~CCBSelectorResolver() {};
virtual cocos2d::SEL_MenuHandler onResolveCCBCCMenuItemSelector(cocos2d::Ref * pTarget, const char* pSelectorName) = 0;
virtual cocos2d::SEL_CallFuncN onResolveCCBCCCallFuncSelector(cocos2d::Ref * pTarget, const char* pSelectorName) { return NULL; };
virtual cocos2d::extension::Control::Handler onResolveCCBCCControlSelector(cocos2d::Ref * pTarget, const char* pSelectorName) = 0;
};
class CC_DLL CCBScriptOwnerProtocol {
public:
/**
* @js NA
* @lua NA
*/
virtual ~CCBScriptOwnerProtocol() {};
virtual CCBSelectorResolver * createNew() = 0;
};
}
#endif
@@ -1,89 +0,0 @@
#include "editor-support/cocosbuilder/CCBSequence.h"
using namespace cocos2d;
using namespace std;
namespace cocosbuilder {
CCBSequence::CCBSequence()
: _duration(0.0f)
, _name("")
, mSequenceId(0)
, mChainedSequenceId(0)
, mCallbackChannel(nullptr)
, mSoundChannel(nullptr)
{}
CCBSequence::~CCBSequence() {
CC_SAFE_RELEASE(mCallbackChannel);
CC_SAFE_RELEASE(mSoundChannel);
}
float CCBSequence::getDuration()
{
return _duration;
}
void CCBSequence::setDuration(float fDuration)
{
_duration = fDuration;
}
const char* CCBSequence::getName()
{
return _name.c_str();
}
void CCBSequence::setName(const char *pName)
{
_name = pName;
}
int CCBSequence::getSequenceId()
{
return mSequenceId;
}
void CCBSequence::setSequenceId(int nSequenceId)
{
mSequenceId = nSequenceId;
}
CCBSequenceProperty* CCBSequence::getCallbackChannel()
{
return mCallbackChannel;
}
void CCBSequence::setCallbackChannel(CCBSequenceProperty* callbackChannel)
{
CC_SAFE_RELEASE(mCallbackChannel);
mCallbackChannel = callbackChannel;
CC_SAFE_RETAIN(mCallbackChannel);
}
CCBSequenceProperty* CCBSequence::getSoundChannel()
{
return mSoundChannel;
}
void CCBSequence::setSoundChannel(CCBSequenceProperty* soundChannel)
{
CC_SAFE_RELEASE(mSoundChannel);
mSoundChannel = soundChannel;
CC_SAFE_RETAIN(mSoundChannel);
}
int CCBSequence::getChainedSequenceId()
{
return mChainedSequenceId;
}
void CCBSequence::setChainedSequenceId(int nChainedSequenceId)
{
mChainedSequenceId = nChainedSequenceId;
}
}
@@ -1,51 +0,0 @@
#ifndef __CCB_CCSEQUENCE_H__
#define __CCB_CCSEQUENCE_H__
#include <string>
#include "base/CCRef.h"
#include "editor-support/cocosbuilder/CCBSequenceProperty.h"
namespace cocosbuilder {
class CC_DLL CCBSequence : public cocos2d::Ref
{
public:
CCBSequence();
/**
* @js NA
* @lua NA
*/
~CCBSequence();
float getDuration();
void setDuration(float fDuration);
CCBSequenceProperty* getCallbackChannel();
void setCallbackChannel(CCBSequenceProperty* callbackChannel);
CCBSequenceProperty* getSoundChannel();
void setSoundChannel(CCBSequenceProperty* soundChannel);
const char* getName();
void setName(const char *pName);
int getSequenceId();
void setSequenceId(int nSequenceId);
int getChainedSequenceId();
void setChainedSequenceId(int nChainedSequenceId);
private:
float _duration;
std::string _name;
int mSequenceId;
int mChainedSequenceId;
CCBSequenceProperty* mCallbackChannel;
CCBSequenceProperty* mSoundChannel;
};
}
#endif // __CCB_CCSEQUENCE_H__
@@ -1,49 +0,0 @@
#include "editor-support/cocosbuilder/CCBSequenceProperty.h"
using namespace cocos2d;
using namespace std;
namespace cocosbuilder {
CCBSequenceProperty::CCBSequenceProperty()
: _name("")
, _type(0)
{
init();
}
bool CCBSequenceProperty::init()
{
return true;
}
CCBSequenceProperty::~CCBSequenceProperty()
{
}
const char* CCBSequenceProperty::getName()
{
return _name.c_str();
}
void CCBSequenceProperty::setName(const char *pName)
{
_name = pName;
}
int CCBSequenceProperty::getType()
{
return _type;
}
void CCBSequenceProperty::setType(int type)
{
_type = type;
}
cocos2d::Vector<CCBKeyframe*>& CCBSequenceProperty::getKeyframes()
{
return _keyframes;
}
}
@@ -1,41 +0,0 @@
#ifndef __CCB_SEQUENCE_PROPERTY_H__
#define __CCB_SEQUENCE_PROPERTY_H__
#include "base/CCRef.h"
#include "base/CCVector.h"
#include "editor-support/cocosbuilder/CCBKeyframe.h"
namespace cocosbuilder {
class CC_DLL CCBSequenceProperty : public cocos2d::Ref
{
public:
/**
* @js ctor
*/
CCBSequenceProperty();
/**
* @js NA
* @lua NA
*/
~CCBSequenceProperty();
virtual bool init();
const char* getName();
void setName(const char* pName);
int getType();
void setType(int type);
cocos2d::Vector<CCBKeyframe*>& getKeyframes();
private:
std::string _name;
int _type;
cocos2d::Vector<CCBKeyframe*> _keyframes;
};
}
#endif // __CCB_SEQUENCE_PROPERTY_H__
@@ -1,118 +0,0 @@
#include "editor-support/cocosbuilder/CCControlButtonLoader.h"
using namespace cocos2d;
using namespace cocos2d::extension;
namespace cocosbuilder {;
#define PROPERTY_ZOOMONTOUCHDOWN "zoomOnTouchDown"
#define PROPERTY_TITLE_NORMAL "title|1"
#define PROPERTY_TITLE_HIGHLIGHTED "title|2"
#define PROPERTY_TITLE_DISABLED "title|3"
#define PROPERTY_TITLECOLOR_NORMAL "titleColor|1"
#define PROPERTY_TITLECOLOR_HIGHLIGHTED "titleColor|2"
#define PROPERTY_TITLECOLOR_DISABLED "titleColor|3"
#define PROPERTY_TITLETTF_NORMAL "titleTTF|1"
#define PROPERTY_TITLETTF_HIGHLIGHTED "titleTTF|2"
#define PROPERTY_TITLETTF_DISABLED "titleTTF|3"
#define PROPERTY_TITLETTFSIZE_NORMAL "titleTTFSize|1"
#define PROPERTY_TITLETTFSIZE_HIGHLIGHTED "titleTTFSize|2"
#define PROPERTY_TITLETTFSIZE_DISABLED "titleTTFSize|3"
#define PROPERTY_LABELANCHORPOINT "labelAnchorPoint"
// TODO: Should be "preferredSize". This is a typo in cocos2d-iphone, cocos2d-x and CocosBuilder!
#define PROPERTY_PREFEREDSIZE "preferedSize"
#define PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL "backgroundSpriteFrame|1"
#define PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED "backgroundSpriteFrame|2"
#define PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED "backgroundSpriteFrame|3"
void ControlButtonLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ZOOMONTOUCHDOWN) == 0) {
((ControlButton *)pNode)->setZoomOnTouchDown(pCheck);
} else {
ControlLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeString(Node * pNode, Node * pParent, const char * pPropertyName, const char * pString, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLE_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleForState(pString, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_HIGHLIGHTED) == 0) {
((ControlButton *)pNode)->setTitleForState(pString, Control::State::HIGH_LIGHTED);
} else if(strcmp(pPropertyName, PROPERTY_TITLE_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleForState(pString, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeString(pNode, pParent, pPropertyName, pString, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTF_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleTTFForState(pFontTTF, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_HIGHLIGHTED) == 0) {
((ControlButton *)pNode)->setTitleTTFForState(pFontTTF, Control::State::HIGH_LIGHTED);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTF_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleTTFForState(pFontTTF, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_HIGHLIGHTED) == 0) {
((ControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, Control::State::HIGH_LIGHTED);
} else if(strcmp(pPropertyName, PROPERTY_TITLETTFSIZE_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleTTFSizeForState(pFloatScale, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, const Vec2& pPoint, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_LABELANCHORPOINT) == 0) {
((ControlButton *)pNode)->setLabelAnchorPoint(pPoint);
} else {
ControlLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, const Size& pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((ControlButton *)pNode)->setPreferredSize(pSize);
} else {
ControlLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_NORMAL) == 0) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::NORMAL);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_HIGHLIGHTED) == 0) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::HIGH_LIGHTED);
}
} else if(strcmp(pPropertyName, PROPERTY_BACKGROUNDSPRITEFRAME_DISABLED) == 0) {
if(pSpriteFrame != nullptr) {
((ControlButton *)pNode)->setBackgroundSpriteFrameForState(pSpriteFrame, Control::State::DISABLED);
}
} else {
ControlLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void ControlButtonLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_NORMAL) == 0) {
((ControlButton *)pNode)->setTitleColorForState(pColor3B, Control::State::NORMAL);
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_HIGHLIGHTED) == 0) {
((ControlButton *)pNode)->setTitleColorForState(pColor3B, Control::State::HIGH_LIGHTED);
} else if(strcmp(pPropertyName, PROPERTY_TITLECOLOR_DISABLED) == 0) {
((ControlButton *)pNode)->setTitleColorForState(pColor3B, Control::State::DISABLED);
} else {
ControlLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
};
@@ -1,40 +0,0 @@
#ifndef _CCB_CCCONTROLBUTTONLOADER_H_
#define _CCB_CCCONTROLBUTTONLOADER_H_
#include "editor-support/cocosbuilder/CCControlLoader.h"
#include "extensions//GUI/CCControlExtension/CCControlButton.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL ControlButtonLoader : public ControlLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~ControlButtonLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ControlButtonLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::extension::ControlButton);
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeString(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pString, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Vec2& pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Size& pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
};
}
#endif
@@ -1,30 +0,0 @@
#include "editor-support/cocosbuilder/CCControlLoader.h"
using namespace cocos2d;
using namespace cocos2d::extension;
namespace cocosbuilder {
#define PROPERTY_ENABLED "enabled"
#define PROPERTY_SELECTED "selected"
#define PROPERTY_CCCONTROL "ccControl"
void ControlLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ENABLED) == 0) {
((Control *)pNode)->setEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_SELECTED) == 0) {
((Control *)pNode)->setSelected(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ControlLoader::onHandlePropTypeBlockControl(Node * pNode, Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CCCONTROL) == 0) {
((Control *)pNode)->addTargetWithActionForControlEvents(pBlockControlData->_target, pBlockControlData->mSELControlHandler, pBlockControlData->mControlEvents);
} else {
NodeLoader::onHandlePropTypeBlockControl(pNode, pParent, pPropertyName, pBlockControlData, ccbReader);
}
}
}
@@ -1,29 +0,0 @@
#ifndef _CCB_CCCONTROLLOADER_H_
#define _CCB_CCCONTROLLOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL ControlLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~ControlLoader() {};
protected:
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::extension::Control);
virtual void onHandlePropTypeBlockControl(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
}
#endif
@@ -1,53 +0,0 @@
#include "editor-support/cocosbuilder/CCLabelBMFontLoader.h"
using namespace cocos2d;
namespace cocosbuilder {
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
#define PROPERTY_FNTFILE "fntFile"
#define PROPERTY_STRING "string"
void LabelBMFontLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((Label *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((Label *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((Label *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeFntFile(Node * pNode, Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FNTFILE) == 0) {
((Label *)pNode)->setBMFontFilePath(pFntFile, nullptr);
} else {
NodeLoader::onHandlePropTypeFntFile(pNode, pParent, pPropertyName, pFntFile, ccbReader);
}
}
void LabelBMFontLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((Label *)pNode)->setString(pText);
} else {
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
}
}
}
@@ -1,35 +0,0 @@
#ifndef _CCB_CCLABELBMFONTLOADER_H_
#define _CCB_CCLABELBMFONTLOADER_H_
#include "base/CCRef.h"
#include "2d/CCLabel.h"
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL LabelBMFontLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~LabelBMFontLoader() {};
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LabelBMFontLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Label);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFntFile(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char* pFntFile, CCBReader * ccbReader);
virtual void onHandlePropTypeText(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char* pText, CCBReader * ccbReader);
};
}
#endif
@@ -1,83 +0,0 @@
#include "editor-support/cocosbuilder/CCLabelTTFLoader.h"
using namespace cocos2d;
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
#define PROPERTY_FONTNAME "fontName"
#define PROPERTY_FONTSIZE "fontSize"
#define PROPERTY_HORIZONTALALIGNMENT "horizontalAlignment"
#define PROPERTY_VERTICALALIGNMENT "verticalAlignment"
#define PROPERTY_STRING "string"
#define PROPERTY_DIMENSIONS "dimensions"
namespace cocosbuilder {
void LabelTTFLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((Label *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((Label *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((Label *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeFontTTF(Node * pNode, Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FONTNAME) == 0) {
((Label *)pNode)->setSystemFontName(pFontTTF);
} else {
NodeLoader::onHandlePropTypeFontTTF(pNode, pParent, pPropertyName, pFontTTF, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeText(Node * pNode, Node * pParent, const char * pPropertyName, const char * pText, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STRING) == 0) {
((Label *)pNode)->setString(pText);
} else {
NodeLoader::onHandlePropTypeText(pNode, pParent, pPropertyName, pText, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeFloatScale(Node * pNode, Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FONTSIZE) == 0) {
((Label *)pNode)->setSystemFontSize(pFloatScale);
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pFloatScale, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_HORIZONTALALIGNMENT) == 0) {
((Label *)pNode)->setHorizontalAlignment(TextHAlignment(pIntegerLabeled));
} else if(strcmp(pPropertyName, PROPERTY_VERTICALALIGNMENT) == 0) {
((Label *)pNode)->setVerticalAlignment(TextVAlignment(pIntegerLabeled));
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}
void LabelTTFLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, const Size& size, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DIMENSIONS) == 0) {
((Label *)pNode)->setDimensions(size.width,size.height);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, size, ccbReader);
}
}
}
@@ -1,38 +0,0 @@
#ifndef _CCB_CCLABELTTFLOADER_H_
#define _CCB_CCLABELTTFLOADER_H_
#include "base/CCRef.h"
#include "2d/CCLabel.h"
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL LabelTTFLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~LabelTTFLoader() {};
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LabelTTFLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Label);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeText(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const char * pText, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Size& pSize, CCBReader * ccbReader);
};
}
#endif
@@ -1,35 +0,0 @@
#include "editor-support/cocosbuilder/CCLayerColorLoader.h"
using namespace cocos2d;
namespace cocosbuilder {
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
void LayerColorLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((LayerColor *)pNode)->setColor(pColor3B);
} else {
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((LayerColor *)pNode)->setOpacity(pByte);
} else {
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LayerColorLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LayerColor *)pNode)->setBlendFunc(pBlendFunc);
} else {
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
}
@@ -1,30 +0,0 @@
#ifndef _CCB_CCLAYERCOLORLOADER_H_
#define _CCB_CCLAYERCOLORLOADER_H_
#include "editor-support/cocosbuilder/CCLayerLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL LayerColorLoader : public LayerLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~LayerColorLoader() {};
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LayerColorLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::LayerColor);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
};
}
#endif
@@ -1,54 +0,0 @@
#include "editor-support/cocosbuilder/CCLayerGradientLoader.h"
using namespace cocos2d;
#define PROPERTY_STARTCOLOR "startColor"
#define PROPERTY_ENDCOLOR "endColor"
#define PROPERTY_STARTOPACITY "startOpacity"
#define PROPERTY_ENDOPACITY "endOpacity"
#define PROPERTY_VECTOR "vector"
#define PROPERTY_BLENDFUNC "blendFunc"
namespace cocosbuilder {
void LayerGradientLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((LayerGradient *)pNode)->setStartColor(pColor3B);
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
((LayerGradient *)pNode)->setEndColor(pColor3B);
} else {
LayerLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTOPACITY) == 0) {
((LayerGradient *)pNode)->setStartOpacity(pByte);
} else if(strcmp(pPropertyName, PROPERTY_ENDOPACITY) == 0) {
((LayerGradient *)pNode)->setEndOpacity(pByte);
} else {
LayerLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((LayerGradient *)pNode)->setBlendFunc(pBlendFunc);
} else {
LayerLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void LayerGradientLoader::onHandlePropTypePoint(Node * pNode, Node * pParent, const char * pPropertyName, const Vec2& pPoint, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_VECTOR) == 0) {
((LayerGradient *)pNode)->setVector(pPoint);
// TODO: Not passed along the ccbi file.
// ((LayerGradient *)pNode)->setCompressedInterpolation(true);
} else {
LayerLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}
}
@@ -1,31 +0,0 @@
#ifndef _CCB_CCLAYERGRADIENTLOADER_H_
#define _CCB_CCLAYERGRADIENTLOADER_H_
#include "editor-support/cocosbuilder/CCLayerLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL LayerGradientLoader : public LayerLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~LayerGradientLoader() {};
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LayerGradientLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::LayerGradient);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Vec2& pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
};
}
#endif
@@ -1,45 +0,0 @@
#include "editor-support/cocosbuilder/CCLayerLoader.h"
using namespace cocos2d;
#define PROPERTY_TOUCH_ENABLED "isTouchEnabled"
#define PROPERTY_ACCELEROMETER_ENABLED "isAccelerometerEnabled"
#define PROPERTY_MOUSE_ENABLED "isMouseEnabled"
#define PROPERTY_KEYBOARD_ENABLED "isKeyboardEnabled"
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (push)
#pragma warning (disable: 4996)
#endif
using namespace cocos2d;
namespace cocosbuilder {
void LayerLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
/*if(strcmp(pPropertyName, PROPERTY_TOUCH_ENABLED) == 0) {
((Layer *)pNode)->setTouchEnabled(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_ACCELEROMETER_ENABLED) == 0) {
((Layer *)pNode)->setAccelerometerEnabled(pCheck);
} else */if(strcmp(pPropertyName, PROPERTY_MOUSE_ENABLED) == 0) {
// TODO: Not supported
CCLOG("The property '%s' is not supported!", PROPERTY_MOUSE_ENABLED);
} else if(strcmp(pPropertyName, PROPERTY_KEYBOARD_ENABLED) == 0) {
// TODO: Not supported
CCLOG("The property '%s' is not supported!", PROPERTY_KEYBOARD_ENABLED);
// This comes closest: ((Layer *)pNode)->setKeypadEnabled(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
}
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
#elif _MSC_VER >= 1400 //vs 2005 or higher
#pragma warning (pop)
#endif
@@ -1,28 +0,0 @@
#ifndef _CCB_CCLAYERLOADER_H_
#define _CCB_CCLAYERLOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL LayerLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~LayerLoader() {};
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(LayerLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Layer);
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
}
#endif
@@ -1,29 +0,0 @@
#include "editor-support/cocosbuilder/CCMenuItemImageLoader.h"
using namespace cocos2d;
#define PROPERTY_NORMALDISPLAYFRAME "normalSpriteFrame"
#define PROPERTY_SELECTEDDISPLAYFRAME "selectedSpriteFrame"
#define PROPERTY_DISABLEDDISPLAYFRAME "disabledSpriteFrame"
namespace cocosbuilder {
void MenuItemImageLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_NORMALDISPLAYFRAME) == 0) {
if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setNormalSpriteFrame(pSpriteFrame);
}
} else if(strcmp(pPropertyName, PROPERTY_SELECTEDDISPLAYFRAME) == 0) {
if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setSelectedSpriteFrame(pSpriteFrame);
}
} else if(strcmp(pPropertyName, PROPERTY_DISABLEDDISPLAYFRAME) == 0) {
if(pSpriteFrame != nullptr) {
((MenuItemImage *)pNode)->setDisabledSpriteFrame(pSpriteFrame);
}
} else {
MenuItemLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
}
@@ -1,39 +0,0 @@
#ifndef _CCB_CCMENUITEMIMAGELOADER_H_
#define _CCB_CCMENUITEMIMAGELOADER_H_
#include "editor-support/cocosbuilder/CCMenuItemLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL MenuItemImageLoader : public MenuItemLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~MenuItemImageLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(MenuItemImageLoader, loader);
protected:
/**
* @js NA
* @lua NA
*/
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::MenuItemImage);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
};
}
#endif
@@ -1,30 +0,0 @@
#include "editor-support/cocosbuilder/CCMenuItemLoader.h"
using namespace cocos2d;
#define PROPERTY_BLOCK "block"
#define PROPERTY_ISENABLED "isEnabled"
namespace cocosbuilder {
void MenuItemLoader::onHandlePropTypeBlock(Node * pNode, Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLOCK) == 0) {
if (nullptr != pBlockData) // Add this condition to allow MenuItemImage without target/selector predefined
{
((MenuItem *)pNode)->setCallback( std::bind( pBlockData->mSELMenuHandler, pBlockData->_target, std::placeholders::_1) );
// ((MenuItem *)pNode)->setTarget(pBlockData->_target, pBlockData->mSELMenuHandler);
}
} else {
NodeLoader::onHandlePropTypeBlock(pNode, pParent, pPropertyName, pBlockData, ccbReader);
}
}
void MenuItemLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_ISENABLED) == 0) {
((MenuItem *)pNode)->setEnabled(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
}
@@ -1,42 +0,0 @@
#ifndef _CCB_CCMENUITEMLOADER_H_
#define _CCB_CCMENUITEMLOADER_H_
#include "base/CCRef.h"
#include "2d/CCMenuItem.h"
#include "editor-support/cocosbuilder/CCLayerLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL MenuItemLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~MenuItemLoader() {};
protected:
/**
* @js NA
* @lua NA
*/
CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::MenuItem);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeBlock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, BlockData * pBlockData, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode,cocos2d:: Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
};
}
#endif
@@ -1,39 +0,0 @@
#ifndef _CCB_CCMENULOADER_H_
#define _CCB_CCMENULOADER_H_
#include "editor-support/cocosbuilder/CCLayerLoader.h"
#include "base/CCRef.h"
#include "2d/CCMenu.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL MenuLoader : public LayerLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~MenuLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(MenuLoader, loader);
protected:
virtual cocos2d::Menu * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader)
{
cocos2d::Menu * pMenu = cocos2d::Menu::create();
pMenu->setContentSize(cocos2d::Size::ZERO);
return pMenu;
}
};
}
#endif
@@ -1,62 +0,0 @@
#include "editor-support/cocosbuilder/CCNode+CCBRelativePositioning.h"
#include "editor-support/cocosbuilder/CCBReader.h"
using namespace cocos2d;
namespace cocosbuilder {
CC_DLL Vec2 getAbsolutePosition(const Vec2 &pt, CCBReader::PositionType type, const Size &containerSize, const std::string& propName)
{
Vec2 absPt;
if (type == CCBReader::PositionType::RELATIVE_BOTTOM_LEFT)
{
absPt = pt;
}
else if (type == CCBReader::PositionType::RELATIVE_TOP_LEFT)
{
absPt.x = pt.x;
absPt.y = containerSize.height - pt.y;
}
else if (type == CCBReader::PositionType::RELATIVE_TOP_RIGHT)
{
absPt.x = containerSize.width - pt.x;
absPt.y = containerSize.height - pt.y;
}
else if (type == CCBReader::PositionType::RELATIVE_BOTTOM_RIGHT)
{
absPt.x = containerSize.width - pt.x;
absPt.y = pt.y;
}
else if (type == CCBReader::PositionType::PERCENT)
{
absPt.x = (int)(containerSize.width * pt.x / 100.0f);
absPt.y = (int)(containerSize.height * pt.y / 100.0f);
}
else if (type == CCBReader::PositionType::MULTIPLY_RESOLUTION)
{
float resolutionScale = CCBReader::getResolutionScale();
absPt.x = pt.x * resolutionScale;
absPt.y = pt.y * resolutionScale;
}
return absPt;
}
CC_DLL void setRelativeScale(Node *pNode, float scaleX, float scaleY, CCBReader::ScaleType type, const std::string& propName)
{
CCASSERT(pNode, "pNode should not be null");
if (type == CCBReader::ScaleType::MULTIPLY_RESOLUTION)
{
float resolutionScale = CCBReader::getResolutionScale();
scaleX *= resolutionScale;
scaleY *= resolutionScale;
}
pNode->setScaleX(scaleX);
pNode->setScaleY(scaleY);
}
}
@@ -1,14 +0,0 @@
#ifndef __CCB_CCNODE_RELATIVEPOSITIONING_H__
#define __CCB_CCNODE_RELATIVEPOSITIONING_H__
#include "editor-support/cocosbuilder/CCBReader.h"
namespace cocosbuilder {
extern CC_DLL cocos2d::Vec2 getAbsolutePosition(const cocos2d::Vec2 &pt, CCBReader::PositionType type, const cocos2d::Size &containerSize, const std::string&propName);
extern CC_DLL void setRelativeScale(cocos2d::Node *node, float scaleX, float scaleY, CCBReader::ScaleType type, const std::string& propName);
}
#endif // __CCB_CCNODE_RELATIVEPOSITIONING_H__
File diff suppressed because it is too large Load Diff
@@ -1,147 +0,0 @@
#ifndef _CCB_CCNODELOADER_H_
#define _CCB_CCNODELOADER_H_
#include "extensions/GUI/CCControlExtension/CCInvocation.h"
#include "editor-support/cocosbuilder/CCBReader.h"
#include "extensions/GUI/CCControlExtension/CCControl.h"
namespace cocosbuilder {
#define PROPERTY_POSITION "position"
#define PROPERTY_CONTENTSIZE "contentSize"
#define PROPERTY_SKEW "skew"
#define PROPERTY_ANCHORPOINT "anchorPoint"
#define PROPERTY_SCALE "scale"
#define PROPERTY_ROTATION "rotation"
#define PROPERTY_ROTATIONX "rotationX"
#define PROPERTY_ROTATIONY "rotationY"
#define PROPERTY_TAG "tag"
#define PROPERTY_IGNOREANCHORPOINTFORPOSITION "ignoreAnchorPointForPosition"
#define PROPERTY_VISIBLE "visible"
#define ASSERT_FAIL_UNEXPECTED_PROPERTY(PROPERTY) cocos2d::log("Unexpected property: '%s'!\n", PROPERTY); assert(false)
#define ASSERT_FAIL_UNEXPECTED_PROPERTYTYPE(PROPERTYTYPE) cocos2d::log("Unexpected property type: '%d'!\n", PROPERTYTYPE); assert(false)
#define CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) { \
return T::create(); \
}
#define CCB_PURE_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(T) virtual T * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) = 0
struct BlockData {
cocos2d::SEL_MenuHandler mSELMenuHandler;
cocos2d::Ref * _target;
};
struct BlockControlData {
cocos2d::extension::Control::Handler mSELControlHandler;
cocos2d::Ref * _target;
cocos2d::extension::Control::EventType mControlEvents;
};
/* Forward declaration. */
class CCBReader;
class CC_DLL NodeLoader : public cocos2d::Ref {
public:
/**
* @js NA
* @lua NA
*/
NodeLoader();
/**
* @js NA
* @lua NA
*/
virtual ~NodeLoader();
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoader, loader);
/**
* @js NA
* @lua NA
*/
virtual cocos2d::Node * loadNode(cocos2d::Node *, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void parseProperties(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual cocos2d::ValueMap& getCustomProperties();
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Node);
virtual cocos2d::Vec2 parsePropTypePosition(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Vec2 parsePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Vec2 parsePropTypePointLock(cocos2d::Node * pNode,cocos2d:: Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Size parsePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeScaleLock(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual float parsePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual float parsePropTypeDegrees(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual float parsePropTypeFloatScale(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual int parsePropTypeInteger(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual int parsePropTypeIntegerLabeled(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeFloatVar(cocos2d::Node * pNode,cocos2d::Node * pParent, CCBReader * ccbReader);
virtual bool parsePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::SpriteFrame * parsePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Animation * parsePropTypeAnimation(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Texture2D * parsePropTypeTexture(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual unsigned char parsePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Color3B parsePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader, const char *pPropertyName);
virtual cocos2d::Color4F * parsePropTypeColor4FVar(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual bool * parsePropTypeFlip(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::BlendFunc parsePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeFntFile(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeString(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeText(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual std::string parsePropTypeFontTTF(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual BlockData * parsePropTypeBlock(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual BlockControlData * parsePropTypeBlockControl(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual cocos2d::Node * parsePropTypeCCBFile(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual float * parsePropTypeFloatXY(cocos2d::Node * pNode, cocos2d::Node * pParent, CCBReader * ccbReader);
virtual void onHandlePropTypePosition(cocos2d::Node * pNode,cocos2d:: Node * pParent, const char* pPropertyName, const cocos2d::Vec2& pPosition, CCBReader * ccbReader);
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const cocos2d::Vec2& pPoint, CCBReader * ccbReader);
virtual void onHandlePropTypePointLock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const cocos2d::Vec2& pPointLock, CCBReader * ccbReader);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const cocos2d::Size& pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeScaleLock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float * pScaleLock, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float pFloat, CCBReader * ccbReader);
virtual void onHandlePropTypeDegrees(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float pDegrees, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatScale(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float pFloatScale, CCBReader * ccbReader);
virtual void onHandlePropTypeInteger(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, int pInteger, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatVar(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * ccbReader);
virtual void onHandlePropTypeFloatXY(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, float * pFoatVar, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeAnimation(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Animation * pAnimation, CCBReader * ccbReader);
virtual void onHandlePropTypeTexture(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Texture2D * pTexture2D, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeColor4FVar(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Color4F * pColor4FVar, CCBReader * ccbReader);
virtual void onHandlePropTypeFlip(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, bool * pFlip, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeFntFile(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const char * pFntFile, CCBReader * ccbReader);
virtual void onHandlePropTypeString(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const char * pString, CCBReader * ccbReader);
virtual void onHandlePropTypeText(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const char * pText, CCBReader * ccbReader);
virtual void onHandlePropTypeFontTTF(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, const char * pFontTTF, CCBReader * ccbReader);
virtual void onHandlePropTypeBlock(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, BlockData * pBlockData, CCBReader * ccbReader);
virtual void onHandlePropTypeBlockControl(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, BlockControlData * pBlockControlData, CCBReader * ccbReader);
virtual void onHandlePropTypeCCBFile(cocos2d::Node * pNode, cocos2d::Node * pParent, const char* pPropertyName, cocos2d::Node * pCCBFileNode, CCBReader * ccbReader);
protected:
cocos2d::ValueMap _customProperties;
};
}
#endif
@@ -1,105 +0,0 @@
#include "editor-support/cocosbuilder/CCNodeLoaderLibrary.h"
#include "editor-support/cocosbuilder/CCLayerLoader.h"
#include "editor-support/cocosbuilder/CCLayerColorLoader.h"
#include "editor-support/cocosbuilder/CCLayerGradientLoader.h"
#include "editor-support/cocosbuilder/CCLabelBMFontLoader.h"
#include "editor-support/cocosbuilder/CCLabelTTFLoader.h"
#include "editor-support/cocosbuilder/CCSpriteLoader.h"
#include "editor-support/cocosbuilder/CCScale9SpriteLoader.h"
#include "editor-support/cocosbuilder/CCBFileLoader.h"
#include "editor-support/cocosbuilder/CCMenuLoader.h"
#include "editor-support/cocosbuilder/CCMenuItemLoader.h"
#include "editor-support/cocosbuilder/CCMenuItemImageLoader.h"
#include "editor-support/cocosbuilder/CCControlButtonLoader.h"
#include "editor-support/cocosbuilder/CCParticleSystemQuadLoader.h"
#include "editor-support/cocosbuilder/CCScrollViewLoader.h"
using namespace cocos2d;
namespace cocosbuilder {
NodeLoaderLibrary::NodeLoaderLibrary() {
}
NodeLoaderLibrary::~NodeLoaderLibrary() {
this->purge(true);
}
void NodeLoaderLibrary::registerDefaultNodeLoaders() {
this->registerNodeLoader("CCNode", NodeLoader::loader());
this->registerNodeLoader("CCLayer", LayerLoader::loader());
this->registerNodeLoader("CCLayerColor", LayerColorLoader::loader());
this->registerNodeLoader("CCLayerGradient", LayerGradientLoader::loader());
this->registerNodeLoader("CCSprite", SpriteLoader::loader());
this->registerNodeLoader("CCLabelBMFont", LabelBMFontLoader::loader());
this->registerNodeLoader("CCLabelTTF", LabelTTFLoader::loader());
this->registerNodeLoader("CCScale9Sprite", Scale9SpriteLoader::loader());
this->registerNodeLoader("CCScrollView", ScrollViewLoader::loader());
this->registerNodeLoader("CCBFile", CCBFileLoader::loader());
this->registerNodeLoader("CCMenu", MenuLoader::loader());
this->registerNodeLoader("CCMenuItemImage", MenuItemImageLoader::loader());
this->registerNodeLoader("CCControlButton", ControlButtonLoader::loader());
this->registerNodeLoader("CCParticleSystemQuad", ParticleSystemQuadLoader::loader());
}
void NodeLoaderLibrary::registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader) {
pNodeLoader->retain();
this->_nodeLoaders.insert(NodeLoaderMapEntry(pClassName, pNodeLoader));
}
void NodeLoaderLibrary::unregisterNodeLoader(const char * pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
if (ccNodeLoadersIterator != this->_nodeLoaders.end())
{
ccNodeLoadersIterator->second->release();
_nodeLoaders.erase(ccNodeLoadersIterator);
}
else
{
CCLOG("The loader (%s) doesn't exist", pClassName);
}
}
NodeLoader * NodeLoaderLibrary::getNodeLoader(const char* pClassName) {
NodeLoaderMap::iterator ccNodeLoadersIterator = this->_nodeLoaders.find(pClassName);
assert(ccNodeLoadersIterator != this->_nodeLoaders.end());
return ccNodeLoadersIterator->second;
}
void NodeLoaderLibrary::purge(bool pReleaseNodeLoaders) {
if(pReleaseNodeLoaders) {
for(NodeLoaderMap::iterator it = this->_nodeLoaders.begin(); it != this->_nodeLoaders.end(); it++) {
it->second->release();
}
}
this->_nodeLoaders.clear();
}
static NodeLoaderLibrary * sSharedNodeLoaderLibrary = nullptr;
NodeLoaderLibrary * NodeLoaderLibrary::getInstance() {
if(sSharedNodeLoaderLibrary == nullptr) {
sSharedNodeLoaderLibrary = new (std::nothrow) NodeLoaderLibrary();
sSharedNodeLoaderLibrary->registerDefaultNodeLoaders();
}
return sSharedNodeLoaderLibrary;
}
void NodeLoaderLibrary::destroyInstance() {
CC_SAFE_DELETE(sSharedNodeLoaderLibrary);
}
NodeLoaderLibrary * NodeLoaderLibrary::newDefaultNodeLoaderLibrary() {
NodeLoaderLibrary * ccNodeLoaderLibrary = NodeLoaderLibrary::library();
ccNodeLoaderLibrary->registerDefaultNodeLoaders();
return ccNodeLoaderLibrary;
}
}
@@ -1,83 +0,0 @@
#ifndef _CCB_CCNODELOADERLIBRARY_H_
#define _CCB_CCNODELOADERLIBRARY_H_
#include "editor-support/cocosbuilder/CCBReader.h"
namespace cocosbuilder {
class NodeLoader;
typedef std::map<std::string, NodeLoader *> NodeLoaderMap;
typedef std::pair<std::string, NodeLoader *> NodeLoaderMapEntry;
class CC_DLL NodeLoaderLibrary : public cocos2d::Ref
{
public:
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(NodeLoaderLibrary, library);
/**
* @js NA
* @lua NA
*/
NodeLoaderLibrary();
/**
* @js NA
* @lua NA
*/
virtual ~NodeLoaderLibrary();
/**
* @js NA
* @lua NA
*/
void registerDefaultNodeLoaders();
/**
* @js NA
* @lua NA
*/
void registerNodeLoader(const char * pClassName, NodeLoader * pNodeLoader);
//void registerNodeLoader(String * pClassName, NodeLoader * pNodeLoader);
/**
* @js NA
* @lua NA
*/
void unregisterNodeLoader(const char * pClassName);
//void unregisterNodeLoader(String * pClassName);
/**
* @js NA
* @lua NA
*/
NodeLoader * getNodeLoader(const char * pClassName);
//CCNodeLoader * getNodeLoader(String * pClassName);
/**
* @js NA
* @lua NA
*/
void purge(bool pDelete);
public:
/**
* @js NA
* @lua NA
*/
static NodeLoaderLibrary * getInstance();
/**
* @js NA
* @lua NA
*/
static void destroyInstance();
/**
* @js NA
* @lua NA
*/
static NodeLoaderLibrary * newDefaultNodeLoaderLibrary();
private:
NodeLoaderMap _nodeLoaders;
};
}
#endif
@@ -1,23 +0,0 @@
#ifndef _CCB_CCNODELOADERLISTENER_H_
#define _CCB_CCNODELOADERLISTENER_H_
namespace cocosbuilder {
class CC_DLL NodeLoaderListener {
public:
/**
* @js NA
* @lua NA
*/
virtual ~NodeLoaderListener() {};
/**
* @js NA
* @lua NA
*/
virtual void onNodeLoaded(cocos2d::Node * pNode, NodeLoader * pNodeLoader) = 0;
};
}
#endif
@@ -1,140 +0,0 @@
#include "editor-support/cocosbuilder/CCParticleSystemQuadLoader.h"
using namespace cocos2d;
#define PROPERTY_EMITERMODE "emitterMode"
#define PROPERTY_POSVAR "posVar"
#define PROPERTY_EMISSIONRATE "emissionRate"
#define PROPERTY_DURATION "duration"
#define PROPERTY_TOTALPARTICLES "totalParticles"
#define PROPERTY_LIFE "life"
#define PROPERTY_STARTSIZE "startSize"
#define PROPERTY_ENDSIZE "endSize"
#define PROPERTY_STARTSPIN "startSpin"
#define PROPERTY_ENDSPIN "endSpin"
#define PROPERTY_ANGLE "angle"
#define PROPERTY_STARTCOLOR "startColor"
#define PROPERTY_ENDCOLOR "endColor"
#define PROPERTY_BLENDFUNC "blendFunc"
#define PROPERTY_GRAVITY "gravity"
#define PROPERTY_SPEED "speed"
#define PROPERTY_TANGENTIALACCEL "tangentialAccel"
#define PROPERTY_RADIALACCEL "radialAccel"
#define PROPERTY_TEXTURE "texture"
#define PROPERTY_STARTRADIUS "startRadius"
#define PROPERTY_ENDRADIUS "endRadius"
#define PROPERTY_ROTATEPERSECOND "rotatePerSecond"
namespace cocosbuilder {
void ParticleSystemQuadLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_EMITERMODE) == 0) {
((ParticleSystemQuad *)pNode)->setEmitterMode((ParticleSystem::Mode)pIntegerLabeled);
} else {
NodeLoader::onHandlePropTypeIntegerLabeled(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypePoint(Node* pNode, Node* pParent, const char* pPropertyName, const Vec2& pPoint, CCBReader* ccbReader) {
if(strcmp(pPropertyName, PROPERTY_POSVAR) == 0) {
((ParticleSystemQuad *)pNode)->setPosVar(pPoint);
} else if(strcmp(pPropertyName, PROPERTY_GRAVITY) == 0) {
((ParticleSystemQuad *)pNode)->setGravity(pPoint);
} else {
NodeLoader::onHandlePropTypePoint(pNode, pParent, pPropertyName, pPoint, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_EMISSIONRATE) == 0) {
((ParticleSystemQuad *)pNode)->setEmissionRate(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_DURATION) == 0) {
((ParticleSystemQuad *)pNode)->setDuration(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeInteger(Node * pNode, Node * pParent, const char * pPropertyName, int pInteger, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TOTALPARTICLES) == 0) {
((ParticleSystemQuad *)pNode)->setTotalParticles(pInteger);
} else {
NodeLoader::onHandlePropTypeInteger(pNode, pParent, pPropertyName, pInteger, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeFloatVar(Node * pNode, Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_LIFE) == 0) {
((ParticleSystemQuad *)pNode)->setLife(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setLifeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTSIZE) == 0) {
((ParticleSystemQuad *)pNode)->setStartSize(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setStartSizeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDSIZE) == 0) {
((ParticleSystemQuad *)pNode)->setEndSize(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setEndSizeVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTSPIN) == 0) {
((ParticleSystemQuad *)pNode)->setStartSpin(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setStartSpinVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDSPIN) == 0) {
((ParticleSystemQuad *)pNode)->setEndSpin(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setEndSpinVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ANGLE) == 0) {
((ParticleSystemQuad *)pNode)->setAngle(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setAngleVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_SPEED) == 0) {
((ParticleSystemQuad *)pNode)->setSpeed(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setSpeedVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_TANGENTIALACCEL) == 0) {
((ParticleSystemQuad *)pNode)->setTangentialAccel(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setTangentialAccelVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_RADIALACCEL) == 0) {
((ParticleSystemQuad *)pNode)->setRadialAccel(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setRadialAccelVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_STARTRADIUS) == 0) {
((ParticleSystemQuad *)pNode)->setStartRadius(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setStartRadiusVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDRADIUS) == 0) {
((ParticleSystemQuad *)pNode)->setEndRadius(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setEndRadiusVar(pFloatVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ROTATEPERSECOND) == 0) {
((ParticleSystemQuad *)pNode)->setRotatePerSecond(pFloatVar[0]);
((ParticleSystemQuad *)pNode)->setRotatePerSecondVar(pFloatVar[1]);
} else {
NodeLoader::onHandlePropTypeFloatVar(pNode, pParent, pPropertyName, pFloatVar, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeColor4FVar(Node * pNode, Node * pParent, const char * pPropertyName, Color4F * pColor4FVar, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_STARTCOLOR) == 0) {
((ParticleSystemQuad *)pNode)->setStartColor(pColor4FVar[0]);
((ParticleSystemQuad *)pNode)->setStartColorVar(pColor4FVar[1]);
} else if(strcmp(pPropertyName, PROPERTY_ENDCOLOR) == 0) {
((ParticleSystemQuad *)pNode)->setEndColor(pColor4FVar[0]);
((ParticleSystemQuad *)pNode)->setEndColorVar(pColor4FVar[1]);
} else {
NodeLoader::onHandlePropTypeColor4FVar(pNode, pParent, pPropertyName, pColor4FVar, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((ParticleSystemQuad *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void ParticleSystemQuadLoader::onHandlePropTypeTexture(Node * pNode, Node * pParent, const char * pPropertyName, Texture2D * pTexture2D, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_TEXTURE) == 0) {
static_cast<ParticleSystemQuad*>(pNode)->setTexture(pTexture2D);
if(pTexture2D)
{
static_cast<ParticleSystemQuad*>(pNode)->setBlendAdditive(true);
}
} else {
NodeLoader::onHandlePropTypeTexture(pNode, pParent, pPropertyName, pTexture2D, ccbReader);
}
}
}
@@ -1,77 +0,0 @@
#ifndef _CCB_CCPARTICLESYSTEMQUADLOADER_H_
#define _CCB_CCPARTICLESYSTEMQUADLOADER_H_
#include "base/CCRef.h"
#include "2d/CCParticleSystemQuad.h"
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL ParticleSystemQuadLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~ParticleSystemQuadLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(cocosbuilder::ParticleSystemQuadLoader, loader);
protected:
/**
* @js NA
* @lua NA
*/
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::ParticleSystemQuad);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeIntegerLabeled(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypePoint(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Vec2& pPoint, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeInteger(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, int pInteger, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeFloatVar(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float * pFloatVar, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeColor4FVar(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Color4F * pColor4FVar, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeTexture(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Texture2D * pTexture2D, CCBReader * ccbReader);
};
}
#endif
@@ -1,77 +0,0 @@
#include "editor-support/cocosbuilder/CCScale9SpriteLoader.h"
using namespace cocos2d;
using namespace cocos2d::extension;
#define PROPERTY_CONTENTSIZE "contentSize"
#define PROPERTY_SPRITEFRAME "spriteFrame"
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
// TODO: Should be "preferredSize". This is a typo in cocos2d-iphone, cocos2d-x and CocosBuilder!
#define PROPERTY_PREFEREDSIZE "preferedSize"
#define PROPERTY_INSETLEFT "insetLeft"
#define PROPERTY_INSETTOP "insetTop"
#define PROPERTY_INSETRIGHT "insetRight"
#define PROPERTY_INSETBOTTOM "insetBottom"
namespace cocosbuilder {
void Scale9SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_SPRITEFRAME) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
} else {
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
// TODO Not exported by CocosBuilder yet!
// ((Scale9Sprite *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, const Size& pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
//((Scale9Sprite *)pNode)->setContentSize(pSize);
} else if(strcmp(pPropertyName, PROPERTY_PREFEREDSIZE) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setPreferredSize(pSize);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void Scale9SpriteLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_INSETLEFT) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetLeft(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETTOP) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetTop(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETRIGHT) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetRight(pFloat);
} else if(strcmp(pPropertyName, PROPERTY_INSETBOTTOM) == 0) {
((cocos2d::ui::Scale9Sprite *)pNode)->setInsetBottom(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}
}
@@ -1,72 +0,0 @@
#ifndef _CCB_CCSCALE9SPRITELOADER_H_
#define _CCB_CCSCALE9SPRITELOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
#include "editor-support/cocosbuilder/CCScale9SpriteLoader.h"
#include "ui/UIScale9Sprite.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL Scale9SpriteLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~Scale9SpriteLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(Scale9SpriteLoader, loader);
protected:
/**
* @js NA
* @lua NA
*/
virtual cocos2d::ui::Scale9Sprite * createNode(cocos2d::Node * pParent, cocosbuilder::CCBReader * ccbReader) {
cocos2d::ui::Scale9Sprite* pNode = cocos2d::ui::Scale9Sprite::create();
pNode->setAnchorPoint(cocos2d::Vec2::ZERO);
return pNode;
};
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pBlendFunc, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Size& pSize, CCBReader * ccbReader);
/**
* @js NA
* @lua NA
*/
virtual void onHandlePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
};
}
#endif
@@ -1,57 +0,0 @@
#include "editor-support/cocosbuilder/CCScrollViewLoader.h"
using namespace cocos2d;
using namespace cocos2d::extension;
#define PROPERTY_CONTAINER "container"
#define PROPERTY_DIRECTION "direction"
#define PROPERTY_CLIPSTOBOUNDS "clipsToBounds"
#define PROPERTY_BOUNCES "bounces"
#define PROPERTY_SCALE "scale"
namespace cocosbuilder {
void ScrollViewLoader::onHandlePropTypeSize(Node * pNode, Node * pParent, const char * pPropertyName, const Size& pSize, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTENTSIZE) == 0) {
((ScrollView *)pNode)->setViewSize(pSize);
} else {
NodeLoader::onHandlePropTypeSize(pNode, pParent, pPropertyName, pSize, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeCheck(Node * pNode, Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CLIPSTOBOUNDS) == 0) {
((ScrollView *)pNode)->setClippingToBounds(pCheck);
} else if(strcmp(pPropertyName, PROPERTY_BOUNCES) == 0) {
((ScrollView *)pNode)->setBounceable(pCheck);
} else {
NodeLoader::onHandlePropTypeCheck(pNode, pParent, pPropertyName, pCheck, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeCCBFile(Node * pNode, Node * pParent, const char * pPropertyName, Node * pCCBFileNode, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_CONTAINER) == 0) {
((ScrollView *)pNode)->setContainer(pCCBFileNode);
((ScrollView *)pNode)->updateInset();
} else {
NodeLoader::onHandlePropTypeCCBFile(pNode, pParent, pPropertyName, pCCBFileNode, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeFloat(Node * pNode, Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_SCALE) == 0) {
((ScrollView *)pNode)->setScale(pFloat);
} else {
NodeLoader::onHandlePropTypeFloat(pNode, pParent, pPropertyName, pFloat, ccbReader);
}
}
void ScrollViewLoader::onHandlePropTypeIntegerLabeled(Node * pNode, Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DIRECTION) == 0) {
((ScrollView *)pNode)->setDirection(ScrollView::Direction(pIntegerLabeled));
} else {
NodeLoader::onHandlePropTypeFloatScale(pNode, pParent, pPropertyName, pIntegerLabeled, ccbReader);
}
}
}
@@ -1,36 +0,0 @@
#ifndef _CCB_CCSCROLLVIEWLOADER_H_
#define _CCB_CCSCROLLVIEWLOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
#include "extensions/GUI/CCScrollView/CCScrollView.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL ScrollViewLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~ScrollViewLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(ScrollViewLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::extension::ScrollView);
virtual void onHandlePropTypeSize(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Size& pSize, CCBReader * ccbReader);
virtual void onHandlePropTypeCCBFile(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::Node * pCCBFileNode, CCBReader * ccbReader);
virtual void onHandlePropTypeCheck(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, bool pCheck, CCBReader * ccbReader);
virtual void onHandlePropTypeFloat(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, float pFloat, CCBReader * ccbReader);
virtual void onHandlePropTypeIntegerLabeled(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, int pIntegerLabeled, CCBReader * ccbReader);
};
}
#endif
@@ -1,58 +0,0 @@
#include "editor-support/cocosbuilder/CCSpriteLoader.h"
using namespace cocos2d;
#define PROPERTY_FLIP "flip"
#define PROPERTY_DISPLAYFRAME "displayFrame"
#define PROPERTY_COLOR "color"
#define PROPERTY_OPACITY "opacity"
#define PROPERTY_BLENDFUNC "blendFunc"
namespace cocosbuilder {
void SpriteLoader::onHandlePropTypeSpriteFrame(Node * pNode, Node * pParent, const char * pPropertyName, SpriteFrame * pSpriteFrame, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_DISPLAYFRAME) == 0) {
if(pSpriteFrame != nullptr) {
((Sprite *)pNode)->setSpriteFrame(pSpriteFrame);
} else {
CCLOG("SpriteLoader::onHandlePropTypeSpriteFrame ERROR: SpriteFrame nullptr");
}
} else {
NodeLoader::onHandlePropTypeSpriteFrame(pNode, pParent, pPropertyName, pSpriteFrame, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeFlip(Node * pNode, Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_FLIP) == 0) {
((Sprite *)pNode)->setFlippedX(pFlip[0]);
((Sprite *)pNode)->setFlippedY(pFlip[1]);
} else {
NodeLoader::onHandlePropTypeFlip(pNode, pParent, pPropertyName, pFlip, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeColor3(Node * pNode, Node * pParent, const char * pPropertyName, const Color3B& pColor3B, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_COLOR) == 0) {
((Sprite *)pNode)->setColor(pColor3B);
} else {
NodeLoader::onHandlePropTypeColor3(pNode, pParent, pPropertyName, pColor3B, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeByte(Node * pNode, Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_OPACITY) == 0) {
((Sprite *)pNode)->setOpacity(pByte);
} else {
NodeLoader::onHandlePropTypeByte(pNode, pParent, pPropertyName, pByte, ccbReader);
}
}
void SpriteLoader::onHandlePropTypeBlendFunc(Node * pNode, Node * pParent, const char * pPropertyName, const BlendFunc& pBlendFunc, CCBReader * ccbReader) {
if(strcmp(pPropertyName, PROPERTY_BLENDFUNC) == 0) {
((Sprite *)pNode)->setBlendFunc(pBlendFunc);
} else {
NodeLoader::onHandlePropTypeBlendFunc(pNode, pParent, pPropertyName, pBlendFunc, ccbReader);
}
}
}
@@ -1,36 +0,0 @@
#ifndef _CCB_CCSPRITELOADER_H_
#define _CCB_CCSPRITELOADER_H_
#include "editor-support/cocosbuilder/CCNodeLoader.h"
namespace cocosbuilder {
/* Forward declaration. */
class CCBReader;
class CC_DLL SpriteLoader : public NodeLoader {
public:
/**
* @js NA
* @lua NA
*/
virtual ~SpriteLoader() {};
/**
* @js NA
* @lua NA
*/
CCB_STATIC_NEW_AUTORELEASE_OBJECT_METHOD(SpriteLoader, loader);
protected:
CCB_VIRTUAL_NEW_AUTORELEASE_CREATECCNODE_METHOD(cocos2d::Sprite);
virtual void onHandlePropTypeColor3(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::Color3B& pColor3B, CCBReader * ccbReader);
virtual void onHandlePropTypeByte(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, unsigned char pByte, CCBReader * ccbReader);
virtual void onHandlePropTypeBlendFunc(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, const cocos2d::BlendFunc& pCCBBlendFunc, CCBReader * ccbReader);
virtual void onHandlePropTypeSpriteFrame(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, cocos2d::SpriteFrame * pSpriteFrame, CCBReader * ccbReader);
virtual void onHandlePropTypeFlip(cocos2d::Node * pNode, cocos2d::Node * pParent, const char * pPropertyName, bool * pFlip, CCBReader * ccbReader);
};
}
#endif
@@ -1,31 +0,0 @@
#ifndef __EDITOR_SUPPORT_COCOSBUILDER_H__
#define __EDITOR_SUPPORT_COCOSBUILDER_H__
#include "editor-support/cocosbuilder/CCBAnimationManager.h"
#include "editor-support/cocosbuilder/CCBFileLoader.h"
#include "editor-support/cocosbuilder/CCBKeyframe.h"
#include "editor-support/cocosbuilder/CCBMemberVariableAssigner.h"
#include "editor-support/cocosbuilder/CCBReader.h"
#include "editor-support/cocosbuilder/CCBSelectorResolver.h"
#include "editor-support/cocosbuilder/CCBSequence.h"
#include "editor-support/cocosbuilder/CCBSequenceProperty.h"
#include "editor-support/cocosbuilder/CCControlButtonLoader.h"
#include "editor-support/cocosbuilder/CCControlLoader.h"
#include "editor-support/cocosbuilder/CCLabelBMFontLoader.h"
#include "editor-support/cocosbuilder/CCLabelTTFLoader.h"
#include "editor-support/cocosbuilder/CCLayerColorLoader.h"
#include "editor-support/cocosbuilder/CCLayerGradientLoader.h"
#include "editor-support/cocosbuilder/CCLayerLoader.h"
#include "editor-support/cocosbuilder/CCMenuItemImageLoader.h"
#include "editor-support/cocosbuilder/CCMenuItemLoader.h"
#include "editor-support/cocosbuilder/CCMenuLoader.h"
#include "editor-support/cocosbuilder/CCNode+CCBRelativePositioning.h"
#include "editor-support/cocosbuilder/CCNodeLoader.h"
#include "editor-support/cocosbuilder/CCNodeLoaderLibrary.h"
#include "editor-support/cocosbuilder/CCNodeLoaderListener.h"
#include "editor-support/cocosbuilder/CCParticleSystemQuadLoader.h"
#include "editor-support/cocosbuilder/CCScale9SpriteLoader.h"
#include "editor-support/cocosbuilder/CCScrollViewLoader.h"
#include "editor-support/cocosbuilder/CCSpriteLoader.h"
#endif // __EDITOR_SUPPORT_COCOSBUILDER_H__
@@ -13,7 +13,7 @@
using namespace cocos2d;
namespace creator {
static CameraNode* _cameraInstance;
static CameraNode* _cameraInstance = nullptr;
CameraNode::CameraNode()
@@ -25,6 +25,15 @@ namespace creator {
CameraNode::~CameraNode()
{
if (!_commands.empty())
{
for (const auto& c : _commands)
{
delete c.beforeVisitCommand;
delete c.afterVisitCommand;
}
_commands.clear();
}
_cameraInstance = nullptr;
}
@@ -46,12 +46,12 @@ bool PhysicsAABBQueryCallback::ReportFixture(b2Fixture* fixture)
return true;
}
b2Fixture* PhysicsAABBQueryCallback::getFixture()
b2Fixture* PhysicsAABBQueryCallback::getFixture() const
{
return _fixtures.size() > 0 ? _fixtures[0] : nullptr;
}
const std::vector<b2Fixture*> PhysicsAABBQueryCallback::getFixtures() const
const std::vector<b2Fixture*>& PhysicsAABBQueryCallback::getFixtures() const
{
return _fixtures;
}
@@ -42,8 +42,8 @@ public:
virtual bool ReportFixture(b2Fixture* fixture);
b2Fixture* getFixture();
const std::vector<b2Fixture*> getFixtures() const;
b2Fixture* getFixture() const;
const std::vector<b2Fixture*>& getFixtures() const;
protected:
b2Vec2 _point;
@@ -29,7 +29,7 @@
#include "cocos2d.h"
namespace creator {
class CC_DLL PhysicsContactImpulse : public cocos2d::Ref
class CC_DLL PhysicsContactImpulse
{
public:
PhysicsContactImpulse();
@@ -12,22 +12,22 @@ PhysicsContactListener::PhysicsContactListener()
PhysicsContactListener::~PhysicsContactListener() {
}
void PhysicsContactListener::setBeginContact(std::function<void(b2Contact* contact)> callback)
void PhysicsContactListener::setBeginContact(const std::function<void(b2Contact* contact)>& callback)
{
_beginContact = callback;
}
void PhysicsContactListener::setEndContact(std::function<void(b2Contact* contact)> callback)
void PhysicsContactListener::setEndContact(const std::function<void(b2Contact* contact)>& callback)
{
_endContact = callback;
}
void PhysicsContactListener::setPreSolve(std::function<void(b2Contact* contact)> callback)
void PhysicsContactListener::setPreSolve(const std::function<void(b2Contact* contact)>& callback)
{
_preSolve = callback;
}
void PhysicsContactListener::setPostSolve(std::function<void(b2Contact* contact, const PhysicsContactImpulse* impulse)> callback)
void PhysicsContactListener::setPostSolve(const std::function<void(b2Contact* contact, const PhysicsContactImpulse* impulse)>& callback)
{
_postSolve = callback;
}
@@ -41,16 +41,16 @@ public:
PhysicsContactListener();
virtual ~PhysicsContactListener();
void setBeginContact(std::function<void(b2Contact* contact)> callback);
void setEndContact(std::function<void(b2Contact* contact)> callback);
void setPreSolve(std::function<void(b2Contact* contact)> callback);
void setPostSolve(std::function<void(b2Contact* contact, const PhysicsContactImpulse* impulse)> callback);
void setBeginContact(const std::function<void(b2Contact* contact)>& callback);
void setEndContact(const std::function<void(b2Contact* contact)>& callback);
void setPreSolve(const std::function<void(b2Contact* contact)>& callback);
void setPostSolve(const std::function<void(b2Contact* contact, const PhysicsContactImpulse* impulse)>& callback);
virtual void BeginContact(b2Contact* contact);
virtual void EndContact(b2Contact* contact);
virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold);
virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse);
virtual void BeginContact(b2Contact* contact) override;
virtual void EndContact(b2Contact* contact) override;
virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold) override;
virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) override;
void registerContactFixture(b2Fixture* fixture);
void unregisterContactFixture(b2Fixture* fixture);
@@ -29,7 +29,7 @@
#include "cocos2d.h"
namespace creator {
class CC_DLL PhysicsManifoldWrapper : public cocos2d::Ref
class CC_DLL PhysicsManifoldWrapper
{
public:
PhysicsManifoldWrapper();
@@ -55,23 +55,23 @@ float32 PhysicsRayCastCallback::ReportFixture(b2Fixture* fixture, const b2Vec2&
return fraction;
}
std::vector<b2Fixture*>& PhysicsRayCastCallback::getFixtures() {
const std::vector<b2Fixture*>& PhysicsRayCastCallback::getFixtures() const {
return _fixtures;
}
std::vector<b2Vec2>& PhysicsRayCastCallback::getPoints() {
const std::vector<b2Vec2>& PhysicsRayCastCallback::getPoints() const {
return _points;
}
std::vector<b2Vec2>& PhysicsRayCastCallback::getNormals() {
const std::vector<b2Vec2>& PhysicsRayCastCallback::getNormals() const {
return _normals;
}
std::vector<float>& PhysicsRayCastCallback::getFractions() {
const std::vector<float>& PhysicsRayCastCallback::getFractions() const {
return _fractions;
}
int PhysicsRayCastCallback::getType() {
int PhysicsRayCastCallback::getType() const {
return _rayCastType;
}
@@ -40,12 +40,12 @@ public:
virtual float32 ReportFixture(b2Fixture* fixture, const b2Vec2& point, const b2Vec2& normal, float32 fraction);
std::vector<b2Fixture*>& getFixtures();
std::vector<b2Vec2>& getPoints();
std::vector<b2Vec2>& getNormals();
std::vector<float>& getFractions();
const std::vector<b2Fixture*>& getFixtures() const;
const std::vector<b2Vec2>& getPoints() const;
const std::vector<b2Vec2>& getNormals() const;
const std::vector<float>& getFractions() const;
int getType();
int getType() const;
protected:
int _rayCastType;
@@ -29,7 +29,7 @@
#include "cocos2d.h"
namespace creator {
class CC_DLL PhysicsWorldManifoldWrapper : public cocos2d::Ref
class CC_DLL PhysicsWorldManifoldWrapper
{
public:
PhysicsWorldManifoldWrapper();
@@ -13,7 +13,7 @@ class Bone;
class Slot;
class Animation;
class Armature : public virtual IAnimateble, public virtual BaseObject
class Armature : public BaseObject, public IAnimateble
{
BIND_CLASS_TYPE(Armature);
@@ -6,7 +6,7 @@
DRAGONBONES_NAMESPACE_BEGIN
class CCArmatureDisplay : public cocos2d::Node, public virtual IArmatureDisplay
class CCArmatureDisplay : public cocos2d::Node, public IArmatureDisplay
{
public:
/** @private */
@@ -3,8 +3,9 @@ DRAGONBONES_NAMESPACE_BEGIN
std::size_t BaseObject::_hashCode = 0;
std::size_t BaseObject::_defaultMaxCount = 5000;
std::map<std::size_t, std::size_t> BaseObject::_maxCountMap;
std::map<std::size_t, std::vector<BaseObject*>> BaseObject::_poolsMap;
std::unordered_map<std::size_t, std::size_t> BaseObject::_maxCountMap;
std::unordered_map<std::size_t, std::vector<BaseObject*>> BaseObject::_poolsMap;
BaseObject::RecycleOrDestroyCallback BaseObject::_recycleOrDestroyCallback = nullptr;
void BaseObject::_returnObject(BaseObject* object)
{
@@ -23,13 +24,24 @@ void BaseObject::_returnObject(BaseObject* object)
{
DRAGONBONES_ASSERT(false, "The object aleady in pool.");
}
if (_recycleOrDestroyCallback != nullptr)
_recycleOrDestroyCallback(object, 0);
}
else
{
if (_recycleOrDestroyCallback != nullptr)
_recycleOrDestroyCallback(object, 1);
delete object;
}
}
void BaseObject::setObjectRecycleOrDestroyCallback(const std::function<void(BaseObject*, int)>& cb)
{
_recycleOrDestroyCallback = cb;
}
void BaseObject::setMaxCount(std::size_t classTypeIndex, std::size_t maxCount)
{
if (classTypeIndex)
@@ -116,7 +128,11 @@ void BaseObject::clearPool(std::size_t classTypeIndex)
BaseObject::BaseObject() :
hashCode(BaseObject::_hashCode++)
{}
BaseObject::~BaseObject(){}
BaseObject::~BaseObject()
{
int i = 0;
++i;
}
void BaseObject::returnToPool()
{
@@ -124,4 +140,4 @@ void BaseObject::returnToPool()
_returnObject(this);
}
DRAGONBONES_NAMESPACE_END
DRAGONBONES_NAMESPACE_END
@@ -19,15 +19,19 @@ DRAGONBONES_NAMESPACE_BEGIN
class BaseObject
{
public:
typedef std::function<void(BaseObject*,int)> RecycleOrDestroyCallback;
private:
static std::size_t _hashCode;
static std::size_t _defaultMaxCount;
static std::map<std::size_t, std::size_t> _maxCountMap;
static std::map<std::size_t, std::vector<BaseObject*>> _poolsMap;
static std::unordered_map<std::size_t, std::size_t> _maxCountMap;
static std::unordered_map<std::size_t, std::vector<BaseObject*>> _poolsMap;
static RecycleOrDestroyCallback _recycleOrDestroyCallback;
static void _returnObject(BaseObject *object);
public:
static void setObjectRecycleOrDestroyCallback(const RecycleOrDestroyCallback& cb);
static void setMaxCount(std::size_t classTypeIndex, std::size_t maxCount);
static void clearPool(std::size_t classTypeIndex);
@@ -58,7 +62,7 @@ public:
/** @private */
BaseObject();
/** @private */
virtual ~BaseObject() = 0;
virtual ~BaseObject();
protected:
virtual void _onClear() = 0;
@@ -6,6 +6,7 @@
#include <algorithm>
#include <vector>
#include <map>
#include <unordered_map>
#include <tuple>
#include <functional>
#include <sstream>
@@ -144,4 +145,4 @@ inline int indexOf(const std::vector<T>& vector, const T& value)
DRAGONBONES_NAMESPACE_END
#endif // DRAGONBONES_H
#endif // DRAGONBONES_H
+3 -14
View File
@@ -796,18 +796,13 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response
if (_scheduler != nullptr)
{
_scheduler->performFunctionInCocosThread([this, response, request]{
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
request->release();
@@ -970,18 +965,12 @@ void HttpClient::dispatchResponseCallbacks()
if (response)
{
HttpRequest *request = response->getHttpRequest();
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
+4 -15
View File
@@ -109,18 +109,13 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response
if (nullptr != _scheduler)
{
_scheduler->performFunctionInCocosThread([this, response, request]{
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
request->release();
@@ -145,7 +140,7 @@ static int processTask(HttpClient* client, HttpRequest* request, NSString* reque
NSMutableURLRequest *nsrequest = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalAndRemoteCacheData
timeoutInterval:HttpClient::getInstance()->getTimeoutForConnect()];
timeoutInterval:request->getTimeout()];
//set request type
[nsrequest setHTTPMethod:requestType];
@@ -460,18 +455,12 @@ void HttpClient::dispatchResponseCallbacks()
if (response)
{
HttpRequest *request = response->getHttpRequest();
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
+2 -14
View File
@@ -145,18 +145,12 @@ void HttpClient::networkThreadAlone(HttpRequest* request, HttpResponse* response
if (nullptr != _scheduler)
{
_scheduler->performFunctionInCocosThread([this, response, request]{
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
request->release();
@@ -488,18 +482,12 @@ void HttpClient::dispatchResponseCallbacks()
if (response)
{
HttpRequest *request = response->getHttpRequest();
const ccHttpRequestCallback& callback = request->getCallback();
Ref* pTarget = request->getTarget();
SEL_HttpResponse pSelector = request->getSelector();
const ccHttpRequestCallback& callback = request->getResponseCallback();
if (callback != nullptr)
{
callback(this, response);
}
else if (pTarget && pSelector)
{
(pTarget->*pSelector)(this, response);
}
response->release();
// do not release in other thread
+8 -4
View File
@@ -120,29 +120,33 @@ public:
* Set the timeout value for connecting.
*
* @param value the timeout value for connecting.
* @deprecated Please use `HttpRequest.setTimeout` instead.
*/
void setTimeoutForConnect(int value);
CC_DEPRECATED_ATTRIBUTE void setTimeoutForConnect(int value);
/**
* Get the timeout value for connecting.
*
* @return int the timeout value for connecting.
* @deprecated Please use `HttpRequest.getTimeout` instead.
*/
int getTimeoutForConnect();
CC_DEPRECATED_ATTRIBUTE int getTimeoutForConnect();
/**
* Set the timeout value for reading.
*
* @param value the timeout value for reading.
* @deprecated Please use `HttpRequest.setTimeout` instead.
*/
void setTimeoutForRead(int value);
CC_DEPRECATED_ATTRIBUTE void setTimeoutForRead(int value);
/**
* Get the timeout value for reading.
*
* @return int the timeout value for reading.
* @deprecated Please use `HttpRequest.setTimeout` instead.
*/
int getTimeoutForRead();
CC_DEPRECATED_ATTRIBUTE int getTimeoutForRead();
HttpCookie* getCookie() const {return _cookie; }
+30 -103
View File
@@ -26,11 +26,14 @@
#ifndef __HTTP_REQUEST_H__
#define __HTTP_REQUEST_H__
#include <string>
#include <vector>
#include "base/CCRef.h"
#include "base/ccMacros.h"
#include <string>
#include <vector>
#include <functional>
/**
* @addtogroup network
* @{
@@ -43,9 +46,7 @@ namespace network {
class HttpClient;
class HttpResponse;
typedef std::function<void(HttpClient* client, HttpResponse* response)> ccHttpRequestCallback;
typedef void (cocos2d::Ref::*SEL_HttpResponse)(HttpClient* client, HttpResponse* response);
#define httpresponse_selector(_SELECTOR) (cocos2d::network::SEL_HttpResponse)(&_SELECTOR)
typedef std::function<void(HttpClient*/* client*/, HttpResponse*/* response*/)> ccHttpRequestCallback;
/**
* Defines the object which users must packed for HttpClient::send(HttpRequest*) method.
@@ -85,20 +86,15 @@ public:
*/
HttpRequest()
: _requestType(Type::UNKNOWN)
, _pTarget(nullptr)
, _pSelector(nullptr)
, _pCallback(nullptr)
, _pUserData(nullptr)
, _callback(nullptr)
, _userData(nullptr)
, _timeoutInSeconds(10.0f)
{
}
/** Destructor. */
virtual ~HttpRequest()
{
if (_pTarget)
{
_pTarget->release();
}
}
/**
@@ -218,11 +214,11 @@ public:
* You can attach a customed data in each request, and get it back in response callback.
* But you need to new/delete the data pointer manully.
*
* @param pUserData the string pointer
* @param userData the string pointer
*/
inline void setUserData(void* pUserData)
inline void setUserData(void* userData)
{
_pUserData = pUserData;
_userData = userData;
}
/**
@@ -233,32 +229,9 @@ public:
*/
inline void* getUserData() const
{
return _pUserData;
return _userData;
}
/**
* Set the target and related callback selector.
* When response come back, it would call (pTarget->*pSelector) to process something.
*
* @param pTarget the target object pointer.
* @param pSelector the callback function.
*/
CC_DEPRECATED_ATTRIBUTE inline void setResponseCallback(Ref* pTarget, SEL_CallFuncND pSelector)
{
doSetResponseCallback(pTarget, (SEL_HttpResponse)pSelector);
}
/**
* Set the target and related callback selector of HttpRequest object.
* When response come back, we would call (pTarget->*pSelector) to process response data.
*
* @param pTarget the target object pointer.
* @param pSelector the SEL_HttpResponse function.
*/
inline void setResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
{
doSetResponseCallback(pTarget, pSelector);
}
/**
* Set response callback function of HttpRequest object.
* When response come back, we would call _pCallback to process response data.
@@ -267,46 +240,7 @@ public:
*/
inline void setResponseCallback(const ccHttpRequestCallback& callback)
{
_pCallback = callback;
}
/**
* Get the target of callback selector funtion, mainly used by HttpClient.
*
* @return Ref* the target of callback selector funtion
*/
inline Ref* getTarget() const
{
return _pTarget;
}
/**
* This sub class is just for migration SEL_CallFuncND to SEL_HttpResponse,someday this way will be removed.
*
* @lua NA
*/
class _prxy
{
public:
/** Constructor. */
_prxy( SEL_HttpResponse cb ) :_cb(cb) {}
/** Destructor. */
~_prxy(){};
/** Destructor. */
operator SEL_HttpResponse() const { return _cb; }
CC_DEPRECATED_ATTRIBUTE operator SEL_CallFuncND() const { return (SEL_CallFuncND) _cb; }
protected:
SEL_HttpResponse _cb;
};
/**
* Get _prxy object by the _pSelector.
*
* @return _prxy the _prxy object
*/
inline _prxy getSelector() const
{
return _prxy(_pSelector);
_callback = callback;
}
/**
@@ -314,9 +248,9 @@ public:
*
* @return const ccHttpRequestCallback& ccHttpRequestCallback callback function.
*/
inline const ccHttpRequestCallback& getCallback() const
inline const ccHttpRequestCallback& getResponseCallback() const
{
return _pCallback;
return _callback;
}
/**
@@ -325,9 +259,9 @@ public:
* @param pHeaders the string vector of custom-defined headers.
*/
inline void setHeaders(const std::vector<std::string>& headers)
{
_headers = headers;
}
{
_headers = headers;
}
/**
* Get custom headers.
@@ -339,20 +273,14 @@ public:
return _headers;
}
private:
inline void doSetResponseCallback(Ref* pTarget, SEL_HttpResponse pSelector)
inline void setTimeout(float timeoutInSeconds)
{
if (_pTarget)
{
_pTarget->release();
}
_pTarget = pTarget;
_pSelector = pSelector;
if (_pTarget)
{
_pTarget->retain();
}
_timeoutInSeconds = timeoutInSeconds;
}
inline float getTimeout() const
{
return _timeoutInSeconds;
}
protected:
@@ -361,11 +289,10 @@ protected:
std::string _url; /// target url that this request is sent to
std::vector<char> _requestData; /// used for POST
std::string _tag; /// user defined tag, to identify different requests in response callback
Ref* _pTarget; /// callback target of pSelector function
SEL_HttpResponse _pSelector; /// callback function, e.g. MyLayer::onHttpResponse(HttpClient *sender, HttpResponse * response)
ccHttpRequestCallback _pCallback; /// C++11 style callbacks
void* _pUserData; /// You can add your customed data here
std::vector<std::string> _headers; /// custom http headers
ccHttpRequestCallback _callback; /// C++11 style callbacks
void* _userData; /// You can add your customed data here
std::vector<std::string> _headers; /// custom http headers
float _timeoutInSeconds;
};
}
+29 -20
View File
@@ -403,10 +403,9 @@ SIOClientImpl::SIOClientImpl(const Uri& uri, const std::string& caFilePath) :
SIOClientImpl::~SIOClientImpl()
{
if (_connected)
disconnect();
assert(!_connected);
_ws->release();
CC_SAFE_RELEASE(_ws);
}
void SIOClientImpl::handshake()
@@ -466,6 +465,7 @@ void SIOClientImpl::handshakeResponse(HttpClient* /*sender*/, HttpResponse *resp
client.second->getDelegate()->onError(client.second, response->getErrorBuffer());
}
onClose(nullptr);
return;
}
@@ -627,7 +627,7 @@ void SIOClientImpl::disconnect()
SocketIO::getInstance()->removeSocket(_uri.getAuthority());
// Close websocket connection should be at last.
_ws->close();
_ws->closeAsync();
}
SIOClientImpl* SIOClientImpl::create(const Uri& uri, const std::string& caFilePath)
@@ -657,13 +657,14 @@ void SIOClientImpl::connectToEndpoint(const std::string& endpoint)
SocketIOPacket *packet = SocketIOPacket::createPacketWithType("connect", _version);
packet->setEndpoint(endpoint);
this->send(packet);
delete packet;
}
void SIOClientImpl::disconnectFromEndpoint(const std::string& endpoint)
{
_clients.erase(endpoint);
size_t clientCount = _clients.size();
if (_clients.empty() || endpoint == "/")
if (clientCount == 1 || endpoint == "/")
{
CCLOGINFO("SIOClientImpl::disconnectFromEndpoint out of endpoints, checking for disconnect");
@@ -677,6 +678,7 @@ void SIOClientImpl::disconnectFromEndpoint(const std::string& endpoint)
std::string s = "0::" + path;
_ws->send(s);
_clients.erase(endpoint);
}
}
@@ -685,6 +687,7 @@ void SIOClientImpl::heartbeat(float /*dt*/)
SocketIOPacket *packet = SocketIOPacket::createPacketWithType("heartbeat", _version);
this->send(packet);
delete packet;
CCLOGINFO("Heartbeat sent");
}
@@ -699,6 +702,7 @@ void SIOClientImpl::send(const std::string& endpoint, const std::string& s)
packet->setEndpoint(endpoint);
packet->addData(s);
this->send(packet);
delete packet;
break;
}
case SocketIOPacket::SocketIOVersion::V10x:
@@ -729,6 +733,7 @@ void SIOClientImpl::emit(const std::string& endpoint, const std::string& eventna
packet->setEvent(eventname);
packet->addData(args);
this->send(packet);
delete packet;
}
void SIOClientImpl::onOpen(WebSocket* /*ws*/)
@@ -998,6 +1003,7 @@ void SIOClientImpl::onClose(WebSocket* /*ws*/)
Director::getInstance()->getScheduler()->unscheduleAllForTarget(this);
SocketIO::getInstance()->removeSocket(_uri.getAuthority());
_clients.clear();
}
this->release();
@@ -1015,15 +1021,13 @@ SIOClient::SIOClient(const std::string& path, SIOClientImpl* impl, SocketIO::SIO
, _socket(impl)
, _delegate(&delegate)
{
static uint32_t instanceIdCounter = 0;
_instanceId = instanceIdCounter++;
}
SIOClient::~SIOClient()
{
if (_connected)
{
_socket->disconnectFromEndpoint(_path);
}
assert(!_connected);
}
void SIOClient::onOpen()
@@ -1067,11 +1071,11 @@ void SIOClient::emit(const std::string& eventname, const std::string& args)
void SIOClient::disconnect()
{
_connected = false;
_socket->disconnectFromEndpoint(_path);
this->release();
if (_connected)
{
_connected = false;
_socket->disconnectFromEndpoint(_path);
}
}
void SIOClient::socketClosed()
@@ -1111,6 +1115,11 @@ void SIOClient::setTag(const char* tag)
_tag = tag;
}
uint32_t SIOClient::getInstanceId() const
{
return _instanceId;
}
//begin SocketIO methods
SocketIO *SocketIO::_inst = nullptr;
@@ -1135,17 +1144,17 @@ void SocketIO::destroyInstance()
CC_SAFE_DELETE(_inst);
}
SIOClient* SocketIO::connect(SocketIO::SIODelegate& delegate, const std::string& uri)
SIOClient* SocketIO::connect(SIODelegate& delegate, const std::string& uri)
{
return SocketIO::connect(uri, delegate);
}
SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& delegate)
SIOClient* SocketIO::connect(const std::string& uri, SIODelegate& delegate)
{
return SocketIO::connect(uri, delegate, "");
}
SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& delegate, const std::string& caFilePath)
SIOClient* SocketIO::connect(const std::string& uri, SIODelegate& delegate, const std::string& caFilePath)
{
Uri uriObj = Uri::parse(uri);
@@ -1172,7 +1181,7 @@ SIOClient* SocketIO::connect(const std::string& uri, SocketIO::SIODelegate& dele
//check if already connected to endpoint, handle
c = socket->getClient(path);
if(c == nullptr)
if (c == nullptr)
{
c = new (std::nothrow) SIOClient(path, socket, delegate);

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