diff --git a/Source/Engine/Platform/Base/PlatformBase.cpp b/Source/Engine/Platform/Base/PlatformBase.cpp index 65f995967..c9661709f 100644 --- a/Source/Engine/Platform/Base/PlatformBase.cpp +++ b/Source/Engine/Platform/Base/PlatformBase.cpp @@ -45,6 +45,7 @@ static_assert(sizeof(double) == 8, "Invalid double type size."); static_assert((PLATFORM_THREADS_LIMIT & (PLATFORM_THREADS_LIMIT - 1)) == 0, "Threads limit must be power of two."); static_assert(PLATFORM_THREADS_LIMIT % 4 == 0, "Threads limit must be multiple of 4."); +const Char* PlatformBase::ApplicationClassName = TEXT("FlaxWindow"); float PlatformBase::CustomDpiScale = 1.0f; Array> PlatformBase::Users; Delegate PlatformBase::UserAdded; diff --git a/Source/Engine/Platform/Base/PlatformBase.h b/Source/Engine/Platform/Base/PlatformBase.h index fb2c68099..0b5cab0bc 100644 --- a/Source/Engine/Platform/Base/PlatformBase.h +++ b/Source/Engine/Platform/Base/PlatformBase.h @@ -190,6 +190,13 @@ DECLARE_SCRIPTING_TYPE_MINIMAL(PlatformBase); /// static void Exit(); +public: + + /// + /// Application windows class name. + /// + static const Char* ApplicationClassName; + public: /// /// Copy memory region diff --git a/Source/Engine/Platform/GDK/GDKPlatform.cpp b/Source/Engine/Platform/GDK/GDKPlatform.cpp index ad9bf07c0..969f24934 100644 --- a/Source/Engine/Platform/GDK/GDKPlatform.cpp +++ b/Source/Engine/Platform/GDK/GDKPlatform.cpp @@ -30,7 +30,6 @@ inline bool operator==(const APP_LOCAL_DEVICE_ID& l, const APP_LOCAL_DEVICE_ID& return Platform::MemoryCompare(&l, &r, sizeof(APP_LOCAL_DEVICE_ID)) == 0; } -const Char* GDKPlatform::ApplicationWindowClass = TEXT("FlaxWindow"); void* GDKPlatform::Instance = nullptr; Delegate<> GDKPlatform::Suspended; Delegate<> GDKPlatform::Resumed; @@ -317,7 +316,7 @@ void GDKPlatform::PreInit(void* hInstance) windowsClass.style = CS_HREDRAW | CS_VREDRAW; windowsClass.lpfnWndProc = WndProc; windowsClass.hInstance = (HINSTANCE)Instance; - windowsClass.lpszClassName = ApplicationWindowClass; + windowsClass.lpszClassName = ApplicationClassName; if (!RegisterClassW(&windowsClass)) { Error(TEXT("Window class registration failed!")); @@ -477,7 +476,7 @@ void GDKPlatform::Exit() if (PlmSignalResume) CloseHandle(PlmSignalResume); - UnregisterClassW(ApplicationWindowClass, nullptr); + UnregisterClassW(ApplicationClassName, nullptr); XGameRuntimeUninitialize(); } diff --git a/Source/Engine/Platform/GDK/GDKPlatform.h b/Source/Engine/Platform/GDK/GDKPlatform.h index 24bdd8dc9..de24458a3 100644 --- a/Source/Engine/Platform/GDK/GDKPlatform.h +++ b/Source/Engine/Platform/GDK/GDKPlatform.h @@ -13,11 +13,6 @@ class FLAXENGINE_API GDKPlatform : public Win32Platform { public: - /// - /// Win32 application windows class name. - /// - static const Char* ApplicationWindowClass; - /// /// Handle to Win32 application instance. /// diff --git a/Source/Engine/Platform/GDK/GDKWindow.cpp b/Source/Engine/Platform/GDK/GDKWindow.cpp index a82fb4aba..c8be2df3f 100644 --- a/Source/Engine/Platform/GDK/GDKWindow.cpp +++ b/Source/Engine/Platform/GDK/GDKWindow.cpp @@ -71,7 +71,7 @@ GDKWindow::GDKWindow(const CreateWindowSettings& settings) // Creating the window _handle = CreateWindowExW( exStyle, - Platform::ApplicationWindowClass, + Platform::ApplicationClassName, settings.Title.GetText(), style, x, diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.cpp b/Source/Engine/Platform/Windows/WindowsPlatform.cpp index 222a20055..e8468172a 100644 --- a/Source/Engine/Platform/Windows/WindowsPlatform.cpp +++ b/Source/Engine/Platform/Windows/WindowsPlatform.cpp @@ -34,7 +34,6 @@ #define CLR_EXCEPTION 0xE0434352 #define VCPP_EXCEPTION 0xE06D7363 -const Char* WindowsPlatform::ApplicationWindowClass = TEXT("FlaxWindow"); void* WindowsPlatform::Instance = nullptr; #if CRASH_LOG_ENABLE || TRACY_ENABLE @@ -528,7 +527,7 @@ void WindowsPlatform::PreInit(void* hInstance) windowsClass.hInstance = (HINSTANCE)Instance; windowsClass.hIcon = LoadIconW(GetModuleHandle(nullptr), MAKEINTRESOURCE(IDR_MAINFRAME)); windowsClass.hCursor = LoadCursor(nullptr, IDC_ARROW); - windowsClass.lpszClassName = ApplicationWindowClass; + windowsClass.lpszClassName = ApplicationClassName; if (!RegisterClassW(&windowsClass)) { Error(TEXT("Window class registration failed!")); @@ -780,7 +779,7 @@ void WindowsPlatform::Exit() #endif // Unregister app class - UnregisterClassW(ApplicationWindowClass, nullptr); + UnregisterClassW(ApplicationClassName, nullptr); Win32Platform::Exit(); } diff --git a/Source/Engine/Platform/Windows/WindowsPlatform.h b/Source/Engine/Platform/Windows/WindowsPlatform.h index a8f0e4996..688230e9a 100644 --- a/Source/Engine/Platform/Windows/WindowsPlatform.h +++ b/Source/Engine/Platform/Windows/WindowsPlatform.h @@ -13,11 +13,6 @@ class FLAXENGINE_API WindowsPlatform : public Win32Platform { public: - /// - /// Win32 application windows class name. - /// - static const Char* ApplicationWindowClass; - /// /// Handle to Win32 application instance. /// diff --git a/Source/Engine/Platform/Windows/WindowsWindow.cpp b/Source/Engine/Platform/Windows/WindowsWindow.cpp index 8b8986f5e..4915a767d 100644 --- a/Source/Engine/Platform/Windows/WindowsWindow.cpp +++ b/Source/Engine/Platform/Windows/WindowsWindow.cpp @@ -120,7 +120,7 @@ WindowsWindow::WindowsWindow(const CreateWindowSettings& settings) // Creating the window _handle = CreateWindowExW( exStyle, - Platform::ApplicationWindowClass, + Platform::ApplicationClassName, settings.Title.GetText(), style, x,