diff --git a/native/cocos/platform/openharmony/modules/SystemWindow.cpp b/native/cocos/platform/openharmony/modules/SystemWindow.cpp index a5c60667c2..32e8c01b27 100644 --- a/native/cocos/platform/openharmony/modules/SystemWindow.cpp +++ b/native/cocos/platform/openharmony/modules/SystemWindow.cpp @@ -27,6 +27,7 @@ #include "base/Log.h" #include "base/Macros.h" #include "platform/openharmony/OpenHarmonyPlatform.h" +#include "platform/openharmony/napi/NapiHelper.h" namespace cc { @@ -76,6 +77,10 @@ void SystemWindow::setViewSize(uint32_t width, uint32_t height) { _height = height; } +void SystemWindow::closeWindow() { + NapiHelper::napiCallFunction("terminateProcess"); +} + SystemWindow::Size SystemWindow::getViewSize() const { return Size{static_cast(_width), static_cast(_height)}; diff --git a/native/cocos/platform/openharmony/modules/SystemWindow.h b/native/cocos/platform/openharmony/modules/SystemWindow.h index 41a1b37698..b13a2762a9 100644 --- a/native/cocos/platform/openharmony/modules/SystemWindow.h +++ b/native/cocos/platform/openharmony/modules/SystemWindow.h @@ -46,7 +46,7 @@ public: void setWindowHandle(void* window); Size getViewSize() const override; void setViewSize(uint32_t width, uint32_t height) override; - + void closeWindow() override; /** @brief enable/disable(lock) the cursor, default is enabled */