refine: rename windowHanler to windowHandle, rename onDestory to onDestroy (#11907)

This commit is contained in:
bofeng-song
2022-07-09 13:54:18 +08:00
committed by GitHub
parent 439e484ada
commit 113fad0259
34 changed files with 93 additions and 96 deletions
@@ -30,7 +30,7 @@
#include <functional>
#include <thread>
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
#include "android/AndroidPlatform.h"
#include <android/native_window.h>
#endif
#include "BasePlatform.h"
@@ -52,23 +52,26 @@ void SystemWindow::copyTextToClipboard(const ccstd::string &text) {
copyTextToClipboardJNI(text);
}
uintptr_t SystemWindow::getWindowHandler() const {
void SystemWindow::setWindowHandle(void *handle) {
_windowHandle = handle;
}
uintptr_t SystemWindow::getWindowHandle() const {
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
auto *platform = dynamic_cast<AndroidPlatform *>(BasePlatform::getPlatform());
CC_ASSERT(platform != nullptr);
return platform->getWindowHandler();
CC_ASSERT(_windowHandle);
return reinterpret_cast<uintptr_t>(_windowHandle);
#else
return reinterpret_cast<uintptr_t>(
JNI_NATIVE_GLUE()->getWindowHandler());
JNI_NATIVE_GLUE()->getWindowHandle());
#endif
}
SystemWindow::Size SystemWindow::getViewSize() const {
#if (CC_PLATFORM == CC_PLATFORM_ANDROID)
auto *platform = dynamic_cast<AndroidPlatform *>(BasePlatform::getPlatform());
CC_ASSERT(platform != nullptr);
return Size{static_cast<float>(platform->getWidth()),
static_cast<float>(platform->getHeight())};
CC_ASSERT(_windowHandle);
auto *nativeWindow = static_cast<ANativeWindow *>(_windowHandle);
return Size{static_cast<float>(ANativeWindow_getWidth(nativeWindow)),
static_cast<float>(ANativeWindow_getHeight(nativeWindow))};
#else
return Size{static_cast<float>(JNI_NATIVE_GLUE()->getWidth()),
static_cast<float>(JNI_NATIVE_GLUE()->getHeight())};