// Copyright (c) 2012-2023 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 BatteryInfo GetBatteryInfo();
static int32 GetDpi();
static String GetUserLocaleName();
static String GetComputerName();
static bool GetHasFocus();
static bool CanOpenUrl(const StringView& url);
static void OpenUrl(const StringView& url);
static Float2 GetMousePosition();
static void SetMousePosition(const Float2& pos);
static Rectangle GetMonitorBounds(const Float2& screenPos);
static Float2 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 CreateProcess(CreateProcessSettings& settings);
static Window* CreateWindow(const CreateWindowSettings& settings);
static void* LoadLibrary(const Char* filename);
#if CRASH_LOG_ENABLE
static Array GetStackFrames(int32 skipCount = 0, int32 maxDepth = 60, void* context = nullptr);
static void CollectCrashData(const String& crashDataFolder, void* context = nullptr);
#endif
};
#endif