mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-21 08:02:39 +08:00
refine: rename windowHanler to windowHandle, rename onDestory to onDestroy (#11907)
This commit is contained in:
@@ -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())};
|
||||
|
||||
Reference in New Issue
Block a user