diff --git a/native/.github/workflows/compile-platforms.yaml b/native/.github/workflows/compile-platforms.yaml index 82aebfeadb..e5af800016 100644 --- a/native/.github/workflows/compile-platforms.yaml +++ b/native/.github/workflows/compile-platforms.yaml @@ -35,7 +35,7 @@ jobs: env: COCOS_ENGINE_DEV: 1 run: | - cd $GITHUB_WORKSPACE/templates/win32 + cd $GITHUB_WORKSPACE/templates/windows mkdir -p build-win32/proj touch build-win32/proj/cfg.cmake echo "set(CC_USE_GLES3 ON)" >> build-win32/proj/cfg.cmake @@ -44,7 +44,7 @@ jobs: echo "set(USE_WEBSOCKET_SERVER ON)" >> build-win32/proj/cfg.cmake mkdir build-win32/assets cd build-win32 - RES_DIR=${GITHUB_WORKSPACE//\\//}/templates/win32/build-win32 + RES_DIR=${GITHUB_WORKSPACE//\\//}/templates/windows/build-win32 COCOS_X_PATH=${GITHUB_WORKSPACE//\\//} cmake ../ -G"Visual Studio 16 2019" -DRES_DIR=$RES_DIR -DCOCOS_X_PATH=$COCOS_X_PATH -Awin32 cmake --build . --config Release @@ -90,13 +90,11 @@ jobs: ASSET_DIR=$COCOS2DX_ROOT/templates/android/build/build-android/ - sed -i "s@\${NATIVE_DIR}@$NATIVE_DIR@g" settings.gradle - sed -i "s@\${COCOS_ROOT}@$COCOS2DX_ROOT@g" settings.gradle - sed -i "s@\${NATIVE_DIR}@$NATIVE_DIR@g" build.gradle sed -i "s@^PROP_NDK_PATH.*@PROP_NDK_PATH=$ANDORID_NDK@g" gradle.properties sed -i "s@^APPLICATION_ID.*@APPLICATION_ID=com.cocos.android@g" gradle.properties sed -i "s@^RES_PATH.*@RES_PATH=$ASSET_DIR@g" gradle.properties sed -i "s@^COCOS_ENGINE_PATH.*@COCOS_ENGINE_PATH=$COCOS2DX_ROOT@g" gradle.properties + sed -i "s@^NATIVE_DIR.*@NATIVE_DIR=$NATIVE_DIR@g" gradle.properties # To speedup CI, compile arm64-v8a only # sed -i "s@^PROP_APP_ABI.*@PROP_APP_ABI=armeabi-v7a:arm64-v8a:x86@g" gradle.properties diff --git a/native/cocos/network/SocketIO.cpp b/native/cocos/network/SocketIO.cpp index 6ddbb184cd..28324a0fe6 100644 --- a/native/cocos/network/SocketIO.cpp +++ b/native/cocos/network/SocketIO.cpp @@ -394,7 +394,7 @@ void SIOClientImpl::handshakeResponse(HttpClient * /*sender*/, HttpResponse *res int32_t statusCode = response->getResponseCode(); char statusString[64] = {}; - sprintf(statusString, "HTTP Status Code: %ld, tag = %s", statusCode, response->getHttpRequest()->getTag()); + sprintf(statusString, "HTTP Status Code: %d, tag = %s", statusCode, response->getHttpRequest()->getTag()); CC_LOG_INFO("response code: %ld", statusCode); if (!response->isSucceed() || statusCode >= 400) { diff --git a/native/templates/android/build/build.gradle b/native/templates/android/build/build.gradle index 5bb1044f2f..ca8574059a 100644 --- a/native/templates/android/build/build.gradle +++ b/native/templates/android/build/build.gradle @@ -14,4 +14,4 @@ buildscript { } } -apply from: "${NATIVE_DIR}/build.gradle" +apply from: NATIVE_DIR +"/build.gradle" diff --git a/native/templates/android/build/gradle.properties b/native/templates/android/build/gradle.properties index bc9b57d383..784662b0dd 100644 --- a/native/templates/android/build/gradle.properties +++ b/native/templates/android/build/gradle.properties @@ -39,6 +39,9 @@ COCOS_ENGINE_PATH= # Res path RES_PATH= +# Native source dir +NATIVE_DIR= + # Application ID APPLICATION_ID= diff --git a/native/templates/android/build/settings.gradle b/native/templates/android/build/settings.gradle index 331300c75a..dc29a7198c 100644 --- a/native/templates/android/build/settings.gradle +++ b/native/templates/android/build/settings.gradle @@ -1,6 +1,6 @@ include ':libcocos',':libservice',':instantapp',':CocosGame' -project(':libcocos').projectDir = new File('${COCOS_ROOT}/cocos/platform/android/libcocos2dx') -project(':instantapp').projectDir = new File('${NATIVE_DIR}/instantapp') -project(':CocosGame').projectDir = new File('${NATIVE_DIR}/app') +project(':libcocos').projectDir = new File(COCOS_ENGINE_PATH,'cocos/platform/android/libcocos2dx') +project(':instantapp').projectDir = new File(NATIVE_DIR, 'instantapp') +project(':CocosGame').projectDir = new File(NATIVE_DIR, 'app') rootProject.name = "CocosGame" diff --git a/native/templates/cocos-project-template.json b/native/templates/cocos-project-template.json index aad4717e83..4a4b02f8cb 100755 --- a/native/templates/cocos-project-template.json +++ b/native/templates/cocos-project-template.json @@ -1,9 +1,11 @@ { "doAddNativeSupport": { - "appendFile": [{ - "from": "cocos/bindings/manual/jsb_module_register.cpp", - "to": "${COMMON_DIR}/Classes/jsb_module_register.cpp" - }], + "appendFile": [ + { + "from": "cocos/bindings/manual/jsb_module_register.cpp", + "to": "${COMMON_DIR}/Classes/jsb_module_register.cpp" + } + ], "projectReplaceProjectName": { "srcProjectName": "CocosGame", "files": [ @@ -14,10 +16,6 @@ "${NATIVE_DIR}/CMakeLists.txt" ] }, - "appendXEngine": { - "from": ".", - "to": "${COMMON_DIR}/cocos2d-x" - }, "projectReplacePackageName": { "srcPackageName": "com.cocos.helloworld", "files": [ @@ -27,40 +25,6 @@ "${NATIVE_DIR}/instantapp/AndroidManifest.xml", "${NATIVE_DIR}/entry/src/main/config.json" ] - }, - "projectReplaceMacBundleid": { - "srcBundleId": "com.cocos.helloworld.mac", - "files": [ - "${NATIVE_DIR}/CMakeLists.txt" - ] - }, - "projectReplaceIosBundleid": { - "srcBundleId": "com.cocos.helloworld.ios", - "files": [ - "${NATIVE_DIR}/CMakeLists.txt" - ] - }, - "projectReplaceCocosRoot": { - "pattern":"\\$\\{COCOS_ROOT\\}", - "files": [ - {"file": "${NATIVE_DIR}/CMakeLists.txt", "default":"${CMAKE_CURRENT_LIST_DIR}/cocos2d-x", "needFix":true}, - {"file": "proj/settings.gradle", "default":"${COMMON_DIR}/cocos2d-x", "needFix":true}, - "proj/build-cfg.json" - ] - }, - "projectReplaceTemplatePath": { - "pattern":"\\$\\{NATIVE_DIR\\}", - "files": [ - "proj/settings.gradle", - "proj/build.gradle" - ] - }, - "projectReplaceProjectCommon" : { - "pattern":"\\$\\{COCOS_PROJ_COMMON\\}", - "files":[ - "${NATIVE_DIR}/app/build.gradle", - "${NATIVE_DIR}/instantapp/build.gradle" - ] } } -} +} \ No newline at end of file diff --git a/native/templates/ohos/settings.gradle b/native/templates/ohos/settings.gradle index a7537f7cb8..5491df5e24 100644 --- a/native/templates/ohos/settings.gradle +++ b/native/templates/ohos/settings.gradle @@ -1,3 +1,3 @@ include ':libcocos',':entry' -project(':libcocos').projectDir = new File('${ENGINE_ROOT}/cocos/platform/ohos/libcocos') +project(':libcocos').projectDir = new File(ENGINE_ROOT, 'cocos/platform/ohos/libcocos') rootProject.name = "CocosGame" diff --git a/native/templates/win32/CMakeLists.txt b/native/templates/win32/CMakeLists.txt deleted file mode 100755 index 4f69ce70d1..0000000000 --- a/native/templates/win32/CMakeLists.txt +++ /dev/null @@ -1,77 +0,0 @@ -cmake_minimum_required(VERSION 3.8) - -set(CMAKE_GENERATOR_PLATFORM win32) -set(APP_NAME "CocosGame" CACHE STRING "Project Name") -project(${APP_NAME} CXX) - -include(${CMAKE_CURRENT_LIST_DIR}/../common/CMakeLists.txt) - -set(LIB_NAME ${APP_NAME}) - -set(UI_RESOURCES) -set(PROJ_SOURCES) -set(PROJ_COMMON_SOURCES - ${CMAKE_CURRENT_LIST_DIR}/../common/Classes/Game.h - ${CMAKE_CURRENT_LIST_DIR}/../common/Classes/Game.cpp -) - -if(NOT EXISTS ${CMAKE_CURRENT_LIST_DIR}/../common/Classes/jsb_module_register.cpp) - file(COPY "${COCOS_X_PATH}/cocos/bindings/manual/jsb_module_register.cpp" - DESTINATION ${CMAKE_CURRENT_LIST_DIR}/../common/Classes/) -endif() -list(APPEND PROJ_COMMON_SOURCES ${CMAKE_CURRENT_LIST_DIR}/../common/Classes/jsb_module_register.cpp) - -set(UI_RESOURCES - ${CMAKE_CURRENT_LIST_DIR}/game.rc -) -list(APPEND PROJ_SOURCES - ${CMAKE_CURRENT_LIST_DIR}/AppDelegate.h - ${CMAKE_CURRENT_LIST_DIR}/AppDelegate.cpp - ${CMAKE_CURRENT_LIST_DIR}/main.h - ${CMAKE_CURRENT_LIST_DIR}/main.cpp - ${CMAKE_CURRENT_LIST_DIR}/resource.h - ${UI_RESOURCES} -) - -include_resources(${RES_DIR}/assets) - -add_executable(${LIB_NAME} - ${PROJ_SOURCES} - ${PROJ_COMMON_SOURCES} - ${ASSET_FILES} -) -source_group(TREE ${RES_DIR}/assets PREFIX "Resources" FILES ${ASSET_FILES}) -source_group(TREE ${CMAKE_CURRENT_LIST_DIR} PREFIX "Source Files" FILES ${PROJ_SOURCES}) -source_group(TREE ${CMAKE_CURRENT_LIST_DIR}/../common PREFIX "Source Files" FILES ${PROJ_COMMON_SOURCES}) - - -target_link_libraries(${LIB_NAME} cocos2d) -target_include_directories(${LIB_NAME} PRIVATE - ${CMAKE_CURRENT_LIST_DIR}/../common/Classes - ${RES_DIR}/assets/proj -) - -set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ${LIB_NAME}) - -if(EXISTS ${RES_DIR}/assets/jsb-adapter) - set(bin_dir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) - add_custom_target(copy_resource ALL - COMMAND ${CMAKE_COMMAND} -E echo "Copying resources to ${bin_dir}" - COMMAND ${CMAKE_COMMAND} -E make_directory ${bin_dir}/Resources - COMMAND robocopy "${RES_DIR}/assets/" "${bin_dir}/Resources/" /MIR || (exit 0) - COMMAND ${CMAKE_COMMAND} -E echo "Copying resources done!" - ) - add_dependencies(${LIB_NAME} copy_resource) - set_target_properties(copy_resource PROPERTIES FOLDER Utils) -endif() - -if(MSVC) - foreach(item ${WIN32_DLLS}) - get_filename_component(filename ${item} NAME) - get_filename_component(abs ${item} ABSOLUTE) - add_custom_command(TARGET ${LIB_NAME} POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${abs} $/${filename} - ) - endforeach() - target_link_options(${LIB_NAME} PRIVATE /SUBSYSTEM:WINDOWS) -endif() \ No newline at end of file diff --git a/native/templates/win64/AppDelegate.cpp b/native/templates/win64/AppDelegate.cpp deleted file mode 100644 index 84029ef03b..0000000000 --- a/native/templates/win64/AppDelegate.cpp +++ /dev/null @@ -1,156 +0,0 @@ -#include "AppDelegate.h" - -#include -#include -#include -#include - -#include "platform/StdC.h" -#include "platform/win32/View-win32.h" -#include "cocos/bindings/jswrapper/SeApi.h" - -namespace { - std::weak_ptr gView; - /** - @brief This function changes the PVRFrame show/hide setting in register. - @param bEnable If true show the PVRFrame window, otherwise hide. - */ - void PVRFrameEnableControlWindow(bool bEnable) { - HKEY hKey = 0; - - // Open PVRFrame control key, if not exist create it. - if (ERROR_SUCCESS != RegCreateKeyExW(HKEY_CURRENT_USER, - L"Software\\Imagination Technologies\\PVRVFRame\\STARTUP\\", - 0, - 0, - REG_OPTION_NON_VOLATILE, - KEY_ALL_ACCESS, - 0, - &hKey, - nullptr)) { - return; - } - - const WCHAR* wszValue = L"hide_gui"; - const WCHAR* wszNewData = (bEnable) ? L"NO" : L"YES"; - WCHAR wszOldData[256] = {0}; - DWORD dwSize = sizeof(wszOldData); - LSTATUS status = RegQueryValueExW(hKey, wszValue, 0, nullptr, (LPBYTE)wszOldData, &dwSize); - if (ERROR_FILE_NOT_FOUND == status // the key not exist - || (ERROR_SUCCESS == status // or the hide_gui value is exist - && 0 != wcscmp(wszNewData, wszOldData))) // but new data and old data not equal - { - dwSize = sizeof(WCHAR) * (wcslen(wszNewData) + 1); - RegSetValueEx(hKey, wszValue, 0, REG_SZ, (const BYTE*)wszNewData, dwSize); - } - - RegCloseKey(hKey); - } - - bool setCanvasCallback(se::Object* global) { - std::stringstream ss; - se::ScriptEngine* se = se::ScriptEngine::getInstance(); - auto view = gView.lock(); - auto handler = view->getWindowHandler(); - auto viewSize = view->getViewSize(); - char commandBuf[200] = {0}; - ss << "window.innerWidth = " << viewSize[0] << "; " - << "window.innerHeight = " << viewSize[1] << "; " - << "window.windowHandler = " - << reinterpret_cast(handler) - << ";"; - - se->evalString(ss.str().c_str()); - return true; - } -} // namespace - -//exported function -std::shared_ptr cc_get_application_view() { - return gView.lock(); -} - -AppDelegate::AppDelegate(const std::string& name, int width, int height) { - _view = std::make_shared(name, width, height); - _game = std::make_shared(width, height); - - gView = _view; -} - -void AppDelegate::start() { - bool resume, pause, close; - se::ScriptEngine::getInstance()->addPermanentRegisterCallback(setCanvasCallback); - - if (!_view->init()) return; - if (!_game->init()) return; - - if (!_view) - return; - - _quit = false; - - PVRFrameEnableControlWindow(false); - - /////////////////////////////////////////////////////////////////////////// - /////////////// changing timer resolution - /////////////////////////////////////////////////////////////////////////// - UINT TARGET_RESOLUTION = 1; // 1 millisecond target resolution - TIMECAPS tc; - UINT wTimerRes = 0; - if (TIMERR_NOERROR == timeGetDevCaps(&tc, sizeof(TIMECAPS))) { - wTimerRes = std::min(std::max(tc.wPeriodMin, TARGET_RESOLUTION), tc.wPeriodMax); - timeBeginPeriod(wTimerRes); - } - - float dt = 0.f; - const DWORD _16ms = 16; - - // Main message loop: - LARGE_INTEGER nFreq; - LARGE_INTEGER nLast; - LARGE_INTEGER nNow; - - LONGLONG actualInterval = 0LL; // actual frame internal - LONGLONG desiredInterval = 0LL; // desired frame internal, 1 / fps - LONG waitMS = 0L; - - QueryPerformanceCounter(&nLast); - QueryPerformanceFrequency(&nFreq); - se::ScriptEngine* se = se::ScriptEngine::getInstance(); - - _game->onResume(); - - while (!_quit) { - desiredInterval = (LONGLONG)(1.0 / _game->getPreferredFramesPerSecond() * nFreq.QuadPart); - - resume = false; - pause = false; - close = false; - while (_view->pollEvent(&_quit, &resume, &pause, &close)) { - } - - if (pause) _game->onPause(); - if (resume) _game->onResume(); - if (close) _game->onClose(); - - QueryPerformanceCounter(&nNow); - actualInterval = nNow.QuadPart - nLast.QuadPart; - if (actualInterval >= desiredInterval) { - nLast.QuadPart = nNow.QuadPart; - _game->tick(); - _view->swapbuffer(); - } else { - // The precision of timer on Windows is set to highest (1ms) by 'timeBeginPeriod' from above code, - // but it's still not precise enough. For example, if the precision of timer is 1ms, - // Sleep(3) may make a sleep of 2ms or 4ms. Therefore, we subtract 1ms here to make Sleep time shorter. - // If 'waitMS' is equal or less than 1ms, don't sleep and run into next loop to - // boost CPU to next frame accurately. - waitMS = (desiredInterval - actualInterval) * 1000LL / nFreq.QuadPart - 1L; - if (waitMS > 1L) - Sleep(waitMS); - } - } - - if (wTimerRes != 0) - timeEndPeriod(wTimerRes); -} diff --git a/native/templates/win64/AppDelegate.h b/native/templates/win64/AppDelegate.h deleted file mode 100644 index 9138886810..0000000000 --- a/native/templates/win64/AppDelegate.h +++ /dev/null @@ -1,22 +0,0 @@ -#pragma once - -#include "Game.h" -#include -#include - -namespace cc { - class View; -}; - -class AppDelegate { -public: - AppDelegate(const std::string &name, int width, int height); - - void start(); - -private: - std::shared_ptr _view; - std::shared_ptr _game; - - bool _quit{false}; -}; diff --git a/native/templates/win64/build-cfg.json b/native/templates/win64/build-cfg.json deleted file mode 100644 index d854c66e89..0000000000 --- a/native/templates/win64/build-cfg.json +++ /dev/null @@ -1,28 +0,0 @@ -{ - "copy_resources": [ - { - "from": "../../../src", - "to": "src" - }, - { - "from": "../../../res", - "to": "res" - }, - { - "from": "../../../subpackages", - "to": "subpackages" - }, - { - "from": "../../../main.js", - "to": "" - }, - { - "from": "../../../project.json", - "to": "" - }, - { - "from": "../../../jsb-adapter", - "to": "jsb-adapter" - } - ] -} diff --git a/native/templates/win64/game.rc b/native/templates/win64/game.rc deleted file mode 100644 index 491e970a7d..0000000000 --- a/native/templates/win64/game.rc +++ /dev/null @@ -1,126 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winresrc.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Chinese (Simplified, PRC) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS) -LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -#pragma code_page(936) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -2 TEXTINCLUDE -BEGIN - "#include ""winresrc.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Chinese (Simplified, PRC) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// English (United States) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) -LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -#pragma code_page(1252) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -GLFW_ICON ICON "res\\game.ico" - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 1,0,0,1 - PRODUCTVERSION 1,0,0,1 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x4L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904B0" - BEGIN - VALUE "FileDescription", "game Module" - VALUE "FileVersion", "1, 0, 0, 1" - VALUE "InternalName", "game" - VALUE "LegalCopyright", "Copyright " - VALUE "OriginalFilename", "game.exe" - VALUE "ProductName", "game Module" - VALUE "ProductVersion", "1, 0, 0, 1" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END -END - -#endif // English (United States) resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED \ No newline at end of file diff --git a/native/templates/win64/main.cpp b/native/templates/win64/main.cpp deleted file mode 100644 index 150246e7c3..0000000000 --- a/native/templates/win64/main.cpp +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - - 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 "main.h" -#include "AppDelegate.h" -#include "sdl2/SDL.h" - -using namespace cc; - -// uncomment below line, open debug console -// #define USE_WIN32_CONSOLE - -int SDL_main(int argc, char *argv[]) -{ - -#ifdef USE_WIN32_CONSOLE - AllocConsole(); - freopen("CONIN$", "r", stdin); - freopen("CONOUT$", "w", stdout); - freopen("CONOUT$", "w", stderr); -#endif - - // create the application instance - AppDelegate app("Cocos3D Game", 960, 640); - app.start(); - -#ifdef USE_WIN32_CONSOLE - FreeConsole(); -#endif - - return 0; -} diff --git a/native/templates/win64/main.h b/native/templates/win64/main.h deleted file mode 100644 index 458f7687b4..0000000000 --- a/native/templates/win64/main.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** - Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. - - http://www.cocos.com - - Permission is hereby granted, free of charge, to any person obtaining a copy - of this software and associated engine source code (the "Software"), a limited, - worldwide, royalty-free, non-assignable, revocable and non-exclusive license - to use Cocos Creator solely to develop games on your target platforms. You shall - not use Cocos Creator software for developing other software or tools that's - used for developing games. You are not granted to publish, distribute, - sublicense, and/or sell copies of Cocos Creator. - - The software or tools in this License Agreement are licensed, not sold. - Xiamen Yaji Software Co., Ltd. reserves all rights not expressly granted to you. - - 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 __MAIN_H__ -#define __MAIN_H__ - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers - -// Windows Header Files: -#include - -// C RunTime Header Files -#include "StdC.h" - -#endif // __WINMAIN_H__ diff --git a/native/templates/win64/res/game.ico b/native/templates/win64/res/game.ico deleted file mode 100644 index dbd1751ea0..0000000000 Binary files a/native/templates/win64/res/game.ico and /dev/null differ diff --git a/native/templates/win64/resource.h b/native/templates/win64/resource.h deleted file mode 100644 index 920119022a..0000000000 --- a/native/templates/win64/resource.h +++ /dev/null @@ -1,17 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by game.rc -// -#define IDS_PROJNAME 100 -#define IDR_TESTJS 100 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 204 -#define _APS_NEXT_COMMAND_VALUE 32785 -#define _APS_NEXT_CONTROL_VALUE 1001 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/native/templates/win32/AppDelegate.cpp b/native/templates/windows/AppDelegate.cpp similarity index 100% rename from native/templates/win32/AppDelegate.cpp rename to native/templates/windows/AppDelegate.cpp diff --git a/native/templates/win32/AppDelegate.h b/native/templates/windows/AppDelegate.h similarity index 100% rename from native/templates/win32/AppDelegate.h rename to native/templates/windows/AppDelegate.h diff --git a/native/templates/win64/CMakeLists.txt b/native/templates/windows/CMakeLists.txt similarity index 98% rename from native/templates/win64/CMakeLists.txt rename to native/templates/windows/CMakeLists.txt index d5466a2c20..bf468a27c5 100644 --- a/native/templates/win64/CMakeLists.txt +++ b/native/templates/windows/CMakeLists.txt @@ -1,6 +1,5 @@ cmake_minimum_required(VERSION 3.8) -set(CMAKE_GENERATOR_PLATFORM x64) set(APP_NAME "CocosGame" CACHE STRING "Project Name") project(${APP_NAME} CXX) diff --git a/native/templates/win32/build-cfg.json b/native/templates/windows/build-cfg.json similarity index 100% rename from native/templates/win32/build-cfg.json rename to native/templates/windows/build-cfg.json diff --git a/native/templates/win32/game.rc b/native/templates/windows/game.rc similarity index 100% rename from native/templates/win32/game.rc rename to native/templates/windows/game.rc diff --git a/native/templates/win32/main.cpp b/native/templates/windows/main.cpp similarity index 100% rename from native/templates/win32/main.cpp rename to native/templates/windows/main.cpp diff --git a/native/templates/win32/main.h b/native/templates/windows/main.h similarity index 100% rename from native/templates/win32/main.h rename to native/templates/windows/main.h diff --git a/native/templates/win32/res/game.ico b/native/templates/windows/res/game.ico similarity index 100% rename from native/templates/win32/res/game.ico rename to native/templates/windows/res/game.ico diff --git a/native/templates/win32/resource.h b/native/templates/windows/resource.h similarity index 100% rename from native/templates/win32/resource.h rename to native/templates/windows/resource.h