diff --git a/native/cocos/ui/edit-box/EditBox-win32.cpp b/native/cocos/ui/edit-box/EditBox-win32.cpp index 8887f4a2c2..0776e6e5a6 100644 --- a/native/cocos/ui/edit-box/EditBox-win32.cpp +++ b/native/cocos/ui/edit-box/EditBox-win32.cpp @@ -37,4 +37,8 @@ void EditBox::hide() } +void EditBox::complete() +{ + +} NS_CC_END diff --git a/native/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp b/native/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp index 09cdc7e77e..e0f5395e9d 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp +++ b/native/tools/simulator/frameworks/runtime-src/proj.win32/SimulatorWin.cpp @@ -1,4 +1,4 @@ -/**************************************************************************** +/**************************************************************************** Copyright (c) 2017-2018 Xiamen Yaji Software Co., Ltd. http://www.cocos.com @@ -53,8 +53,10 @@ #include "runtime/ConfigParser.h" #include "runtime/Runtime.h" +#include "platform/CCApplication.h" #include "platform/win32/PlayerWin.h" #include "platform/win32/PlayerMenuServiceWin.h" +#include "platform/desktop/CCGLView-desktop.h" #include "resource.h" @@ -92,19 +94,27 @@ INT_PTR CALLBACK AboutDialogCallback(HWND hDlg, UINT message, WPARAM wParam, LPA } return (INT_PTR)FALSE; } + +HWND getWin32Window() +{ + auto glfwWindow = ((cocos2d::GLView*)cocos2d::Application::getInstance()->getView())->getGLFWWindow(); + return glfwGetWin32Window(glfwWindow); +} + + void onHelpAbout() { DialogBox(GetModuleHandle(NULL), MAKEINTRESOURCE(IDD_DIALOG_ABOUT), - Director::getInstance()->getOpenGLView()->getWin32Window(), + getWin32Window(), AboutDialogCallback); } + void shutDownApp() { - auto glview = dynamic_cast (Director::getInstance()->getOpenGLView()); - HWND hWnd = glview->getWin32Window(); - ::SendMessage(hWnd, WM_CLOSE, NULL, NULL); + + ::SendMessage(getWin32Window(), WM_CLOSE, NULL, NULL); } std::string getCurAppPath(void) @@ -139,15 +149,6 @@ static bool stringEndWith(const std::string str, const std::string needle) return false; } -static void initGLContextAttrs() -{ - //set OpenGL context attributions,now can only set six attributions: - //red,green,blue,alpha,depth,stencil - GLContextAttrs glContextAttrs = {8, 8, 8, 8, 24, 8}; - - GLView::setGLContextAttrs(glContextAttrs); -} - SimulatorWin *SimulatorWin::_instance = nullptr; SimulatorWin *SimulatorWin::getInstance() @@ -178,7 +179,8 @@ SimulatorWin::~SimulatorWin() void SimulatorWin::quit() { - Director::getInstance()->end(); + delete _app; + _app = nullptr; } void SimulatorWin::relaunch() @@ -289,7 +291,6 @@ int SimulatorWin::run() } // create the application instance - _app = new AppDelegate(); RuntimeEngine::getInstance()->setProjectConfig(_project); // create console window @@ -404,7 +405,17 @@ int SimulatorWin::run() const bool isResize = _project.isResizeWindow(); std::stringstream title; title << "Cocos Simulator (" << _project.getFrameScale() * 100 << "%)"; - initGLContextAttrs(); + + // create opengl view, and init app + _app = new AppDelegate(title.str(), _project.getFrameScale() * frameSize.width, _project.getFrameScale() * frameSize.height); + _app->start(); + CC_SAFE_DELETE(_app); + + // path for looking Lang file, Studio Default images + FileUtils::getInstance()->addSearchPath(getApplicationPath().c_str()); + + return true; + /* auto glview = GLViewImpl::createWithRect(title.str(), frameRect, frameScale, true); _hwnd = glview->getWin32Window(); player::PlayerWin::createWithHwnd(_hwnd); @@ -456,10 +467,11 @@ int SimulatorWin::run() int ret = app->run(); CC_SAFE_DELETE(_app); return ret; + */ } // services - +/* void SimulatorWin::setupUI() { auto menuBar = player::PlayerProtocol::getInstance()->getMenuService(); @@ -733,7 +745,7 @@ void SimulatorWin::writeDebugLog(const char *log) fputc('\n', _writeDebugLogFile); fflush(_writeDebugLogFile); } - +*/ void SimulatorWin::parseCocosProjectConfig(ProjectConfig &config) { // get project directory @@ -901,7 +913,7 @@ std::string SimulatorWin::getApplicationPath() return workdir; } - +/* LRESULT CALLBACK SimulatorWin::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (!_instance) return 0; @@ -988,7 +1000,7 @@ LRESULT CALLBACK SimulatorWin::windowProc(HWND hWnd, UINT uMsg, WPARAM wParam, L } return g_oldWindowProc(hWnd, uMsg, wParam, lParam); } - +*/ void SimulatorWin::onOpenFile(const std::string &filePath) { string entry = filePath; @@ -1021,12 +1033,15 @@ void SimulatorWin::onOpenFile(const std::string &filePath) } } + /* 1. find @folderPath/config.json 2. get project name from file: @folderPath/folderName.ccs 3. find @folderPath/cocosstudio/MainScene.csd 4. find @folderPath/cocosstudio/MainScene.csb */ + +/* void SimulatorWin::onOpenProjectFolder(const std::string &folderPath) { string path = folderPath; @@ -1120,3 +1135,4 @@ void SimulatorWin::onDrop(const std::string &path) onOpenFile(path); } } +*/ diff --git a/native/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj b/native/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj index 8564d22d3b..195dea9c13 100755 --- a/native/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj +++ b/native/tools/simulator/frameworks/runtime-src/proj.win32/simulator.vcxproj @@ -81,7 +81,7 @@ ProgramDatabase EnableFastChecks Disabled - 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;%(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) 4267;4251;4244;%(DisableSpecificWarnings) true $(IntDir)vc$(PlatformToolsetVersion).pdb @@ -236,6 +236,9 @@ xcopy /Y /Q "$(OutDir)lang" "$(ProjectDir)..\..\..\runtime\win32" + + {98a51ba8-fc3a-415b-ac8f-8c7bd464e93e} + {001b324a-bb91-4e83-875c-c92f75c40857} diff --git a/native/tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.cpp b/native/tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.cpp index 0f82005a6c..a1bb64511c 100755 --- a/native/tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.cpp +++ b/native/tools/simulator/libsimulator/lib/platform/win32/PlayerTaskServiceWin.cpp @@ -139,7 +139,7 @@ bool PlayerTaskWin::run() _outputBuffWide = new WCHAR[BUFF_SIZE]; _state = STATE_RUNNING; - cocos2d::Director::getInstance()->getScheduler()->scheduleUpdate(this, 0, false); + // cocos2d::Director::getInstance()->getScheduler()->scheduleUpdate(this, 0, false); return true; } @@ -207,7 +207,7 @@ void PlayerTaskWin::update(float dt) _resultCode = (int)GetLastError(); } - cocos2d::Director::getInstance()->getScheduler()->unscheduleAllForTarget(this); + // cocos2d::Director::getInstance()->getScheduler()->unscheduleAllForTarget(this); cleanup(); } @@ -236,7 +236,7 @@ void PlayerTaskWin::cleanup() CCLOG("CMD: %s", _output.c_str()); - cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(_name); + // cocos2d::Director::getInstance()->getEventDispatcher()->dispatchCustomEvent(_name); } std::u16string PlayerTaskWin::makeCommandLine() const diff --git a/native/tools/simulator/libsimulator/lib/runtime/Runtime.cpp b/native/tools/simulator/libsimulator/lib/runtime/Runtime.cpp index f8c0c81d69..7b433180ea 100755 --- a/native/tools/simulator/libsimulator/lib/runtime/Runtime.cpp +++ b/native/tools/simulator/libsimulator/lib/runtime/Runtime.cpp @@ -321,7 +321,7 @@ void RuntimeEngine::trackEvent(const std::string &eventName) #else const char *platform = "UNKNOWN"; #endif - + /* char cidBuf[64] = {0}; auto guid = player::DeviceEx::getInstance()->getUserGUID(); snprintf(cidBuf, sizeof(cidBuf), "%x", XXH32(guid.c_str(), (int)guid.length(), 0)); @@ -340,7 +340,7 @@ void RuntimeEngine::trackEvent(const std::string &eventName) request->addPOSTValue("ea", eventName.c_str()); request->start(); - + */ #endif // ((CC_TARGET_PLATFORM == CC_PLATFORM_WIN32) || (CC_TARGET_PLATFORM == CC_PLATFORM_MAC)) } diff --git a/native/tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj b/native/tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj index cf83cbcfdf..d73531c24c 100755 --- a/native/tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj +++ b/native/tools/simulator/libsimulator/proj.win32/libsimulator.vcxproj @@ -65,7 +65,7 @@ NotUsing Level3 Disabled - WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;_USRLIBSIMSTATIC + WIN32;_WINDOWS;STRICT;_CRT_SECURE_NO_WARNINGS;_SCL_SECURE_NO_WARNINGS_DEBUG;COCOS2D_DEBUG=1;GLFW_EXPOSE_NATIVE_WIN32;GLFW_EXPOSE_NATIVE_WGL;%(PreprocessorDefinitions);_SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS;_USRLIBSIMSTATIC;_WINSOCKAPI_;_USRDLL $(ProjectDir);$(ProjectDir)..\lib\protobuf-lite;$(ProjectDir)..\lib;$(EngineRoot)external\win32-specific\zlib\include;$(EngineRoot)cocos\scripting\lua-bindings\auto;$(EngineRoot)cocos\scripting\lua-bindings\manual;$(EngineRoot)cocos\audio\include;$(EngineRoot)external;$(EngineRoot)external\lua\lua;$(EngineRoot)external\lua\tolua;$(EngineRoot)external\chipmunk\include\chipmunk;$(EngineRoot)external\curl\include\win32;$(EngineRoot)extensions;$(EngineRoot);%(AdditionalIncludeDirectories)