diff --git a/HelloWorld/win32/HelloWorld.win32.vcproj b/HelloWorld/win32/HelloWorld.win32.vcproj index aca31ccbbd..03e8ff49f6 100644 --- a/HelloWorld/win32/HelloWorld.win32.vcproj +++ b/HelloWorld/win32/HelloWorld.win32.vcproj @@ -89,7 +89,7 @@ /> diff --git a/HelloWorld/win32/HelloWorld.win32.vcproj.user b/HelloWorld/win32/HelloWorld.win32.vcproj.user new file mode 100644 index 0000000000..e5ed710ef0 --- /dev/null +++ b/HelloWorld/win32/HelloWorld.win32.vcproj.user @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/HelloWorld/win32/HelloWorld.win32.vcxproj b/HelloWorld/win32/HelloWorld.win32.vcxproj index f4e869674e..6e3c7d9223 100644 --- a/HelloWorld/win32/HelloWorld.win32.vcxproj +++ b/HelloWorld/win32/HelloWorld.win32.vcxproj @@ -1,125 +1,127 @@ - - - - - Debug - Win32 - - - Release - Win32 - - - - HelloWorld - {B8BF9E81-35FD-4582-BA1C-B85FA365BABB} - HelloWorldwin32 - Win32Proj - - - - Application - Unicode - true - - - Application - Unicode - - - - - - - - - - - - - <_ProjectFileVersion>10.0.30319.1 - $(SolutionDir)$(Configuration).win32\ - $(Configuration).win32\ - true - $(SolutionDir)$(Configuration).win32\ - $(Configuration).win32\ - false - AllRules.ruleset - - - AllRules.ruleset - - - - - - Disabled - $(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\;.\;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) - true - EnableFastChecks - MultiThreadedDebugDLL - - - Level3 - EditAndContinue - - - libcocos2d.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName).exe - $(OutDir);%(AdditionalLibraryDirectories) - true - Windows - MachineX86 - - - copy /Y "$(ProjectDir)..\Resource\*.*" "$(OutDir)" - - - - - MaxSpeed - true - $(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\;.\;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) - MultiThreadedDLL - true - - - Level3 - ProgramDatabase - - - libcocos2d.lib;%(AdditionalDependencies) - $(OutDir)$(ProjectName).exe - $(OutDir);%(AdditionalLibraryDirectories) - true - Windows - true - true - MachineX86 - - - copy /Y "$(ProjectDir)..\Resource\*.*" "$(OutDir)" - - - - - - - - - - - - - - - {98a51ba8-fc3a-415b-ac8f-8c7bd464e93e} - false - - - - - + + + + + Debug + Win32 + + + Release + Win32 + + + + HelloWorld + {B8BF9E81-35FD-4582-BA1C-B85FA365BABB} + HelloWorldwin32 + Win32Proj + + + + Application + Unicode + true + + + Application + Unicode + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + true + $(SolutionDir)$(Configuration).win32\ + $(Configuration).win32\ + false + AllRules.ruleset + + + AllRules.ruleset + + + + + + Disabled + $(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\;.\;%(AdditionalIncludeDirectories) + WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions) + true + EnableFastChecks + MultiThreadedDebugDLL + + + Level3 + EditAndContinue + + + libcocos2d.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).exe + $(OutDir);%(AdditionalLibraryDirectories) + true + Windows + MachineX86 + + + + + + + + + MaxSpeed + true + $(SolutionDir)cocos2dx\platform;$(SolutionDir)cocos2dx\include;$(SolutionDir)cocos2dx;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\;.\;%(AdditionalIncludeDirectories) + WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions) + MultiThreadedDLL + true + + + Level3 + ProgramDatabase + + + libcocos2d.lib;%(AdditionalDependencies) + $(OutDir)$(ProjectName).exe + $(OutDir);%(AdditionalLibraryDirectories) + true + Windows + true + true + MachineX86 + + + + + + + + + + + + + + + + + + + {98a51ba8-fc3a-415b-ac8f-8c7bd464e93e} + false + + + + + \ No newline at end of file diff --git a/HelloWorld/win32/HelloWorld.win32.vcxproj.user b/HelloWorld/win32/HelloWorld.win32.vcxproj.user index 3f03091124..f0cf09c3a5 100644 --- a/HelloWorld/win32/HelloWorld.win32.vcxproj.user +++ b/HelloWorld/win32/HelloWorld.win32.vcxproj.user @@ -1,6 +1,10 @@ - - - - false - + + + + false + $(ProjectDir)..\Resource\ + $(ProjectDir)..\Resource\ + WindowsLocalDebugger + WindowsLocalDebugger + \ No newline at end of file diff --git a/build-win32.bat b/build-win32.bat index d6f416427c..a0d367eb49 100644 --- a/build-win32.bat +++ b/build-win32.bat @@ -39,8 +39,11 @@ echo.* Check the cocos2d-win32 application "tests.exe" ... echo.*/ echo. -set CC_TEST_PATH=".\Release.win32\tests.exe" -if not exist %CC_TEST_PATH% ( +cd ".\Release.win32\" +set CC_TEST_BIN="tests.exe" +set CC_TEST_RES="..\tests\Res\*.*" + +if not exist %CC_TEST_BIN% ( echo Can't find the binary "tests.exe", is there build error? goto ERROR ) @@ -49,11 +52,12 @@ echo./* echo.* Run cocos2d-win32 tests.exe and view Cocos2d-x Application Wizard for Visual Studio User Guide. echo.*/ echo. -call %CC_TEST_PATH% +xcopy /E /Y /Q %CC_TEST_RES% . +call %CC_TEST_BIN% start http://www.cocos2d-x.org/projects/cocos2d-x/wiki/Cocos2d-x_Application_Wizard_for_Visual_Studio_User_Guide goto EOF :ERROR pause -:EOF +:EOF \ No newline at end of file diff --git a/cocos2dx/platform/win32/CCFileUtils_win32.cpp b/cocos2dx/platform/win32/CCFileUtils_win32.cpp index e788b72ce2..debe32ee24 100644 --- a/cocos2dx/platform/win32/CCFileUtils_win32.cpp +++ b/cocos2dx/platform/win32/CCFileUtils_win32.cpp @@ -37,17 +37,9 @@ void _CheckPath() { WCHAR wszPath[MAX_PATH]; int nNum = WideCharToMultiByte(CP_ACP, 0, wszPath, - GetModuleFileName(NULL, wszPath, MAX_PATH), + GetCurrentDirectoryW(sizeof(wszPath), wszPath), s_pszResourcePath, MAX_PATH, NULL, NULL); - - for (int i = nNum; i >= 0; --i) - { - if (L'\\' == s_pszResourcePath[i]) - { - s_pszResourcePath[i + 1] = 0; - break; - } - } + s_pszResourcePath[nNum] = '\\'; } } @@ -67,10 +59,13 @@ const char* CCFileUtils::fullPathFromRelativePath(const char *pszRelativePath) pRet->autorelease(); if ((strlen(pszRelativePath) > 1 && pszRelativePath[1] == ':')) { + // path start with "x:", is absolute path pRet->m_sString = pszRelativePath; } - else if (strlen(pszRelativePath) > 0 && pszRelativePath[0] == '/') + else if (strlen(pszRelativePath) > 0 + && ('/' == pszRelativePath[0] || '\\' == pszRelativePath[0])) { + // path start with '/' or '\', is absolute path without driver name char szDriver[3] = {s_pszResourcePath[0], s_pszResourcePath[1], 0}; pRet->m_sString = szDriver; pRet->m_sString += pszRelativePath; diff --git a/cocos2dx/proj.win32/cocos2d-win32.vcproj b/cocos2dx/proj.win32/cocos2d-win32.vcproj index 223ee2d17f..bc34434024 100644 --- a/cocos2dx/proj.win32/cocos2d-win32.vcproj +++ b/cocos2dx/proj.win32/cocos2d-win32.vcproj @@ -42,7 +42,7 @@ Disabled - $(SolutionDir)\cocos2dx\platform;$(SolutionDir)cocos2dx\platform\third_party\win32\iconv;$(SolutionDir)cocos2dx\platform\third_party\win32\zlib;$(SolutionDir)cocos2dx\platform\third_party\win32\libpng;$(SolutionDir)cocos2dx\platform\third_party\win32\libjpeg;$(SolutionDir)cocos2dx\platform\third_party\win32\libxml2;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\include;..;%(AdditionalIncludeDirectories) + ..\platform;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\OGLES;..\include;..;%(AdditionalIncludeDirectories) WIN32;_DEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions) true EnableFastChecks @@ -94,7 +94,7 @@ xcopy /Y /Q "$(SolutionDir)cocos2dx\platform\third_party\win32\libraries\*.*" "$ - $(SolutionDir)\cocos2dx\platform;$(SolutionDir)cocos2dx\platform\third_party\win32\iconv;$(SolutionDir)cocos2dx\platform\third_party\win32\zlib;$(SolutionDir)cocos2dx\platform\third_party\win32\libpng;$(SolutionDir)cocos2dx\platform\third_party\win32\libjpeg;$(SolutionDir)cocos2dx\platform\third_party\win32\libxml2;$(SolutionDir)cocos2dx\platform\third_party\win32\OGLES;..\include;..;%(AdditionalIncludeDirectories) + ..\platform;..\platform\third_party\win32\iconv;..\platform\third_party\win32\zlib;..\platform\third_party\win32\libpng;..\platform\third_party\win32\libjpeg;..\platform\third_party\win32\libxml2;..\platform\third_party\win32\OGLES;..\include;..;%(AdditionalIncludeDirectories) WIN32;NDEBUG;_WINDOWS;_USRDLL;COCOS2DXWIN32_EXPORTS;GL_GLEXT_PROTOTYPES;%(PreprocessorDefinitions) MultiThreadedDLL diff --git a/template/msvc/CCAppWiz.win32/Scripts/1033/default.js b/template/msvc/CCAppWiz.win32/Scripts/1033/default.js index 40c21d3b8c..ebc9eb3873 100644 --- a/template/msvc/CCAppWiz.win32/Scripts/1033/default.js +++ b/template/msvc/CCAppWiz.win32/Scripts/1033/default.js @@ -99,9 +99,40 @@ function CreateCustomProject(strProjectName, strProjectPath) { var file = FileSys.OpenTextFile(strUserPath, 2, true); var strUserValue = ""; if(WizardVersion >= 10.0) - strUserValue = "\r\n\r\n \r\n true\r\n \r\n"; + strUserValue = "\r\n" + + "\r\n" + + " \r\n" + + " true\r\n" + + " $(ProjectDir)Resource\r\n" + + " $(ProjectDir)Resource\r\n" + + " WindowsLocalDebugger\r\n" + + " WindowsLocalDebugger\r\n" + + " \r\n" + + ""; else - strUserValue = ""; + strUserValue = "\r\n" + + "\r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + " \r\n" + + ""; file.WriteLine(strUserValue); file.Close(); @@ -280,9 +311,9 @@ function AddConfigurations(proj, strProjectName) { MidlTool.DLLDataFileName = ""; // Post-build settings - var PostBuildTool = config.Tools("VCPostBuildEventTool"); - PostBuildTool.Description = "Performing copy resource from Resource to OutDir..."; - PostBuildTool.CommandLine = "xcopy /E /Q /Y \"$(ProjectDir)Resource\\*.*\" \"$(OutDir)\""; +// var PostBuildTool = config.Tools("VCPostBuildEventTool"); +// PostBuildTool.Description = "Performing copy resource from Resource to OutDir..."; +// PostBuildTool.CommandLine = "xcopy /E /Q /Y \"$(ProjectDir)Resource\\*.*\" \"$(OutDir)\""; } } catch (e) { diff --git a/tests/test.win32/copy_res.bat b/tests/test.win32/copy_res.bat deleted file mode 100644 index d4fea1aa47..0000000000 --- a/tests/test.win32/copy_res.bat +++ /dev/null @@ -1,2 +0,0 @@ -echo off -xcopy /E /Y /Q ..\Res\*.* %1 diff --git a/tests/test.win32/test.win32.vcproj b/tests/test.win32/test.win32.vcproj index 948c8dcd08..dc0e707a3d 100644 --- a/tests/test.win32/test.win32.vcproj +++ b/tests/test.win32/test.win32.vcproj @@ -90,7 +90,7 @@ /> diff --git a/tests/test.win32/test.win32.vcproj.user b/tests/test.win32/test.win32.vcproj.user new file mode 100644 index 0000000000..d67654c632 --- /dev/null +++ b/tests/test.win32/test.win32.vcproj.user @@ -0,0 +1,23 @@ + + + + + + + + + + + diff --git a/tests/test.win32/test.win32.vcxproj b/tests/test.win32/test.win32.vcxproj index 697da62fd1..7d93c32209 100644 --- a/tests/test.win32/test.win32.vcxproj +++ b/tests/test.win32/test.win32.vcxproj @@ -73,9 +73,6 @@ Windows MachineX86 - - copy_res.bat "$(OutDir)" - @@ -101,9 +98,6 @@ true MachineX86 - - copy_res.bat "$(OutDir)" - @@ -269,4 +263,4 @@ - \ No newline at end of file + diff --git a/tests/test.win32/test.win32.vcxproj.user b/tests/test.win32/test.win32.vcxproj.user index 3f03091124..d98fe12445 100644 --- a/tests/test.win32/test.win32.vcxproj.user +++ b/tests/test.win32/test.win32.vcxproj.user @@ -2,5 +2,9 @@ false + $(ProjectDir)..\Res + $(ProjectDir)..\Res + WindowsLocalDebugger + WindowsLocalDebugger \ No newline at end of file