Add AssetsManager to iOS & Mac & Android & win32 (#1405)

* Add incomplete AssetsManager to iOS & Mac

* remove Android.mk refer on Xcode project config

* re-add assetmanager for android

* re-add assetmanager for win32 project config

* remove unused macro define for win32

* remove unused marco define COCOS2D_JAVASCRIPT

* added header include for assetsManager

* Add CCAsyncTaskPool

* Fix AssetsManager event trigger issue

* update win32 project config, added CCAsyncTaskPool

* add CCAsyncTaskPool to extensions Android.mk
This commit is contained in:
leda
2018-07-23 17:50:04 +08:00
committed by minggo
parent db7bfafe39
commit b3b37cf457
30 changed files with 588 additions and 605 deletions
@@ -933,6 +933,16 @@
B291B51D1D4A106A00BBB345 /* libtiff.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B291B5191D4A106A00BBB345 /* libtiff.a */; };
B291B51E1D4A106A00BBB345 /* libwebp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = B291B51A1D4A106A00BBB345 /* libwebp.a */; };
BA0DAAEF1DB76F2C00EE23AD /* libwebp.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BA0DAAEE1DB76F2C00EE23AD /* libwebp.a */; };
BA21055821008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21055721008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp */; };
BA21055921008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21055721008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp */; };
BA21055A21009A2600E19975 /* AssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054721008AC300E19975 /* AssetsManagerEx.cpp */; };
BA21055B21009A2900E19975 /* CCEventAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054921008AC300E19975 /* CCEventAssetsManagerEx.cpp */; };
BA21055C21009A2C00E19975 /* Manifest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054D21008AC300E19975 /* Manifest.cpp */; };
BA21055D21009A5500E19975 /* Manifest.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054D21008AC300E19975 /* Manifest.cpp */; };
BA21055E21009A5700E19975 /* AssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054721008AC300E19975 /* AssetsManagerEx.cpp */; };
BA21055F21009A5A00E19975 /* CCEventAssetsManagerEx.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA21054921008AC300E19975 /* CCEventAssetsManagerEx.cpp */; };
BA5A5C9A21045D750026C732 /* CCAsyncTaskPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA5A5C9821045D750026C732 /* CCAsyncTaskPool.cpp */; };
BA5A5C9B21045D750026C732 /* CCAsyncTaskPool.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BA5A5C9821045D750026C732 /* CCAsyncTaskPool.cpp */; };
BA68D77D1D62F4A500B7A3F9 /* shapes.cc in Sources */ = {isa = PBXBuildFile; fileRef = BA68D7701D62F4A500B7A3F9 /* shapes.cc */; };
BA68D77E1D62F4A500B7A3F9 /* shapes.cc in Sources */ = {isa = PBXBuildFile; fileRef = BA68D7701D62F4A500B7A3F9 /* shapes.cc */; };
BA68D77F1D62F4A500B7A3F9 /* shapes.h in Headers */ = {isa = PBXBuildFile; fileRef = BA68D7711D62F4A500B7A3F9 /* shapes.h */; };
@@ -1509,6 +1519,19 @@
B291B5191D4A106A00BBB345 /* libtiff.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libtiff.a; path = ../external/ios/libs/libtiff.a; sourceTree = "<group>"; };
B291B51A1D4A106A00BBB345 /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../external/ios/libs/libwebp.a; sourceTree = "<group>"; };
BA0DAAEE1DB76F2C00EE23AD /* libwebp.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libwebp.a; path = ../external/mac/libs/libwebp.a; sourceTree = "<group>"; };
BA21054721008AC300E19975 /* AssetsManagerEx.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = AssetsManagerEx.cpp; sourceTree = "<group>"; };
BA21054821008AC300E19975 /* AssetsManagerEx.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AssetsManagerEx.h; sourceTree = "<group>"; };
BA21054921008AC300E19975 /* CCEventAssetsManagerEx.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCEventAssetsManagerEx.cpp; sourceTree = "<group>"; };
BA21054A21008AC300E19975 /* CCEventAssetsManagerEx.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCEventAssetsManagerEx.h; sourceTree = "<group>"; };
BA21054D21008AC300E19975 /* Manifest.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = Manifest.cpp; sourceTree = "<group>"; };
BA21054E21008AC300E19975 /* Manifest.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Manifest.h; sourceTree = "<group>"; };
BA21054F21008AC300E19975 /* cocos-ext.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "cocos-ext.h"; sourceTree = "<group>"; };
BA21055021008AC300E19975 /* ExtensionExport.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtensionExport.h; sourceTree = "<group>"; };
BA21055121008AC300E19975 /* ExtensionMacros.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ExtensionMacros.h; sourceTree = "<group>"; };
BA21055621008B6600E19975 /* jsb_cocos2dx_extension_auto.hpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.h; path = jsb_cocos2dx_extension_auto.hpp; sourceTree = "<group>"; };
BA21055721008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = jsb_cocos2dx_extension_auto.cpp; sourceTree = "<group>"; };
BA5A5C9821045D750026C732 /* CCAsyncTaskPool.cpp */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.cpp; path = CCAsyncTaskPool.cpp; sourceTree = "<group>"; };
BA5A5C9921045D750026C732 /* CCAsyncTaskPool.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = CCAsyncTaskPool.h; sourceTree = "<group>"; };
BA68D7701D62F4A500B7A3F9 /* shapes.cc */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = shapes.cc; sourceTree = "<group>"; };
BA68D7711D62F4A500B7A3F9 /* shapes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = shapes.h; sourceTree = "<group>"; };
BA68D7721D62F4A500B7A3F9 /* utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = utils.h; sourceTree = "<group>"; };
@@ -1610,6 +1633,7 @@
50272538190BF1B900AAF4ED /* cocos2d.h */,
46FDDAE9202ADDCE00931238 /* base */,
46FDDA2C202ACC6A00931238 /* renderer */,
BA21050A21008AC200E19975 /* extensions */,
1A57033E180BD0490088DEC7 /* external */,
1551A341158F2AB200E66CFE /* Frameworks */,
46A170851807CE87005B8026 /* math */,
@@ -2011,6 +2035,8 @@
469302632046AE05004A3D6C /* jsb_gfx_auto.hpp */,
469302592046AE05004A3D6C /* jsb_renderer_auto.cpp */,
469302822046AE05004A3D6C /* jsb_renderer_auto.hpp */,
BA21055721008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp */,
BA21055621008B6600E19975 /* jsb_cocos2dx_extension_auto.hpp */,
);
path = auto;
sourceTree = "<group>";
@@ -2224,6 +2250,8 @@
46FDDAFA202ADDCE00931238 /* base64.h */,
46FDDB0A202ADDCE00931238 /* CCAutoreleasePool.cpp */,
46FDDB39202ADDCE00931238 /* CCAutoreleasePool.h */,
BA5A5C9821045D750026C732 /* CCAsyncTaskPool.cpp */,
BA5A5C9921045D750026C732 /* CCAsyncTaskPool.h */,
46FDDB42202ADDCE00931238 /* ccCArray.cpp */,
46FDDB45202ADDCE00931238 /* ccCArray.h */,
46FDDB26202ADDCE00931238 /* ccConfig.h */,
@@ -2544,6 +2572,31 @@
name = ios;
sourceTree = "<group>";
};
BA21050A21008AC200E19975 /* extensions */ = {
isa = PBXGroup;
children = (
BA21054621008AC300E19975 /* assets-manager */,
BA21054F21008AC300E19975 /* cocos-ext.h */,
BA21055021008AC300E19975 /* ExtensionExport.h */,
BA21055121008AC300E19975 /* ExtensionMacros.h */,
);
name = extensions;
path = ../extensions;
sourceTree = "<group>";
};
BA21054621008AC300E19975 /* assets-manager */ = {
isa = PBXGroup;
children = (
BA21054721008AC300E19975 /* AssetsManagerEx.cpp */,
BA21054821008AC300E19975 /* AssetsManagerEx.h */,
BA21054921008AC300E19975 /* CCEventAssetsManagerEx.cpp */,
BA21054A21008AC300E19975 /* CCEventAssetsManagerEx.h */,
BA21054D21008AC300E19975 /* Manifest.cpp */,
BA21054E21008AC300E19975 /* Manifest.h */,
);
path = "assets-manager";
sourceTree = "<group>";
};
BA68D76E1D62F4A500B7A3F9 /* poly2tri */ = {
isa = PBXGroup;
children = (
@@ -3272,6 +3325,7 @@
469304582046AE06004A3D6C /* EventDispatcher.cpp in Sources */,
1A52DAF8205BB81400350EE3 /* CCThreadPool.cpp in Sources */,
46AE3FFB2092F3A600F3A228 /* inspector_io.cc in Sources */,
BA5A5C9A21045D750026C732 /* CCAsyncTaskPool.cpp in Sources */,
4DED48221DFFA4AF0070C5C4 /* b2Fixture.cpp in Sources */,
46FDDB65202ADDCE00931238 /* ccRandom.cpp in Sources */,
46FDDAB9202ACC6A00931238 /* FrameBuffer.cpp in Sources */,
@@ -3458,6 +3512,7 @@
4DED48601DFFA4AF0070C5C4 /* b2GearJoint.cpp in Sources */,
469303842046AE05004A3D6C /* MappingUtils.cpp in Sources */,
4617865F2052607E008256E1 /* jsb_xmlhttprequest.cpp in Sources */,
BA21055821008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */,
469304082046AE06004A3D6C /* jsb_global.cpp in Sources */,
50ABC0151926664800A911A9 /* CCImage.cpp in Sources */,
4DED48341DFFA4AF0070C5C4 /* b2ChainAndCircleContact.cpp in Sources */,
@@ -3481,6 +3536,9 @@
1A28FF9D1F20AFAB007A1D9D /* SRWebSocket.m in Sources */,
46FDDB8F202ADDCE00931238 /* ccUtils.cpp in Sources */,
1A29D796205666F500168D9A /* jsb_opengl_utils.cpp in Sources */,
BA21055A21009A2600E19975 /* AssetsManagerEx.cpp in Sources */,
BA21055B21009A2900E19975 /* CCEventAssetsManagerEx.cpp in Sources */,
BA21055C21009A2C00E19975 /* Manifest.cpp in Sources */,
1A28FF931F20AFAB007A1D9D /* NSURLRequest+SRWebSocket.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
@@ -3520,6 +3578,7 @@
46FDDC69202D733800931238 /* CCApplication-ios.mm in Sources */,
4DED47E71DFFA4AF0070C5C4 /* b2DynamicTree.cpp in Sources */,
ED3057C21BEC78A80083C3ED /* xxhash.c in Sources */,
BA5A5C9B21045D750026C732 /* CCAsyncTaskPool.cpp in Sources */,
ED30578C1BEC77510083C3ED /* ioapi.cpp in Sources */,
4617866C2052609B008256E1 /* jsb_cocos2dx_network_auto.cpp in Sources */,
4DED48411DFFA4AF0070C5C4 /* b2Contact.cpp in Sources */,
@@ -3653,6 +3712,7 @@
469303BF2046AE05004A3D6C /* jsb_renderer_auto.cpp in Sources */,
4DED48391DFFA4AF0070C5C4 /* b2ChainAndPolygonContact.cpp in Sources */,
4617864F205224D6008256E1 /* HttpAsynConnection-apple.m in Sources */,
BA21055921008B6600E19975 /* jsb_cocos2dx_extension_auto.cpp in Sources */,
4DED480F1DFFA4AF0070C5C4 /* b2Settings.cpp in Sources */,
1A52DB8E2060DEF500350EE3 /* jsb_platfrom_apple.mm in Sources */,
503DD8E71926736A00CD74DD /* CCEAGLView-ios.mm in Sources */,
@@ -3705,6 +3765,9 @@
4DED48051DFFA4AF0070C5C4 /* b2Draw.cpp in Sources */,
1A52DB8D2060B12600350EE3 /* jsb_platfrom_ios.mm in Sources */,
4DED47EF1DFFA4AF0070C5C4 /* b2ChainShape.cpp in Sources */,
BA21055E21009A5700E19975 /* AssetsManagerEx.cpp in Sources */,
BA21055F21009A5A00E19975 /* CCEventAssetsManagerEx.cpp in Sources */,
BA21055D21009A5500E19975 /* Manifest.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
+15 -2
View File
@@ -20,6 +20,7 @@
<ClCompile Include="..\cocos\audio\win32\AudioEngine-win32.cpp" />
<ClCompile Include="..\cocos\audio\win32\AudioPlayer.cpp" />
<ClCompile Include="..\cocos\base\base64.cpp" />
<ClCompile Include="..\cocos\base\CCAsyncTaskPool.cpp" />
<ClCompile Include="..\cocos\base\CCAutoreleasePool.cpp" />
<ClCompile Include="..\cocos\base\ccCArray.cpp" />
<ClCompile Include="..\cocos\base\CCConfiguration.cpp" />
@@ -96,6 +97,7 @@
<ClCompile Include="..\cocos\renderer\Types.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_auto.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_extension_auto.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_network_auto.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_gfx_auto.cpp" />
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_renderer_auto.cpp" />
@@ -137,6 +139,9 @@
<ClCompile Include="..\cocos\scripting\js-bindings\manual\jsb_xmlhttprequest.cpp" />
<ClCompile Include="..\cocos\storage\local-storage\LocalStorage.cpp" />
<ClCompile Include="..\cocos\ui\edit-box\EditBox-win32.cpp" />
<ClCompile Include="..\extensions\assets-manager\AssetsManagerEx.cpp" />
<ClCompile Include="..\extensions\assets-manager\CCEventAssetsManagerEx.cpp" />
<ClCompile Include="..\extensions\assets-manager\Manifest.cpp" />
<ClCompile Include="..\external\sources\ConvertUTF\ConvertUTF.c" />
<ClCompile Include="..\external\sources\ConvertUTF\ConvertUTFWrapper.cpp" />
<ClCompile Include="..\external\sources\firefox\mozilla\Assertions.cpp" />
@@ -160,6 +165,7 @@
<ClInclude Include="..\cocos\audio\win32\AudioMacros.h" />
<ClInclude Include="..\cocos\audio\win32\AudioPlayer.h" />
<ClInclude Include="..\cocos\base\base64.h" />
<ClInclude Include="..\cocos\base\CCAsyncTaskPool.h" />
<ClInclude Include="..\cocos\base\CCAutoreleasePool.h" />
<ClInclude Include="..\cocos\base\ccCArray.h" />
<ClInclude Include="..\cocos\base\ccConfig.h" />
@@ -258,6 +264,7 @@
<ClInclude Include="..\cocos\renderer\Types.h" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_audioengine_auto.hpp" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_auto.hpp" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_extension_auto.hpp" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_network_auto.hpp" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_gfx_auto.hpp" />
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_renderer_auto.hpp" />
@@ -310,6 +317,12 @@
<ClInclude Include="..\cocos\scripting\js-bindings\manual\jsb_xmlhttprequest.hpp" />
<ClInclude Include="..\cocos\storage\local-storage\LocalStorage.h" />
<ClInclude Include="..\cocos\ui\edit-box\EditBox.h" />
<ClInclude Include="..\extensions\assets-manager\AssetsManagerEx.h" />
<ClInclude Include="..\extensions\assets-manager\CCEventAssetsManagerEx.h" />
<ClInclude Include="..\extensions\assets-manager\Manifest.h" />
<ClInclude Include="..\extensions\cocos-ext.h" />
<ClInclude Include="..\extensions\ExtensionExport.h" />
<ClInclude Include="..\extensions\ExtensionMacros.h" />
<ClInclude Include="..\external\sources\ConvertUTF\ConvertUTF.h" />
<ClInclude Include="..\external\sources\firefox\GLConsts.h" />
<ClInclude Include="..\external\sources\firefox\mozilla\Assertions.h" />
@@ -419,7 +432,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\cocos;$(ProjectDir)..\external\sources;$(ProjectDir)..\cocos\renderer\gfx;$(ProjectDir)..\cocos\renderer;$(ProjectDir)..\cocos\platform;$(ProjectDir)..\external\win32\include\zlib;$(ProjectDir)..\external\win32\include\v8;$(ProjectDir)..\external\sources\firefox;$(projectDir)..;$(ProjectDir)..\external\win32\include;$(ProjectDir)..\external\win32\include\uv</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_USRDLL;_EXPORT_DLL_;USING_V8_SHARED;_LIB;COCOS2D_DEBUG=1;JS_HAVE____INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;XP_WIN;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;HAVE_INSPECTOR;_WINDOWS;_WIN32;__MWERKS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;CC_STATIC;_USRDLL;USING_V8_SHARED;_LIB;COCOS2D_DEBUG=1;JS_HAVE____INTN;JS_INTPTR_TYPE=int;XP_WIN;_CRT_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_WINDOWS;_WIN32;__MWERKS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -460,7 +473,7 @@ xcopy /Y /Q "$(ProjectDir)..\external\win32\libs\Debug\*.*" "$(OutDir)"</Command
</PreBuildEvent>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\cocos;$(ProjectDir)..\external\sources;$(ProjectDir)..\cocos\renderer\gfx;$(ProjectDir)..\cocos\renderer;$(ProjectDir)..\cocos\platform;$(ProjectDir)..\external\win32\include\zlib;$(ProjectDir)..\external\win32\include\v8;$(ProjectDir)..\external\sources\firefox;$(projectDir)..;$(ProjectDir)..\external\win32\include;$(ProjectDir)..\external\win32\include\uv;</AdditionalIncludeDirectories>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;_USRDLL;_EXPORT_DLL_;USING_V8_SHARED;_LIB;JS_HAVE____INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;XP_WIN;_CRT_SECURE_NO_WARNINGS;_USRJSSTATIC;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;HAVE_INSPECTOR;_WINDOWS;_WIN32;__MWERKS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>NDEBUG;WIN32;_WINDOWS;CC_STATIC;_USRDLL;USING_V8_SHARED;_LIB;JS_HAVE____INTN;JS_INTPTR_TYPE=int;XP_WIN;_CRT_SECURE_NO_WARNINGS;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_WINDOWS;_WIN32;__MWERKS__;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeader>
</PrecompiledHeader>
+45
View File
@@ -407,6 +407,21 @@
<ClCompile Include="..\cocos\audio\win32\AudioPlayer.cpp">
<Filter>audio\win32</Filter>
</ClCompile>
<ClCompile Include="..\extensions\assets-manager\AssetsManagerEx.cpp">
<Filter>extensions\assets-manager</Filter>
</ClCompile>
<ClCompile Include="..\extensions\assets-manager\CCEventAssetsManagerEx.cpp">
<Filter>extensions\assets-manager</Filter>
</ClCompile>
<ClCompile Include="..\extensions\assets-manager\Manifest.cpp">
<Filter>extensions\assets-manager</Filter>
</ClCompile>
<ClCompile Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_extension_auto.cpp">
<Filter>js-bindings\auto</Filter>
</ClCompile>
<ClCompile Include="..\cocos\base\CCAsyncTaskPool.cpp">
<Filter>base</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\cocos\base\base64.h">
@@ -968,6 +983,30 @@
<ClInclude Include="..\cocos\audio\include\Export.h">
<Filter>audio\include</Filter>
</ClInclude>
<ClInclude Include="..\extensions\cocos-ext.h">
<Filter>extensions</Filter>
</ClInclude>
<ClInclude Include="..\extensions\ExtensionExport.h">
<Filter>extensions</Filter>
</ClInclude>
<ClInclude Include="..\extensions\ExtensionMacros.h">
<Filter>extensions</Filter>
</ClInclude>
<ClInclude Include="..\extensions\assets-manager\AssetsManagerEx.h">
<Filter>extensions\assets-manager</Filter>
</ClInclude>
<ClInclude Include="..\extensions\assets-manager\CCEventAssetsManagerEx.h">
<Filter>extensions\assets-manager</Filter>
</ClInclude>
<ClInclude Include="..\extensions\assets-manager\Manifest.h">
<Filter>extensions\assets-manager</Filter>
</ClInclude>
<ClInclude Include="..\cocos\scripting\js-bindings\auto\jsb_cocos2dx_extension_auto.hpp">
<Filter>js-bindings\auto</Filter>
</ClInclude>
<ClInclude Include="..\cocos\base\CCAsyncTaskPool.h">
<Filter>base</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<Filter Include="base">
@@ -1057,6 +1096,12 @@
<Filter Include="audio\include">
<UniqueIdentifier>{d1b8a7c4-28cc-45b3-8276-494fbcf958d6}</UniqueIdentifier>
</Filter>
<Filter Include="extensions">
<UniqueIdentifier>{e6a42324-ff8d-469a-97e5-2579bf1396db}</UniqueIdentifier>
</Filter>
<Filter Include="extensions\assets-manager">
<UniqueIdentifier>{92ccd96e-a37d-42db-8c6b-ca683b0373ea}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<None Include="..\cocos\math\Mat4.inl">
+2 -1
View File
@@ -81,6 +81,7 @@ scripting/js-bindings/auto/jsb_cocos2dx_network_auto.cpp \
scripting/js-bindings/auto/jsb_renderer_auto.cpp \
scripting/js-bindings/auto/jsb_cocos2dx_auto.cpp \
scripting/js-bindings/auto/jsb_cocos2dx_audioengine_auto.cpp \
scripting/js-bindings/auto/jsb_cocos2dx_extension_auto.cpp \
scripting/js-bindings/manual/JavaScriptJavaBridge.cpp \
scripting/js-bindings/manual/jsb_opengl_manual.cpp \
scripting/js-bindings/manual/jsb_opengl_utils.cpp \
@@ -95,7 +96,6 @@ scripting/js-bindings/manual/jsb_socketio.cpp \
scripting/js-bindings/manual/jsb_websocket.cpp \
scripting/js-bindings/manual/jsb_xmlhttprequest.cpp \
scripting/js-bindings/manual/jsb_platform_android.cpp \
scripting/js-bindings/manual/JavaScriptJavaBridge.cpp \
scripting/js-bindings/jswrapper/config.cpp \
scripting/js-bindings/jswrapper/HandleObject.cpp \
scripting/js-bindings/jswrapper/MappingUtils.cpp \
@@ -162,6 +162,7 @@ LOCAL_STATIC_LIBRARIES += uv_static
LOCAL_STATIC_LIBRARIES += v8_static
LOCAL_STATIC_LIBRARIES += audioengine_static
LOCAL_STATIC_LIBRARIES += cocos_network_static
LOCAL_STATIC_LIBRARIES += cocos_extension_static
LOCAL_WHOLE_STATIC_LIBRARIES := cocos2dxandroid_static
LOCAL_WHOLE_STATIC_LIBRARIES += cpufeatures
+56
View File
@@ -0,0 +1,56 @@
/****************************************************************************
Copyright (c) 2010 cocos2d-x.org
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "base/CCAsyncTaskPool.h"
NS_CC_BEGIN
AsyncTaskPool* AsyncTaskPool::s_asyncTaskPool = nullptr;
AsyncTaskPool* AsyncTaskPool::getInstance()
{
if (s_asyncTaskPool == nullptr)
{
s_asyncTaskPool = new (std::nothrow) AsyncTaskPool();
}
return s_asyncTaskPool;
}
void AsyncTaskPool::destroyInstance()
{
delete s_asyncTaskPool;
s_asyncTaskPool = nullptr;
}
AsyncTaskPool::AsyncTaskPool()
{
}
AsyncTaskPool::~AsyncTaskPool()
{
}
NS_CC_END
+221
View File
@@ -0,0 +1,221 @@
/****************************************************************************
Copyright (c) 2013-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __CCSYNC_TASK_POOL_H_
#define __CCSYNC_TASK_POOL_H_
#include "CCPlatformDefine.h"
#include "platform/CCApplication.h"
#include "base/CCScheduler.h"
#include <vector>
#include <queue>
#include <memory>
#include <thread>
#include <mutex>
#include <condition_variable>
#include <future>
#include <functional>
#include <stdexcept>
/**
* @addtogroup base
* @{
*/
NS_CC_BEGIN
/**
* @class AsyncTaskPool
* @brief This class allows to perform background operations without having to manipulate threads.
* @js NA
*/
class CC_DLL AsyncTaskPool
{
public:
typedef std::function<void(void*)> TaskCallBack;
enum class TaskType
{
TASK_IO,
TASK_NETWORK,
TASK_OTHER,
TASK_MAX_TYPE,
};
/**
* Returns the shared instance of the async task pool.
*/
static AsyncTaskPool* getInstance();
/**
* Destroys the async task pool.
*/
static void destroyInstance();
/**
* Stop tasks.
*
* @param type Task type you want to stop.
*/
void stopTasks(TaskType type);
/**
* Enqueue a asynchronous task.
*
* @param type task type is io task, network task or others, each type of task has a thread to deal with it.
* @param callback callback when the task is finished. The callback is called in the main thread instead of task thread.
* @param callbackParam parameter used by the callback.
* @param f task can be lambda function.
* @lua NA
*/
template<class F>
inline void enqueue(TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f);
CC_CONSTRUCTOR_ACCESS:
AsyncTaskPool();
~AsyncTaskPool();
protected:
// thread tasks internally used
class ThreadTasks {
struct AsyncTaskCallBack
{
TaskCallBack callback;
void* callbackParam;
};
public:
ThreadTasks()
: _stop(false)
{
_thread = std::thread(
[this]
{
for(;;)
{
std::function<void()> task;
AsyncTaskCallBack callback;
{
std::unique_lock<std::mutex> lock(this->_queueMutex);
this->_condition.wait(lock,
[this]{ return this->_stop || !this->_tasks.empty(); });
if(this->_stop && this->_tasks.empty())
return;
task = std::move(this->_tasks.front());
callback = std::move(this->_taskCallBacks.front());
this->_tasks.pop();
this->_taskCallBacks.pop();
}
task();
Application::getInstance()->getScheduler()->performFunctionInCocosThread([&, callback]{ callback.callback(callback.callbackParam); });
}
}
);
}
~ThreadTasks()
{
{
std::unique_lock<std::mutex> lock(_queueMutex);
_stop = true;
while(_tasks.size())
_tasks.pop();
while (_taskCallBacks.size())
_taskCallBacks.pop();
}
_condition.notify_all();
_thread.join();
}
void clear()
{
std::unique_lock<std::mutex> lock(_queueMutex);
while(_tasks.size())
_tasks.pop();
while (_taskCallBacks.size())
_taskCallBacks.pop();
}
template<class F>
void enqueue(const TaskCallBack& callback, void* callbackParam, F&& f)
{
auto task = f;//std::bind(std::forward<F>(f), std::forward<Args>(args)...);
{
std::unique_lock<std::mutex> lock(_queueMutex);
// don't allow enqueueing after stopping the pool
if(_stop)
{
CC_ASSERT(0 && "already stop");
return;
}
AsyncTaskCallBack taskCallBack;
taskCallBack.callback = callback;
taskCallBack.callbackParam = callbackParam;
_tasks.emplace([task](){ task(); });
_taskCallBacks.emplace(taskCallBack);
}
_condition.notify_one();
}
private:
// need to keep track of thread so we can join them
std::thread _thread;
// the task queue
std::queue< std::function<void()> > _tasks;
std::queue<AsyncTaskCallBack> _taskCallBacks;
// synchronization
std::mutex _queueMutex;
std::condition_variable _condition;
bool _stop;
};
//tasks
ThreadTasks _threadTasks[int(TaskType::TASK_MAX_TYPE)];
static AsyncTaskPool* s_asyncTaskPool;
};
inline void AsyncTaskPool::stopTasks(TaskType type)
{
auto& threadTask = _threadTasks[(int)type];
threadTask.clear();
}
template<class F>
inline void AsyncTaskPool::enqueue(AsyncTaskPool::TaskType type, const TaskCallBack& callback, void* callbackParam, F&& f)
{
auto& threadTask = _threadTasks[(int)type];
threadTask.enqueue(callback, callbackParam, f);
}
NS_CC_END
// end group
/// @}
#endif //__CCSYNC_TASK_POOL_H_
@@ -527,48 +527,4 @@ func
{
},
};
/**
* @class EventListenerAssetsManagerEx
*/
cc.EventListenerAssetsManager = {
/**
* @method init
* @param {cc.AssetsManagerEx} arg0
* @param {function} arg1
* @return {bool}
*/
init : function (
assetsmanagerex,
func
)
{
return false;
},
/**
* @method create
* @param {cc.AssetsManagerEx} arg0
* @param {function} arg1
* @return {cc.EventListenerAssetsManagerEx}
*/
create : function (
assetsmanagerex,
func
)
{
return cc.EventListenerAssetsManagerEx;
},
/**
* @method EventListenerAssetsManagerEx
* @constructor
*/
EventListenerAssetsManagerEx : function (
)
{
},
};
};
@@ -260,9 +260,6 @@ static bool js_cocos2dx_extension_EventAssetsManagerEx_constructor(se::State& s)
SE_BIND_CTOR(js_cocos2dx_extension_EventAssetsManagerEx_constructor, __jsb_cocos2d_extension_EventAssetsManagerEx_class, js_cocos2d_extension_EventAssetsManagerEx_finalize)
extern se::Object* __jsb_cocos2d_EventCustom_proto;
static bool js_cocos2d_extension_EventAssetsManagerEx_finalize(se::State& s)
{
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::extension::EventAssetsManagerEx)", s.nativeThisObject());
@@ -277,7 +274,7 @@ SE_BIND_FINALIZE_FUNC(js_cocos2d_extension_EventAssetsManagerEx_finalize)
bool js_register_cocos2dx_extension_EventAssetsManagerEx(se::Object* obj)
{
auto cls = se::Class::create("EventAssetsManager", obj, __jsb_cocos2d_EventCustom_proto, _SE(js_cocos2dx_extension_EventAssetsManagerEx_constructor));
auto cls = se::Class::create("EventAssetsManager", obj, nullptr, _SE(js_cocos2dx_extension_EventAssetsManagerEx_constructor));
cls->defineFunction("getAssetsManagerEx", _SE(js_cocos2dx_extension_EventAssetsManagerEx_getAssetsManagerEx));
cls->defineFunction("getDownloadedFiles", _SE(js_cocos2dx_extension_EventAssetsManagerEx_getDownloadedFiles));
@@ -879,6 +876,52 @@ static bool js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle(se::St
}
SE_BIND_FUNC(js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle)
static bool js_cocos2dx_extension_AssetsManagerEx_setEventCallback(se::State& s)
{
cocos2d::extension::AssetsManagerEx* cobj = (cocos2d::extension::AssetsManagerEx*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_extension_AssetsManagerEx_setVerifyCallback : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 1) {
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg0;
do {
if (args[0].isObject() && args[0].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[0]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx *larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
SE_PRECONDITION2_VOID(ok, "js_cocos2dx_extension_AssetsManagerEx_setEventCallback callback : Error processing arguments");
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
funcObj->call(args, thisObj, &rval);
};
arg0 = lambda;
}
else
{
arg0 = nullptr;
}
} while(false)
;
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_AssetsManagerEx_setEventCallback : Error processing arguments");
cobj->setEventCallback(arg0);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 1);
return false;
}
SE_BIND_FUNC(js_cocos2dx_extension_AssetsManagerEx_setEventCallback)
static bool js_cocos2dx_extension_AssetsManagerEx_setMaxConcurrentTask(se::State& s)
{
cocos2d::extension::AssetsManagerEx* cobj = (cocos2d::extension::AssetsManagerEx*)s.nativeThisObject();
@@ -1167,6 +1210,7 @@ bool js_register_cocos2dx_extension_AssetsManagerEx(se::Object* obj)
cls->defineFunction("getStoragePath", _SE(js_cocos2dx_extension_AssetsManagerEx_getStoragePath));
cls->defineFunction("update", _SE(js_cocos2dx_extension_AssetsManagerEx_update));
cls->defineFunction("setVersionCompareHandle", _SE(js_cocos2dx_extension_AssetsManagerEx_setVersionCompareHandle));
cls->defineFunction("setEventCallback", _SE(js_cocos2dx_extension_AssetsManagerEx_setEventCallback));
cls->defineFunction("setMaxConcurrentTask", _SE(js_cocos2dx_extension_AssetsManagerEx_setMaxConcurrentTask));
cls->defineFunction("getDownloadedBytes", _SE(js_cocos2dx_extension_AssetsManagerEx_getDownloadedBytes));
cls->defineFunction("getLocalManifest", _SE(js_cocos2dx_extension_AssetsManagerEx_getLocalManifest));
@@ -1187,170 +1231,19 @@ bool js_register_cocos2dx_extension_AssetsManagerEx(se::Object* obj)
return true;
}
se::Object* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto = nullptr;
se::Class* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class = nullptr;
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_init(se::State& s)
{
cocos2d::extension::EventListenerAssetsManagerEx* cobj = (cocos2d::extension::EventListenerAssetsManagerEx*)s.nativeThisObject();
SE_PRECONDITION2(cobj, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Invalid Native Object");
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 2) {
const cocos2d::extension::AssetsManagerEx* arg0 = nullptr;
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg1;
ok &= seval_to_native_ptr(args[0], &arg0);
do {
if (args[1].isObject() && args[1].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[1]);
jsThis.toObject()->attachObject(jsFunc.toObject());
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg1 = lambda;
}
else
{
arg1 = nullptr;
}
} while(false)
;
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Error processing arguments");
bool result = cobj->init(arg0, arg1);
ok &= boolean_to_seval(result, &s.rval());
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_init : Error processing arguments");
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
return false;
}
SE_BIND_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_init)
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_create(se::State& s)
{
const auto& args = s.args();
size_t argc = args.size();
CC_UNUSED bool ok = true;
if (argc == 2) {
cocos2d::extension::AssetsManagerEx* arg0 = nullptr;
std::function<void (cocos2d::extension::EventAssetsManagerEx *)> arg1;
ok &= seval_to_native_ptr(args[0], &arg0);
do {
if (args[1].isObject() && args[1].toObject()->isFunction())
{
se::Value jsThis(s.thisObject());
se::Value jsFunc(args[1]);
jsFunc.toObject()->root();
auto lambda = [=](cocos2d::extension::EventAssetsManagerEx* larg0) -> void {
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
CC_UNUSED bool ok = true;
se::ValueArray args;
args.resize(1);
ok &= native_ptr_to_seval<cocos2d::extension::EventAssetsManagerEx>((cocos2d::extension::EventAssetsManagerEx*)larg0, &args[0]);
se::Value rval;
se::Object* thisObj = jsThis.isObject() ? jsThis.toObject() : nullptr;
se::Object* funcObj = jsFunc.toObject();
bool succeed = funcObj->call(args, thisObj, &rval);
if (!succeed) {
se::ScriptEngine::getInstance()->clearException();
}
};
arg1 = lambda;
}
else
{
arg1 = nullptr;
}
} while(false)
;
SE_PRECONDITION2(ok, false, "js_cocos2dx_extension_EventListenerAssetsManagerEx_create : Error processing arguments");
auto result = cocos2d::extension::EventListenerAssetsManagerEx::create(arg0, arg1);
result->retain();
auto obj = se::Object::createObjectWithClass(__jsb_cocos2d_extension_EventListenerAssetsManagerEx_class);
obj->setPrivateData(result);
s.rval().setObject(obj);
return true;
}
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", (int)argc, 2);
return false;
}
SE_BIND_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_create)
SE_DECLARE_FINALIZE_FUNC(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
static bool js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor(se::State& s)
{
cocos2d::extension::EventListenerAssetsManagerEx* cobj = new (std::nothrow) cocos2d::extension::EventListenerAssetsManagerEx();
s.thisObject()->setPrivateData(cobj);
return true;
}
SE_BIND_CTOR(js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor, __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class, js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
extern se::Object* __jsb_cocos2d_EventListenerCustom_proto;
static bool js_cocos2d_extension_EventListenerAssetsManagerEx_finalize(se::State& s)
{
CCLOGINFO("jsbindings: finalizing JS object %p (cocos2d::extension::EventListenerAssetsManagerEx)", s.nativeThisObject());
cocos2d::extension::EventListenerAssetsManagerEx* cobj = (cocos2d::extension::EventListenerAssetsManagerEx*)s.nativeThisObject();
if (cobj->getReferenceCount() == 1)
cobj->autorelease();
else
cobj->release();
return true;
}
SE_BIND_FINALIZE_FUNC(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize)
bool js_register_cocos2dx_extension_EventListenerAssetsManagerEx(se::Object* obj)
{
auto cls = se::Class::create("EventListenerAssetsManager", obj, __jsb_cocos2d_EventListenerCustom_proto, _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_constructor));
cls->defineFunction("init", _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_init));
cls->defineStaticFunction("create", _SE(js_cocos2dx_extension_EventListenerAssetsManagerEx_create));
cls->defineFinalizeFunction(_SE(js_cocos2d_extension_EventListenerAssetsManagerEx_finalize));
cls->install();
JSBClassType::registerClass<cocos2d::extension::EventListenerAssetsManagerEx>(cls);
__jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto = cls->getProto();
__jsb_cocos2d_extension_EventListenerAssetsManagerEx_class = cls;
se::ScriptEngine::getInstance()->clearException();
return true;
}
bool register_all_cocos2dx_extension(se::Object* obj)
{
// Get the ns
se::Value nsVal;
if (!obj->getProperty("cc", &nsVal))
if (!obj->getProperty("jsb", &nsVal))
{
se::HandleObject jsobj(se::Object::createPlainObject());
nsVal.setObject(jsobj);
obj->setProperty("cc", nsVal);
obj->setProperty("jsb", nsVal);
}
se::Object* ns = nsVal.toObject();
js_register_cocos2dx_extension_AssetsManagerEx(ns);
js_register_cocos2dx_extension_EventListenerAssetsManagerEx(ns);
js_register_cocos2dx_extension_Manifest(ns);
js_register_cocos2dx_extension_EventAssetsManagerEx(ns);
return true;
@@ -69,12 +69,3 @@ SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_isResuming);
SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_create);
SE_DECLARE_FUNC(js_cocos2dx_extension_AssetsManagerEx_AssetsManagerEx);
extern se::Object* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_proto;
extern se::Class* __jsb_cocos2d_extension_EventListenerAssetsManagerEx_class;
bool js_register_cocos2d_extension_EventListenerAssetsManagerEx(se::Object* obj);
bool register_all_cocos2dx_extension(se::Object* obj);
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_init);
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_create);
SE_DECLARE_FUNC(js_cocos2dx_extension_EventListenerAssetsManagerEx_EventListenerAssetsManagerEx);
@@ -37,13 +37,6 @@ using namespace cocos2d;
using namespace cocos2d::extension;
using namespace cocos2d::experimental;
static bool jsb_cocos2d_extension_empty_func(se::State& s)
{
return true;
}
SE_BIND_FUNC(jsb_cocos2d_extension_empty_func)
static bool js_cocos2dx_extension_loadRemoteImage(se::State& s)
{
const auto& args = s.args();
@@ -243,106 +236,10 @@ static ThreadPool* getThreadPool()
return _threadPool;
}
static bool js_cocos2dx_extension_initTextureAsync(se::State& s)
{
const auto& args = s.args();
int argc = (int)args.size();
if (argc != 3)
{
SE_REPORT_ERROR("wrong number of arguments: %d, was expecting %d", argc, 3);
return false;
}
bool ok = false;
// get texture
cocos2d::Texture2D* texture = nullptr;
ok = seval_to_native_ptr(args[0], &texture);
SE_PRECONDITION2(ok, false, "Converting 'texture' failed!");
// get url
std::string url;
ok = seval_to_std_string(args[1], &url);
SE_PRECONDITION2(ok, false, "Converting 'url' failed!");
// get callback
se::Value func = args[2];
assert(func.isObject() && func.toObject()->isFunction());
func.toObject()->root();
auto onCallback = [=](bool success){
se::ScriptEngine::getInstance()->clearException();
se::AutoHandleScope hs;
se::ValueArray args;
args.resize(1);
args[0].setBoolean(success);
func.toObject()->call(args, nullptr);
};
// getDataFromFile isn't thread safe since fullPathForFilename usage in getDataFromFile isn't.
// So we should pass full path to getDataFromFile to avoid multi-thread issues.
std::string fullPath = FileUtils::getInstance()->fullPathForFilename(url);
getThreadPool()->pushTask([texture, onCallback, fullPath](int tid){
Data data = FileUtils::getInstance()->getDataFromFile(fullPath);
if (!data.isNull())
{
Image* image = new (std::nothrow) Image();
if (image->initWithImageData(data.getBytes(), data.getSize()))
{
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=]() {
if (texture->initWithImage(image))
{
onCallback(true);
}
else
{
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to init texture with image.");
onCallback(false);
}
CC_SAFE_RELEASE(image);
});
return;
}
else
{
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to load image.");
CC_SAFE_RELEASE(image);
}
}
else
{
CCLOGERROR("js_cocos2dx_extension_initTextureAsync: Failed to load file.");
}
Director::getInstance()->getScheduler()->performFunctionInCocosThread([=](){
onCallback(false);
});
});
return true;
}
SE_BIND_FUNC(js_cocos2dx_extension_initTextureAsync)
bool register_all_cocos2dx_extension_manual(se::Object* obj)
{
// empty 'retain' 'release' implementation
se::Object* protosNeedEmptyRetainRelease[] = {
__jsb_cocos2d_extension_AssetsManagerEx_proto,
__jsb_cocos2d_extension_Manifest_proto
};
for (const auto& e : protosNeedEmptyRetainRelease)
{
e->defineFunction("retain", _SE(jsb_cocos2d_extension_empty_func));
e->defineFunction("release", _SE(jsb_cocos2d_extension_empty_func));
}
__jsbObj->defineFunction("loadRemoteImg", _SE(js_cocos2dx_extension_loadRemoteImage));
__jsbObj->defineFunction("initRemoteImg", _SE(js_cocos2dx_extension_initRemoteImage));
__jsbObj->defineFunction("initTextureAsync", _SE(js_cocos2dx_extension_initTextureAsync));
se::ScriptEngine::getInstance()->clearException();
@@ -2548,6 +2548,20 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
return ok;
}
bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret)
{
assert(ret != nullptr);
se::HandleObject obj(se::Object::createPlainObject());
obj->setProperty("md5", se::Value(v.md5));
obj->setProperty("path", se::Value(v.path));
obj->setProperty("compressed", se::Value(v.compressed));
obj->setProperty("size", se::Value(v.size));
obj->setProperty("downloadState", se::Value(v.downloadState));
ret->setObject(obj);
return true;
}
//FIXME: why v has to be a pointer?
//bool uniform_to_seval(const cocos2d::Uniform* v, se::Value* ret)
//{
@@ -2576,20 +2590,6 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
// return true;
//}
//
//bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret)
//{
// assert(ret != nullptr);
// se::HandleObject obj(se::Object::createPlainObject());
// obj->setProperty("md5", se::Value(v.md5));
// obj->setProperty("path", se::Value(v.path));
// obj->setProperty("compressed", se::Value(v.compressed));
// obj->setProperty("size", se::Value(v.size));
// obj->setProperty("downloadState", se::Value(v.downloadState));
// ret->setObject(obj);
//
// return true;
//}
//
//bool AffineTransform_to_seval(const cocos2d::AffineTransform& v, se::Value* ret)
//{
// assert(ret != nullptr);
@@ -32,7 +32,7 @@
#include "renderer/gfx/GFX.h"
#include "renderer/renderer/Renderer.h"
#include "network/CCDownloader.h"
//#include "extensions/cocos-ext.h"
#include "extensions/cocos-ext.h"
//#include "Box2D/Box2D.h"
#define SE_PRECONDITION2_VOID(condition, ...) \
@@ -275,7 +275,7 @@ bool std_unorderedmap_string_EffectProperty_to_seval(const std::unordered_map<st
bool EffectProperty_to_seval(const cocos2d::renderer::Effect::Property& v, se::Value* ret);
//bool uniform_to_seval(const cocos2d::Uniform* v, se::Value* ret);
//bool Quaternion_to_seval(const cocos2d::Quaternion& v, se::Value* ret);
//bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret);
bool ManifestAsset_to_seval(const cocos2d::extension::ManifestAsset& v, se::Value* ret);
//bool AffineTransform_to_seval(const cocos2d::AffineTransform& v, se::Value* ret);
////bool Viewport_to_seval(const cocos2d::experimental::Viewport& v, se::Value* ret);
bool Data_to_seval(const cocos2d::Data& v, se::Value* ret);
@@ -36,7 +36,6 @@
#include "cocos/scripting/js-bindings/auto/jsb_gfx_auto.hpp"
#include "cocos/scripting/js-bindings/auto/jsb_cocos2dx_auto.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_cocos2dx_extension_manual.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_global.h"
#include "cocos/scripting/js-bindings/manual/jsb_node.hpp"
#include "cocos/scripting/js-bindings/manual/jsb_conversions.hpp"
@@ -93,6 +92,7 @@ bool jsb_register_all_modules()
se->addRegisterCallback(register_all_cocos2dx);
se->addRegisterCallback(register_all_cocos2dx_manual);
se->addRegisterCallback(register_platform_bindings);
se->addRegisterCallback(register_all_cocos2dx_extension);
#if (CC_TARGET_PLATFORM == CC_PLATFORM_IOS || CC_TARGET_PLATFORM == CC_PLATFORM_MAC)
se->addRegisterCallback(register_javascript_objc_bridge);
+7 -7
View File
@@ -13,18 +13,18 @@ LOCAL_SRC_FILES := \
assets-manager/Manifest.cpp \
assets-manager/AssetsManagerEx.cpp \
assets-manager/CCEventAssetsManagerEx.cpp \
assets-manager/CCEventListenerAssetsManagerEx.cpp \
LOCAL_STATIC_LIBRARIES := cis
LOCAL_STATIC_LIBRARIES += cocos_chipmunk_static
$(LOCAL_PATH)/../cocos/base/CCAsyncTaskPool.cpp \
LOCAL_CXXFLAGS += -fexceptions
LOCAL_C_INCLUDES := $(LOCAL_PATH)
LOCAL_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/.. \
$(LOCAL_PATH)/../cocos \
$(LOCAL_PATH)/../cocos/platform \
$(LOCAL_PATH)/../external/sources \
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/. \
$(LOCAL_PATH)/.. \
$(LOCAL_PATH)/GUI/CCControlExtension \
$(LOCAL_PATH)/GUI/CCScrollView
include $(BUILD_STATIC_LIBRARY)
@@ -24,10 +24,11 @@
THE SOFTWARE.
****************************************************************************/
#include "AssetsManagerEx.h"
#include "CCEventListenerAssetsManagerEx.h"
#include "base/ccUTF8.h"
#include "base/CCAsyncTaskPool.h"
#include <stdio.h>
#include <errno.h>
#ifdef MINIZIP_FROM_SYSTEM
#include <minizip/unzip.h>
@@ -106,6 +107,7 @@ AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::stri
, _currConcurrentTask(0)
, _versionCompareHandle(handle)
, _verifyCallback(nullptr)
, _eventCallback(nullptr)
, _inited(false)
{
init(manifestUrl, storagePath);
@@ -114,9 +116,8 @@ AssetsManagerEx::AssetsManagerEx(const std::string& manifestUrl, const std::stri
void AssetsManagerEx::init(const std::string& manifestUrl, const std::string& storagePath)
{
// Init variables
// _eventDispatcher = Director::getInstance()->getEventDispatcher();
std::string pointer = StringUtils::format("%p", this);
_eventName = EventListenerAssetsManagerEx::LISTENER_ID + pointer;
_eventName = "__cc_assets_manager_" + pointer;
_fileUtils = FileUtils::getInstance();
network::DownloaderHints hints =
@@ -199,14 +200,14 @@ void AssetsManagerEx::initManifests()
{
_inited = false;
}
// Init remote manifest for future usage
_remoteManifest = new (std::nothrow) Manifest();
if (!_remoteManifest)
{
_inited = false;
}
if (!_inited)
{
CC_SAFE_RELEASE(_localManifest);
@@ -287,10 +288,10 @@ bool AssetsManagerEx::loadLocalManifest(Manifest* localManifest, const std::stri
}
}
prepareLocalManifest();
// Init temp manifest and remote manifest
initManifests();
if (!_inited)
{
return false;
@@ -335,7 +336,7 @@ bool AssetsManagerEx::loadLocalManifest(const std::string& manifestUrl)
}
}
}
// Ensure no search path of cached manifest is used to load this manifest
std::vector<std::string> searchPaths = _fileUtils->getSearchPaths();
if (cachedManifest)
@@ -411,7 +412,7 @@ bool AssetsManagerEx::loadRemoteManifest(Manifest* remoteManifest)
_remoteManifest = remoteManifest;
_remoteManifest->retain();
// Compare manifest version and set state
if (_localManifest->versionGreater(_remoteManifest, _versionCompareHandle))
if (_localManifest->versionGreaterOrEquals(_remoteManifest, _versionCompareHandle))
{
_updateState = State::UP_TO_DATE;
_fileUtils->removeDirectory(_tempStoragePath);
@@ -428,7 +429,7 @@ bool AssetsManagerEx::loadRemoteManifest(Manifest* remoteManifest)
std::string AssetsManagerEx::basename(const std::string& path) const
{
size_t found = path.find_last_of("/\\");
if (std::string::npos != found)
{
return path.substr(0, found);
@@ -468,7 +469,7 @@ void AssetsManagerEx::setStoragePath(const std::string& storagePath)
_storagePath = storagePath;
adjustPath(_storagePath);
_fileUtils->createDirectory(_storagePath);
_tempStoragePath = _storagePath;
_tempStoragePath.insert(_storagePath.size() - 1, TEMP_PACKAGE_SUFFIX);
_fileUtils->createDirectory(_tempStoragePath);
@@ -492,7 +493,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
return false;
}
const std::string rootPath = zip.substr(0, pos+1);
// Open the zip file
unzFile zipfile = unzOpen(FileUtils::getInstance()->getSuitableFOpen(zip).c_str());
if (! zipfile)
@@ -500,7 +501,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
CCLOG("AssetsManagerEx : can not open downloaded zip file %s\n", zip.c_str());
return false;
}
// Get info about the zip file
unz_global_info global_info;
if (unzGetGlobalInfo(zipfile, &global_info) != UNZ_OK)
@@ -509,7 +510,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
unzClose(zipfile);
return false;
}
// Buffer to hold data read from the zip file
char readBuffer[BUFFER_SIZE];
// Loop to extract all files.
@@ -533,7 +534,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
return false;
}
const std::string fullPath = rootPath + fileName;
// Check if this entry is a directory or a file.
const size_t filenameLength = strlen(fileName);
if (fileName[filenameLength-1] == '/')
@@ -568,7 +569,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
unzClose(zipfile);
return false;
}
// Create a file to store current file.
FILE *out = fopen(FileUtils::getInstance()->getSuitableFOpen(fullPath).c_str(), "wb");
if (!out)
@@ -578,7 +579,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
unzClose(zipfile);
return false;
}
// Write current file content to destinate file.
int error = UNZ_OK;
do
@@ -592,18 +593,18 @@ bool AssetsManagerEx::decompress(const std::string &zip)
unzClose(zipfile);
return false;
}
if (error > 0)
{
fwrite(readBuffer, error, 1, out);
}
} while(error > 0);
fclose(out);
}
unzCloseCurrentFile(zipfile);
// Goto next entry listed in the zip file.
if ((i+1) < global_info.number_entry)
{
@@ -615,7 +616,7 @@ bool AssetsManagerEx::decompress(const std::string &zip)
}
}
}
unzClose(zipfile);
return true;
}
@@ -628,12 +629,12 @@ void AssetsManagerEx::decompressDownloadedZip(const std::string &customId, const
std::string zipFile;
bool succeed;
};
AsyncData* asyncData = new AsyncData;
asyncData->customId = customId;
asyncData->zipFile = storagePath;
asyncData->succeed = false;
std::function<void(void*)> decompressFinished = [this](void* param) {
auto dataInner = reinterpret_cast<AsyncData*>(param);
if (dataInner->succeed)
@@ -650,14 +651,14 @@ void AssetsManagerEx::decompressDownloadedZip(const std::string &customId, const
}
delete dataInner;
};
// AsyncTaskPool::getInstance()->enqueue(AsyncTaskPool::TaskType::TASK_OTHER, decompressFinished, (void*)asyncData, [this, asyncData]() {
// // Decompress all compressed files
// if (decompress(asyncData->zipFile))
// {
// asyncData->succeed = true;
// }
// _fileUtils->removeFile(asyncData->zipFile);
// });
AsyncTaskPool::getInstance()->enqueue(AsyncTaskPool::TaskType::TASK_OTHER, decompressFinished, (void*)asyncData, [this, asyncData]() {
// Decompress all compressed files
if (decompress(asyncData->zipFile))
{
asyncData->succeed = true;
}
_fileUtils->removeFile(asyncData->zipFile);
});
}
void AssetsManagerEx::dispatchUpdateEvent(EventAssetsManagerEx::EventCode code, const std::string &assetId/* = ""*/, const std::string &message/* = ""*/, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/)
@@ -688,9 +689,11 @@ void AssetsManagerEx::dispatchUpdateEvent(EventAssetsManagerEx::EventCode code,
break;
}
EventAssetsManagerEx* event = new (std::nothrow) EventAssetsManagerEx(_eventName, this, code, assetId, message, curle_code, curlm_code);
// _eventDispatcher->dispatchEvent(event);
event->release();
if (_eventCallback != nullptr) {
EventAssetsManagerEx* event = new (std::nothrow) EventAssetsManagerEx(_eventName, this, code, assetId, message, curle_code, curlm_code);
_eventCallback(event);
event->release();
}
}
AssetsManagerEx::State AssetsManagerEx::getState() const
@@ -735,7 +738,7 @@ void AssetsManagerEx::parseVersion()
}
else
{
if (_localManifest->versionGreater(_remoteManifest, _versionCompareHandle))
if (_localManifest->versionGreaterOrEquals(_remoteManifest, _versionCompareHandle))
{
_updateState = State::UP_TO_DATE;
_fileUtils->removeDirectory(_tempStoragePath);
@@ -798,7 +801,7 @@ void AssetsManagerEx::parseManifest()
}
else
{
if (_localManifest->versionGreater(_remoteManifest, _versionCompareHandle))
if (_localManifest->versionGreaterOrEquals(_remoteManifest, _versionCompareHandle))
{
_updateState = State::UP_TO_DATE;
_fileUtils->removeDirectory(_tempStoragePath);
@@ -831,7 +834,7 @@ void AssetsManagerEx::prepareUpdate()
_downloadResumed = false;
_downloadedSize.clear();
_totalEnabled = false;
// Temporary manifest exists, previously updating and equals to the remote version, resuming previous download
if (_tempManifest && _tempManifest->isLoaded() && _tempManifest->isUpdating() && _tempManifest->versionEquals(_remoteManifest))
{
@@ -852,11 +855,11 @@ void AssetsManagerEx::prepareUpdate()
_fileUtils->createDirectory(_tempStoragePath);
_remoteManifest->saveToFile(_tempManifestPath);
}
// Temporary manifest will be used to register the download states of each asset,
// in this case, it equals remote manifest.
_tempManifest = _remoteManifest;
// Check difference between local manifest and remote manifest
std::unordered_map<std::string, Manifest::AssetDiff> diff_map = _localManifest->genDiff(_remoteManifest);
if (diff_map.size() == 0)
@@ -893,7 +896,7 @@ void AssetsManagerEx::prepareUpdate()
_tempManifest->setUpdating(true);
// Save current download manifest information for resuming
_tempManifest->saveToFile(_tempManifestPath);
_totalWaitToDownload = _totalToDownload = (int)_downloadUnits.size();
}
}
@@ -927,7 +930,7 @@ void AssetsManagerEx::updateSucceed()
{
// Set temp manifest's updating
_tempManifest->setUpdating(false);
// Every thing is correctly downloaded, do the following
// 1. rename temporary manifest to valid manifest
_fileUtils->renameFile(_tempStoragePath, TEMP_MANIFEST_FILENAME, MANIFEST_FILENAME);
@@ -1099,7 +1102,7 @@ void AssetsManagerEx::updateAssets(const DownloadUnits& assets)
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_NO_LOCAL_MANIFEST);
return;
}
if (_updateState != State::UPDATING && _localManifest->isLoaded() && _remoteManifest->isLoaded())
{
_updateState = State::UPDATING;
@@ -1139,14 +1142,14 @@ void AssetsManagerEx::fileError(const std::string& identifier, const std::string
if (unitIt != _downloadUnits.end())
{
_totalWaitToDownload--;
DownloadUnit unit = unitIt->second;
_failedUnits.emplace(unit.customId, unit);
}
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ERROR_UPDATING, identifier, errorStr, errorCode, errorCodeInternal);
_tempManifest->setAssetDownloadState(identifier, Manifest::DownloadState::UNSTARTED);
_currConcurrentTask = MAX(0, _currConcurrentTask-1);
_currConcurrentTask = std::max(0, _currConcurrentTask-1);
queueDowload();
}
@@ -1154,7 +1157,7 @@ void AssetsManagerEx::fileSuccess(const std::string &customId, const std::string
{
// Set download state to SUCCESSED
_tempManifest->setAssetDownloadState(customId, Manifest::DownloadState::SUCCESSED);
auto unitIt = _failedUnits.find(customId);
// Found unit and delete it
if (unitIt != _failedUnits.end())
@@ -1162,21 +1165,21 @@ void AssetsManagerEx::fileSuccess(const std::string &customId, const std::string
// Remove from failed units list
_failedUnits.erase(unitIt);
}
unitIt = _downloadUnits.find(customId);
if (unitIt != _downloadUnits.end())
{
// Reduce count only when unit found in _downloadUnits
_totalWaitToDownload--;
_percentByFile = 100 * (float)(_totalToDownload - _totalWaitToDownload) / _totalToDownload;
// Notify progression event
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_PROGRESSION, "");
}
// Notify asset updated event
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::ASSET_UPDATED, customId);
_currConcurrentTask = MAX(0, _currConcurrentTask-1);
_currConcurrentTask = std::max(0, _currConcurrentTask-1);
queueDowload();
}
@@ -1245,7 +1248,7 @@ void AssetsManagerEx::onProgress(double total, double downloaded, const std::str
}
}
}
if (_totalEnabled && _updateState == State::UPDATING)
{
float currentPercent = 100 * _totalDownloaded / _totalSize;
@@ -1284,7 +1287,7 @@ void AssetsManagerEx::onSuccess(const std::string &/*srcUrl*/, const std::string
ok = _verifyCallback(storagePath, asset);
}
}
if (ok)
{
bool compressed = assetIt != assets.end() ? assetIt->second.compressed : false;
@@ -1321,7 +1324,7 @@ void AssetsManagerEx::batchDownload()
_totalSize += unit.size;
_sizeCollected++;
}
_queue.push_back(iter.first);
}
// All collected, enable total size
@@ -1329,7 +1332,7 @@ void AssetsManagerEx::batchDownload()
{
_totalEnabled = true;
}
queueDowload();
}
@@ -1340,17 +1343,17 @@ void AssetsManagerEx::queueDowload()
this->onDownloadUnitsFinished();
return;
}
while (_currConcurrentTask < _maxConcurrentTask && _queue.size() > 0)
{
std::string key = _queue.back();
_queue.pop_back();
_currConcurrentTask++;
DownloadUnit& unit = _downloadUnits[key];
_fileUtils->createDirectory(basename(unit.storagePath));
_downloader->createDownloadFileTask(unit.srcUrl, unit.storagePath, unit.customId);
_tempManifest->setAssetDownloadState(key, Manifest::DownloadState::DOWNLOADING);
}
if (_percentByFile / 100 > _nextSavePoint)
@@ -1368,7 +1371,7 @@ void AssetsManagerEx::onDownloadUnitsFinished()
{
// Save current download manifest information for resuming
_tempManifest->saveToFile(_tempManifestPath);
_updateState = State::FAIL_TO_UPDATE;
dispatchUpdateEvent(EventAssetsManagerEx::EventCode::UPDATE_FAILED);
}
@@ -75,6 +75,7 @@ public:
typedef std::function<int(const std::string& versionA, const std::string& versionB)> VersionCompareHandle;
typedef std::function<bool(const std::string& path, Manifest::Asset asset)> VerifyCallback;
typedef std::function<void(EventAssetsManagerEx *event)> EventCallback;
/** @brief Create function for creating a new AssetsManagerEx
@param manifestUrl The url for the local manifest file
@@ -187,6 +188,11 @@ public:
*/
void setVerifyCallback(const VerifyCallback& callback) {_verifyCallback = callback;};
/** @brief Set the event callback for receiving update process events
* @param callback The event callback function
*/
void setEventCallback(const EventCallback& callback) {_eventCallback = callback;};
CC_CONSTRUCTOR_ACCESS:
AssetsManagerEx(const std::string& manifestUrl, const std::string& storagePath);
@@ -387,6 +393,9 @@ private:
//! Callback function to verify the downloaded assets
VerifyCallback _verifyCallback;
//! Callback function to dispatch events
EventCallback _eventCallback;
//! Marker for whether the assets manager is inited
bool _inited;
};
@@ -31,8 +31,7 @@
NS_CC_EXT_BEGIN
EventAssetsManagerEx::EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, const std::string& assetId/* = "" */, const std::string& message/* = "" */, int curle_code/* = CURLE_OK*/, int curlm_code/* = CURLM_OK*/)
: EventCustom(eventName)
, _code(code)
: _code(code)
, _manager(manager)
, _message(message)
, _assetId(assetId)
@@ -26,8 +26,8 @@
#ifndef __cocos2d_libs__CCEventAssetsManagerEx__
#define __cocos2d_libs__CCEventAssetsManagerEx__
#include "base/CCEvent.h"
#include "base/CCEventCustom.h"
#include <string>
#include "base/CCRef.h"
#include "extensions/ExtensionMacros.h"
#include "extensions/ExtensionExport.h"
@@ -35,7 +35,7 @@ NS_CC_EXT_BEGIN
class AssetsManagerEx;
class CC_EX_DLL EventAssetsManagerEx : public cocos2d::EventCustom
class CC_EX_DLL EventAssetsManagerEx : public cocos2d::Ref
{
public:
//! Update events code
@@ -80,7 +80,7 @@ public:
int getTotalFiles() const;
CC_CONSTRUCTOR_ACCESS:
public:
/** Constructor */
EventAssetsManagerEx(const std::string& eventName, cocos2d::extension::AssetsManagerEx *manager, const EventCode &code, const std::string& assetId = "", const std::string& message = "", int curle_code = 0, int curlm_code = 0);
@@ -1,99 +0,0 @@
/****************************************************************************
Copyright (c) 2014-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#include "CCEventListenerAssetsManagerEx.h"
#include "CCEventAssetsManagerEx.h"
#include "AssetsManagerEx.h"
#include "base/ccUTF8.h"
NS_CC_EXT_BEGIN
const std::string EventListenerAssetsManagerEx::LISTENER_ID = "__cc_assets_manager_";
EventListenerAssetsManagerEx::EventListenerAssetsManagerEx()
: _onAssetsManagerExEvent(nullptr)
, _AssetsManagerEx(nullptr)
{
}
EventListenerAssetsManagerEx* EventListenerAssetsManagerEx::create(cocos2d::extension::AssetsManagerEx *AssetsManagerEx, const std::function<void(EventAssetsManagerEx*)>& callback)
{
EventListenerAssetsManagerEx* ret = new (std::nothrow) EventListenerAssetsManagerEx();
if (ret && ret->init(AssetsManagerEx, callback))
{
ret->autorelease();
}
else
{
CC_SAFE_DELETE(ret);
}
return ret;
}
bool EventListenerAssetsManagerEx::init(const AssetsManagerEx *AssetsManagerEx, const std::function<void(EventAssetsManagerEx*)>& callback)
{
bool ret = false;
_AssetsManagerEx = AssetsManagerEx;
_onAssetsManagerExEvent = callback;
auto func = [this](EventCustom *event) -> void
{
EventAssetsManagerEx *eventAssetsManagerEx = dynamic_cast<EventAssetsManagerEx*>(event);
_onAssetsManagerExEvent(eventAssetsManagerEx);
};
std::string pointer = StringUtils::format("%p", AssetsManagerEx);
if (EventListenerCustom::init(LISTENER_ID + pointer, func))
{
ret = true;
}
return ret;
}
EventListenerAssetsManagerEx* EventListenerAssetsManagerEx::clone()
{
EventListenerAssetsManagerEx* ret = new (std::nothrow) EventListenerAssetsManagerEx();
if (ret && ret->init(_AssetsManagerEx, _onAssetsManagerExEvent))
{
ret->autorelease();
}
else
{
CC_SAFE_DELETE(ret);
}
return ret;
}
bool EventListenerAssetsManagerEx::checkAvailable()
{
bool ret = false;
if (EventListener::checkAvailable() && _AssetsManagerEx != nullptr && _onAssetsManagerExEvent != nullptr)
{
ret = true;
}
return ret;
}
NS_CC_EXT_END
@@ -1,87 +0,0 @@
/****************************************************************************
Copyright (c) 2014-2016 Chukong Technologies Inc.
Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
#ifndef __cocos2d_libs__CCEventListenerAssetsManagerEx__
#define __cocos2d_libs__CCEventListenerAssetsManagerEx__
#include "base/CCEventListener.h"
#include "base/CCEventListenerCustom.h"
#include "extensions/ExtensionMacros.h"
#include "extensions/ExtensionExport.h"
NS_CC_EXT_BEGIN
class EventAssetsManagerEx;
class AssetsManagerEx;
/**
* Usage:
* auto dispatcher = Director::getInstance()->getEventDispatcher();
* auto manager = AssetsManagerEx::create(manifestUrl, storagePath);
* Adds a listener:
*
* auto callback = [](EventAssetsManagerEx* event){ do_some_thing(); };
* auto listener = EventListenerAssetsManagerEx::create(manager, callback);
* dispatcher->addEventListenerWithSceneGraphPriority(listener, one_node);
*
* Removes a listener
*
* dispatcher->removeEventListener(listener);
*/
class CC_EX_DLL EventListenerAssetsManagerEx : public cocos2d::EventListenerCustom
{
public:
friend class AssetsManagerEx;
/** Creates an event listener with type and callback.
* @param eventType The type of the event.
* @param callback The callback function when the specified event was emitted.
*/
static EventListenerAssetsManagerEx* create(AssetsManagerEx *AssetsManagerEx, const std::function<void(EventAssetsManagerEx*)>& callback);
/// Overrides
virtual bool checkAvailable() override;
virtual EventListenerAssetsManagerEx* clone() override;
CC_CONSTRUCTOR_ACCESS:
/** Constructor */
EventListenerAssetsManagerEx();
/** Initializes event with type and callback function */
bool init(const AssetsManagerEx *AssetsManagerEx, const std::function<void(EventAssetsManagerEx*)>& callback);
protected:
static const std::string LISTENER_ID;
std::function<void(EventAssetsManagerEx*)> _onAssetsManagerExEvent;
const AssetsManagerEx *_AssetsManagerEx;
//friend class luaEventListenerAssetsManagerEx;
};
NS_CC_EXT_END
#endif /* defined(__cocos2d_libs__CCEventListenerAssetsManagerEx__) */
+17 -1
View File
@@ -239,7 +239,7 @@ bool Manifest::versionEquals(const Manifest *b) const
return true;
}
bool Manifest::versionGreater(const Manifest *b, const std::function<int(const std::string& versionA, const std::string& versionB)>& handle) const
bool Manifest::versionGreaterOrEquals(const Manifest *b, const std::function<int(const std::string& versionA, const std::string& versionB)>& handle) const
{
std::string localVersion = getVersion();
std::string bVersion = b->getVersion();
@@ -255,6 +255,22 @@ bool Manifest::versionGreater(const Manifest *b, const std::function<int(const s
return greater;
}
bool Manifest::versionGreater(const Manifest *b, const std::function<int(const std::string& versionA, const std::string& versionB)>& handle) const
{
std::string localVersion = getVersion();
std::string bVersion = b->getVersion();
bool greater;
if (handle)
{
greater = handle(localVersion, bVersion) > 0;
}
else
{
greater = cmpVersion(localVersion, bVersion) > 0;
}
return greater;
}
std::unordered_map<std::string, Manifest::AssetDiff> Manifest::genDiff(const Manifest *b) const
{
std::unordered_map<std::string, AssetDiff> diff_map;
+8 -1
View File
@@ -174,7 +174,14 @@ protected:
*/
bool versionEquals(const Manifest *b) const;
/** @brief Check whether the version of this manifest is greater than another.
/** @brief Check whether the version of this manifest is greater or equals than another.
* @param b The other manifest
* @param [handle] Customized comparasion handle function
* @return Greater or not
*/
bool versionGreaterOrEquals(const Manifest *b, const std::function<int(const std::string& versionA, const std::string& versionB)>& handle) const;
/** @brief Check whether the version of this manifest is greater or equals than another.
* @param b The other manifest
* @param [handle] Customized comparasion handle function
* @return Greater or not
-1
View File
@@ -30,7 +30,6 @@
#include "assets-manager/AssetsManagerEx.h"
#include "assets-manager/CCEventAssetsManagerEx.h"
#include "assets-manager/CCEventListenerAssetsManagerEx.h"
#include "assets-manager/Manifest.h"
#endif /* __COCOS2D_EXT_H__ */
@@ -30,7 +30,7 @@ endif
LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
include $(BUILD_SHARED_LIBRARY)
@@ -86,7 +86,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include\glfw3;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -148,7 +148,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\storage;$(EngineRoot)cocos\editor-support;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\v8;$(EngineRoot)external\win32\include\chipmunk;$(EngineRoot)external\win32\include;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -30,7 +30,7 @@ endif
LOCAL_STATIC_LIBRARIES := cocos2dx_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
include $(BUILD_SHARED_LIBRARY)
@@ -86,7 +86,7 @@
<ClCompile>
<Optimization>Disabled</Optimization>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\v8;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_DEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<MinimalRebuild>false</MinimalRebuild>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
@@ -148,7 +148,7 @@ copy "$(ProjectDir)..\..\..\project.json" "$(OutDir)\" /Y</Command>
</Midl>
<ClCompile>
<AdditionalIncludeDirectories>$(ProjectDir)..\Classes;$(EngineRoot);$(EngineRoot)cocos;$(EngineRoot)cocos\base;$(EngineRoot)cocos\scripting\js-bindings\auto;$(EngineRoot)cocos\scripting\js-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external\win32\include\;$(EngineRoot)external\win32\include\v8;$(EngineRoot)extensions;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;COCOS2D_JAVASCRIPT=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;NDEBUG;XP_WIN;JS_HAVE___INTN;JS_INTPTR_TYPE=int;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ExceptionHandling>
</ExceptionHandling>
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
@@ -24,7 +24,7 @@ $(LOCAL_PATH)/../../../../../../../tools/simulator/libsimulator/lib/protobuf-lit
LOCAL_STATIC_LIBRARIES := cocos2d_simulator_static
LOCAL_STATIC_LIBRARIES += cocos2d_js_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
include $(BUILD_SHARED_LIBRARY)
@@ -24,7 +24,7 @@ $(LOCAL_PATH)/../../../../../../tools/simulator/libsimulator/lib/protobuf-lite
LOCAL_STATIC_LIBRARIES := cocos2d_simulator_static
LOCAL_STATIC_LIBRARIES += cocos2d_js_static
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2 -DCOCOS2D_JAVASCRIPT
LOCAL_EXPORT_CFLAGS := -DCOCOS2D_DEBUG=2
include $(BUILD_SHARED_LIBRARY)
@@ -81,7 +81,7 @@
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRJSSTATIC;_USRLIBSIMSTATIC;_WINSOCKAPI_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRLIBSIMSTATIC;_WINSOCKAPI_;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>
@@ -149,7 +149,7 @@ if exist "$(ProjectDir)..\..\..\..\..\simulator\win32\config.json" copy "$(Proje
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<ExceptionHandling>Sync</ExceptionHandling>
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRJSSTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>COCOS2D_DEBUG=1;WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGSNDEBUG;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;_USRLUASTATIC;_USRLIBSIMSTATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<DisableSpecificWarnings>4267;4251;4244;%(DisableSpecificWarnings)</DisableSpecificWarnings>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<ProgramDataBaseFileName>$(IntDir)vc$(PlatformToolsetVersion).pdb</ProgramDataBaseFileName>