using System; using System.Numerics; namespace Raylib_cs; public sealed class Window : IDisposable { private static Window _instance; private Window(ConfigFlags flags, int width, int height, string title) { Raylib.SetConfigFlags(flags); Raylib.InitWindow(width, height, title); _instance = this; } /// /// Gets an instance of the Window or creates a new one if it doesn't exist. /// /// The configuration flags for the window. /// The width of the window. /// The height of the window. /// The title of the window. /// An instance of the Window. public static Window Instance(ConfigFlags flags, int width, int height, string title) { return _instance ?? new Window(flags, width, height, title); } /// public bool ShouldClose() => Raylib.WindowShouldClose(); /// public void Close() => Raylib.CloseWindow(); /// public void TakeScreenshot(string path) => Raylib.TakeScreenshot(path); /// public bool IsReady() => Raylib.IsWindowReady(); /// public bool IsFullscreen() => Raylib.IsWindowFullscreen(); /// public bool IsHidden() => Raylib.IsWindowHidden(); /// public bool IsMinimized() => Raylib.IsWindowMinimized(); /// public bool IsMaximized() => Raylib.IsWindowMaximized(); /// public bool IsFocused() => Raylib.IsWindowFocused(); /// public bool IsResized() => Raylib.IsWindowResized(); /// public bool IsState(ConfigFlags state) => Raylib.IsWindowState(state); /// public bool SetState(ConfigFlags state) => Raylib.SetWindowState(state); /// public void ClearState(ConfigFlags state) => Raylib.ClearWindowState(state); /// public void ToggleFullscreen() => Raylib.ToggleFullscreen(); /// public void Maximize() => Raylib.MaximizeWindow(); /// public void Minimize() => Raylib.MinimizeWindow(); /// public void Restore() => Raylib.RestoreWindow(); /// public void SetIcon(Image image) => Raylib.SetWindowIcon(image); /// public unsafe void SetIcons(Image* images, int count) => Raylib.SetWindowIcons(images, count); /// public void SetTitle(string title) => Raylib.SetWindowTitle(title); /// public void SetClipboardText(string path) => Raylib.SetClipboardText(path); /// public void SetPosition(int x, int y) => Raylib.SetWindowPosition(x, y); /// public void SetMonitor(int monitor) => Raylib.SetWindowMonitor(monitor); /// public void SetMinSize(int width, int height) => Raylib.SetWindowMinSize(width, height); /// public void SetSize(int width, int height) => Raylib.SetWindowSize(width, height); /// public void SetOpacity(float opacity) => Raylib.SetWindowOpacity(opacity); /// public void EnableEventWaiting() => Raylib.EnableEventWaiting(); /// public void DisableEventWaiting() => Raylib.DisableEventWaiting(); /// public int GetScreenWidth() => Raylib.GetScreenWidth(); /// public int GetScreenHeight() => Raylib.GetScreenHeight(); /// public int GetRenderWidth() => Raylib.GetRenderWidth(); /// public int GetRenderHeight() => Raylib.GetRenderHeight(); /// public int GetMonitorCount() => Raylib.GetMonitorCount(); /// public int GetCurrentMonitor() => Raylib.GetCurrentMonitor(); /// public Vector2 GetMonitorPosition(int monitor) => Raylib.GetMonitorPosition(monitor); /// public int GetMonitorWidth(int monitor) => Raylib.GetMonitorWidth(monitor); /// public int GetMonitorHeight(int monitor) => Raylib.GetMonitorHeight(monitor); /// public int GetMonitorPhysicalWidth(int monitor) => Raylib.GetMonitorPhysicalWidth(monitor); /// public int GetMonitorPhysicalHeight(int monitor) => Raylib.GetMonitorPhysicalHeight(monitor); /// public int GetMonitorRefreshRate(int monitor) => Raylib.GetMonitorRefreshRate(monitor); /// public Vector2 GetPosition() => Raylib.GetWindowPosition(); /// public Vector2 GetScaleDpi() => Raylib.GetWindowScaleDPI(); /// public string GetMonitorName(int monitor) => Raylib.GetMonitorName_(monitor); /// public string GetClipboardText() => Raylib.GetClipboardText_(); public void Dispose() { if (!IsReady()) return; this.Close(); _instance = null; } }