From e31a6e61966029c3d8738b20f32a28a8cbc63cac Mon Sep 17 00:00:00 2001 From: WenhaiLin Date: Fri, 8 Apr 2016 18:43:44 +0800 Subject: [PATCH] Fixed compile fail on window --- native/build/cocos2d-win32.sln | 52 ++++ native/cocos/2d/CCActionTiledGrid.cpp | 2 +- native/cocos/2d/CCLabel.cpp | 2 +- native/cocos/2d/cocos2d_headers.props | 2 +- native/cocos/2d/cocos2dx.props | 2 +- native/cocos/2d/libcocos2d.vcxproj | 44 +++- native/cocos/2d/libcocos2d.vcxproj.filters | 123 +++++++++ .../cocostudio/Armature/CCDataReaderHelper.h | 3 +- .../cocostudio/Armature/DictionaryHelper.cpp | 234 ------------------ .../cocostudio/Armature/DictionaryHelper.h | 69 ------ .../cocos/platform/win32/CCDevice-win32.cpp | 4 +- 11 files changed, 224 insertions(+), 313 deletions(-) create mode 100644 native/build/cocos2d-win32.sln delete mode 100644 native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.cpp delete mode 100644 native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.h diff --git a/native/build/cocos2d-win32.sln b/native/build/cocos2d-win32.sln new file mode 100644 index 0000000000..40bd7439c3 --- /dev/null +++ b/native/build/cocos2d-win32.sln @@ -0,0 +1,52 @@ +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 12.0.21005.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libcocos2d", "..\cocos\2d\libcocos2d.vcxproj", "{98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "External", "External", "{92D54E36-7916-48EF-A951-224DD3B25442}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libSpine", "..\cocos\editor-support\spine\proj.win32\libSpine.vcxproj", "{B7C2A162-DEC9-4418-972E-240AB3CBFCAE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "libjscocos2d", "..\cocos\scripting\js-bindings\proj.win32\libjscocos2d.vcxproj", "{39379840-825A-45A0-B363-C09FFEF864BD}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|Win32 = Debug|Win32 + Release|ARM = Release|ARM + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|ARM.ActiveCfg = Debug|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.ActiveCfg = Debug|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Debug|Win32.Build.0 = Debug|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|ARM.ActiveCfg = Release|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.ActiveCfg = Release|Win32 + {98A51BA8-FC3A-415B-AC8F-8C7BD464E93E}.Release|Win32.Build.0 = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|ARM.ActiveCfg = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.ActiveCfg = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Debug|Win32.Build.0 = Debug|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|ARM.ActiveCfg = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.ActiveCfg = Release|Win32 + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE}.Release|Win32.Build.0 = Release|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Debug|ARM.ActiveCfg = Debug|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.ActiveCfg = Debug|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Debug|Win32.Build.0 = Debug|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Release|ARM.ActiveCfg = Release|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.ActiveCfg = Release|Win32 + {39379840-825A-45A0-B363-C09FFEF864BD}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {B7C2A162-DEC9-4418-972E-240AB3CBFCAE} = {92D54E36-7916-48EF-A951-224DD3B25442} + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection + GlobalSection(DPCodeReviewSolutionGUID) = preSolution + DPCodeReviewSolutionGUID = {00000000-0000-0000-0000-000000000000} + EndGlobalSection +EndGlobal diff --git a/native/cocos/2d/CCActionTiledGrid.cpp b/native/cocos/2d/CCActionTiledGrid.cpp index 0ebe7daf03..acfe8ae7af 100644 --- a/native/cocos/2d/CCActionTiledGrid.cpp +++ b/native/cocos/2d/CCActionTiledGrid.cpp @@ -70,7 +70,7 @@ bool ShakyTiles3D::initWithDuration(float duration, const Size& gridSize, int ra ShakyTiles3D* ShakyTiles3D::clone() const { // no copy constructor - return ShakyTiles3D::create(_duration, _gridSize, _randrange, -_shakeZ); + return ShakyTiles3D::create(_duration, _gridSize, _randrange, _shakeZ); } void ShakyTiles3D::update(float time) diff --git a/native/cocos/2d/CCLabel.cpp b/native/cocos/2d/CCLabel.cpp index f2aaf8a130..71013f99e1 100644 --- a/native/cocos/2d/CCLabel.cpp +++ b/native/cocos/2d/CCLabel.cpp @@ -1111,7 +1111,7 @@ void Label::enableBold() if (!_boldEnabled) { // bold is implemented with outline - enableShadow(Color4B::WHITE, Size(0.9,0), 0); + enableShadow(Color4B::WHITE, Size(0.9f, 0), 0); // add one to kerning setAdditionalKerning(_additionalKerning+1); _boldEnabled = true; diff --git a/native/cocos/2d/cocos2d_headers.props b/native/cocos/2d/cocos2d_headers.props index 6d53a14245..c59d17a1a1 100644 --- a/native/cocos/2d/cocos2d_headers.props +++ b/native/cocos/2d/cocos2d_headers.props @@ -7,7 +7,7 @@ - $(EngineRoot)external\win32\include;$(EngineRoot)cocos;$(EngineRoot)cocos\platform;$(EngineRoot)external\sources;$(EngineRoot)cocos\editor-support + $(EngineRoot)cocos;$(EngineRoot)external\win32\include;$(EngineRoot)cocos\platform;$(EngineRoot)external\sources;$(EngineRoot)cocos\editor-support;$(EngineRoot)external\win32\include\zlib;$(EngineRoot)external\win32\include\freetype _VARIADIC_MAX=10;%(PreprocessorDefinitions) diff --git a/native/cocos/2d/cocos2dx.props b/native/cocos/2d/cocos2dx.props index f65591e361..864e969df5 100644 --- a/native/cocos/2d/cocos2dx.props +++ b/native/cocos/2d/cocos2dx.props @@ -7,7 +7,7 @@ - opengl32.lib;glew32.lib;libzlib.lib;libwebp.lib;libiconv.lib;freetype.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) + opengl32.lib;glew32.lib;libzlib.lib;libiconv.lib;freetype.lib;winmm.lib;ws2_32.lib;%(AdditionalDependencies) $(OutDir);%(AdditionalLibraryDirectories) false diff --git a/native/cocos/2d/libcocos2d.vcxproj b/native/cocos/2d/libcocos2d.vcxproj index d905bfd767..702be75614 100644 --- a/native/cocos/2d/libcocos2d.vcxproj +++ b/native/cocos/2d/libcocos2d.vcxproj @@ -63,7 +63,7 @@ - ../../external/sqlite3/libraries/win32;$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) + $(EngineRoot)external\win32\libs;$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) ../../external/sqlite3/libraries/win32;$(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\lib;$(LibraryPath) @@ -75,7 +75,7 @@ Disabled - $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)extensions;$(EngineRoot)external\win32\include\zlib;$(EngineRoot)external\win32\include\freetype2;$(EngineRoot);%(AdditionalIncludeDirectories) + $(MSBuildProgramFiles32)\Microsoft SDKs\Windows\v7.1A\include;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories) WIN32;_USRDLL;_DEBUG;_WINDOWS;_LIB;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;COCOS2D_DEBUG=1;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS;_USE3DDLL;_EXPORT_DLL_;_USRSTUDIODLL;_USREXDLL;_USEGUIDLL;CC_ENABLE_CHIPMUNK_INTEGRATION=1;PROTOBUF_USE_DLLS;LIBPROTOBUF_EXPORTS;%(PreprocessorDefinitions) false EnableFastChecks @@ -214,6 +214,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + @@ -256,6 +257,24 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + + + + + + + + + + + + + + + + + + @@ -324,6 +343,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + @@ -488,6 +508,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + @@ -540,6 +561,24 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + + + + + + + + + + + + + + + + + + @@ -638,6 +677,7 @@ xcopy /Y /Q "$(ProjectDir)..\..\external\win32\libs\*.*" "$(OutDir)" + diff --git a/native/cocos/2d/libcocos2d.vcxproj.filters b/native/cocos/2d/libcocos2d.vcxproj.filters index adc60cd72b..878f0e028c 100644 --- a/native/cocos/2d/libcocos2d.vcxproj.filters +++ b/native/cocos/2d/libcocos2d.vcxproj.filters @@ -127,6 +127,9 @@ {ca5e1475-3bfd-4aae-ad54-2e19d5021b92} + + {0ddcb553-d230-4921-afd4-031a3644a034} + @@ -908,6 +911,66 @@ external\xxhash + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + base + + + ui\UIWidgets\ScrollWidget + @@ -1806,6 +1869,66 @@ external\xxhash + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + cocostudio\Armature + + + base + + + ui\UIWidgets\ScrollWidget + diff --git a/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.h b/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.h index ba1cf23d7a..af4d63f54f 100644 --- a/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.h +++ b/native/cocos/editor-support/cocostudio/Armature/CCDataReaderHelper.h @@ -28,11 +28,10 @@ THE SOFTWARE. #include "cocostudio/Armature/CCArmatureDefine.h" #include "cocostudio/Armature/CCDatas.h" #include "cocostudio/Armature/CCArmature.h" -#include "cocostudio/Armature/DictionaryHelper.h" +#include "cocostudio/DictionaryHelper.h" #include "cocostudio/CocosStudioExport.h" #include "json/document.h" -#include "DictionaryHelper.h" #include #include diff --git a/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.cpp b/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.cpp deleted file mode 100644 index f2c5db20aa..0000000000 --- a/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************** -Copyright (c) 2013-2016 Chukong Technologies Inc. - -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 "platform/CCPlatformMacros.h" -#include "cocostudio/Armature/DictionaryHelper.h" - -namespace cocostudio { - -static DictionaryHelper* sharedHelper = nullptr; - -DictionaryHelper::DictionaryHelper() -{ - -} - -DictionaryHelper::~DictionaryHelper() -{ - -} - -DictionaryHelper* DictionaryHelper::getInstance() -{ - if (!sharedHelper) { - sharedHelper = new (std::nothrow) DictionaryHelper(); - } - return sharedHelper; -} - -void DictionaryHelper::destroyInstance() -{ - CC_SAFE_DELETE(sharedHelper); -} - -const rapidjson::Value& DictionaryHelper::getSubDictionary_json(const rapidjson::Value &root, const char* key) -{ - return root[key]; -} - -const rapidjson::Value& DictionaryHelper::getSubDictionary_json(const rapidjson::Value &root, const char* key, int idx) -{ - return root[key][idx]; -} - -const rapidjson::Value& DictionaryHelper::getSubDictionary_json(const rapidjson::Value &root, int idx) -{ - return root[idx]; -} - -int DictionaryHelper::getIntValue_json(const rapidjson::Value& root, const char* key, int def) -{ - int nRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(key)); - CC_BREAK_IF(root[key].IsNull()); - nRet = root[key].GetInt(); - } while (0); - - return nRet; -} - - -float DictionaryHelper::getFloatValue_json(const rapidjson::Value& root,const char* key, float def) -{ - float fRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(key)); - CC_BREAK_IF(root[key].IsNull()); - fRet = (float)root[key].GetDouble(); - } while (0); - - return fRet; -} - -bool DictionaryHelper::getBooleanValue_json(const rapidjson::Value& root,const char* key, bool def) -{ - bool bRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(key)); - CC_BREAK_IF(root[key].IsNull()); - bRet = root[key].GetBool(); - } while (0); - - return bRet; -} - -const char* DictionaryHelper::getStringValue_json(const rapidjson::Value& root,const char* key, const char *def) -{ - const char* sRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(key)); - CC_BREAK_IF(root[key].IsNull()); - sRet = root[key].GetString(); - } while (0); - - return sRet; -} - - - -int DictionaryHelper::getArrayCount_json(const rapidjson::Value& root, const char* key, int def) -{ - int nRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(key)); - CC_BREAK_IF(root[key].IsNull()); - nRet = (int)(root[key].Size()); - } while (0); - - return nRet; -} - - -int DictionaryHelper::getIntValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, int def) -{ - int nRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.HasMember(arrayKey)); - CC_BREAK_IF(root[arrayKey].IsNull()); - CC_BREAK_IF(root[arrayKey][idx].IsNull()); - nRet = root[arrayKey][idx].GetInt(); - } while (0); - - return nRet; -} - - -float DictionaryHelper::getFloatValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, float def) -{ - float fRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(root[arrayKey].IsNull()); - CC_BREAK_IF(root[arrayKey][idx].IsNull()); - fRet = (float)root[arrayKey][idx].GetDouble(); - } while (0); - - return fRet; -} - -bool DictionaryHelper::getBoolValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, bool def) -{ - bool bRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(root[arrayKey].IsNull()); - CC_BREAK_IF(root[arrayKey][idx].IsNull()); - bRet = root[arrayKey][idx].GetBool(); - } while (0); - - return bRet; -} - -const char* DictionaryHelper::getStringValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, const char *def) -{ - const char *sRet = def; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(root[arrayKey].IsNull()); - CC_BREAK_IF(root[arrayKey][idx].IsNull()); - sRet = root[arrayKey][idx].GetString(); - } while (0); - - return sRet; -} - -const rapidjson::Value &DictionaryHelper::getDictionaryFromArray_json(const rapidjson::Value &root, const char* key,int idx) -{ - return root[key][idx]; -} - -bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root) -{ - bool bRet = false; - do { - CC_BREAK_IF(root.IsNull()); - bRet = true; - } while (0); - - return bRet; -} - -bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root,const char* key) -{ - bool bRet = false; - do { - CC_BREAK_IF(root.IsNull()); - bRet = root.HasMember(key); - } while (0); - - return bRet; -} - -bool DictionaryHelper::checkObjectExist_json(const rapidjson::Value &root, int index) -{ - bool bRet = false; - do { - CC_BREAK_IF(root.IsNull()); - CC_BREAK_IF(!root.IsArray()); - CC_BREAK_IF(index < 0 || root.Size() <= (unsigned int )index); - bRet = true; - } while (0); - - return bRet; -} - -} - diff --git a/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.h b/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.h deleted file mode 100644 index dda8524981..0000000000 --- a/native/cocos/editor-support/cocostudio/Armature/DictionaryHelper.h +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************** -Copyright (c) 2013-2016 Chukong Technologies Inc. - -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 __DICTIONARYHELPER_H__ -#define __DICTIONARYHELPER_H__ - -#include "json/document.h" -#include "cocostudio/CocosStudioExport.h" - -#define DICTOOL DictionaryHelper::getInstance() - -namespace cocostudio { -/** - * @js NA - * @lua NA - */ -class CC_STUDIO_DLL DictionaryHelper -{ -public: - DictionaryHelper(); - ~DictionaryHelper(); - static DictionaryHelper* getInstance(); - static void destroyInstance(); - - const rapidjson::Value& getSubDictionary_json(const rapidjson::Value &root, const char* key); - const rapidjson::Value& getSubDictionary_json(const rapidjson::Value &root, const char* key, int idx); - const rapidjson::Value& getSubDictionary_json(const rapidjson::Value &root, int idx); - - int getIntValue_json(const rapidjson::Value& root, const char* key, int def = 0); - float getFloatValue_json(const rapidjson::Value& root,const char* key, float def = 0.0f); - bool getBooleanValue_json(const rapidjson::Value& root,const char* key, bool def = false); - const char* getStringValue_json(const rapidjson::Value& root,const char* key, const char *def = NULL); - int getArrayCount_json(const rapidjson::Value& root,const char* key, int def = 0); - - int getIntValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, int def = 0); - float getFloatValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, float def = 0.0f); - bool getBoolValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, bool def = false); - const char* getStringValueFromArray_json(const rapidjson::Value& root,const char* arrayKey,int idx, const char *def = NULL); - const rapidjson::Value &getDictionaryFromArray_json(const rapidjson::Value &root, const char* key,int idx); - bool checkObjectExist_json(const rapidjson::Value &root); - bool checkObjectExist_json(const rapidjson::Value &root, const char* key); - bool checkObjectExist_json(const rapidjson::Value &root, int index); -}; - -} - -#endif /* defined(__CocoGUI__DictionaryHelper__) */ - diff --git a/native/cocos/platform/win32/CCDevice-win32.cpp b/native/cocos/platform/win32/CCDevice-win32.cpp index 13cac96bf5..6b938365f3 100644 --- a/native/cocos/platform/win32/CCDevice-win32.cpp +++ b/native/cocos/platform/win32/CCDevice-win32.cpp @@ -431,7 +431,7 @@ static BitmapDC& sharedBitmapDC() return s_BmpDC; } -Data Device::getTextureDataForText(const char * text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha) +Data Device::getTextureDataForText(const std::string& text, const FontDefinition& textDefinition, TextAlign align, int &width, int &height, bool& hasPremultipliedAlpha) { Data ret; do @@ -446,7 +446,7 @@ Data Device::getTextureDataForText(const char * text, const FontDefinition& text // draw text // does changing to SIZE here affects the font size by rounding from float? SIZE size = {(LONG) textDefinition._dimensions.width,(LONG) textDefinition._dimensions.height}; - CC_BREAK_IF(! dc.drawText(text, size, align)); + CC_BREAK_IF(! dc.drawText(text.c_str(), size, align)); int dataLen = size.cx * size.cy * 4; unsigned char* dataBuf = (unsigned char*)malloc(sizeof(unsigned char) * dataLen);