// Copyright (c) 2012-2021 Wojciech Figat. All rights reserved. #pragma once #if PLATFORM_WINDOWS #include "Engine/Platform/Win32/Win32Platform.h" /// /// The Windows platform implementation and application management utilities. /// class FLAXENGINE_API WindowsPlatform : public Win32Platform { public: /// /// Win32 application windows class name. /// static const Char* ApplicationWindowClass; /// /// Handle to Win32 application instance. /// static void* Instance; public: /// /// Creates the system-wide mutex. /// /// The name of the mutex. /// True if mutex already exists, otherwise false. static bool CreateMutex(const Char* name); /// /// Releases the mutex. /// static void ReleaseMutex(); /// /// Pre initialize platform. /// /// The Win32 application instance. static void PreInit(void* hInstance); /// /// Returns true if current OS version is Windows 10. /// /// True if running on Windows 10 or later, otherwise false. static bool IsWindows10(); static bool ReadRegValue(void* root, const String& key, const String& name, String* result); public: // [Win32Platform] static bool Init(); static void LogInfo(); static void Tick(); static void BeforeExit(); static void Exit(); #if !BUILD_RELEASE static void Log(const StringView& msg); static bool IsDebuggerPresent(); #endif static void SetHighDpiAwarenessEnabled(bool enable); static int32 GetDpi(); static String GetUserLocaleName(); static String GetComputerName(); static String GetUserName(); static bool GetHasFocus(); static bool CanOpenUrl(const StringView& url); static void OpenUrl(const StringView& url); static Rectangle GetMonitorBounds(const Vector2& screenPos); static Vector2 GetDesktopSize(); static Rectangle GetVirtualDesktopBounds(); static void GetEnvironmentVariables(Dictionary& result); static bool GetEnvironmentVariable(const String& name, String& value); static bool SetEnvironmentVariable(const String& name, const String& value); static int32 StartProcess(const StringView& filename, const StringView& args, const StringView& workingDir, bool hiddenWindow = false, bool waitForEnd = false); static int32 RunProcess(const StringView& cmdLine, const StringView& workingDir, bool hiddenWindow = true); static int32 RunProcess(const StringView& cmdLine, const StringView& workingDir, const Dictionary& environment, bool hiddenWindow = true); static Window* CreateWindow(const CreateWindowSettings& settings); static void* LoadLibrary(const Char* filename); static Array GetStackTrace(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr); #if CRASH_LOG_ENABLE static void CollectCrashData(const String& crashDataFolder, void* context = nullptr); #endif }; #endif