using System; using System.Numerics; namespace Raylib_cs; public 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); } /// See public bool ShouldClose() => Raylib.WindowShouldClose(); /// See public void Close() => Raylib.CloseWindow(); /// See public void TakeScreenshot(string path) => Raylib.TakeScreenshot(path); /// See public bool IsReady() => Raylib.IsWindowReady(); /// See public bool IsFullscreen() => Raylib.IsWindowFullscreen(); /// See public bool IsHidden() => Raylib.IsWindowHidden(); /// See public bool IsMinimized() => Raylib.IsWindowMinimized(); /// See public bool IsMaximized() => Raylib.IsWindowMaximized(); /// See public bool IsFocused() => Raylib.IsWindowFocused(); /// See public bool IsResized() => Raylib.IsWindowResized(); /// See public bool IsState(ConfigFlags state) => Raylib.IsWindowState(state); /// See public bool SetState(ConfigFlags state) => Raylib.SetWindowState(state); /// See public void ClearState(ConfigFlags state) => Raylib.ClearWindowState(state); /// See public void ToggleFullscreen() => Raylib.ToggleFullscreen(); /// See public void Maximize() => Raylib.MaximizeWindow(); /// See public void Minimize() => Raylib.MinimizeWindow(); /// See public void Restore() => Raylib.RestoreWindow(); /// See public void SetIcon(Image image) => Raylib.SetWindowIcon(image); /// See public unsafe void SetIcons(Image* images, int count) => Raylib.SetWindowIcons(images, count); /// See public void SetTitle(string title) => Raylib.SetWindowTitle(title); /// See public void SetClipboardText(string path) => Raylib.SetClipboardText(path); /// See public void SetPosition(int x, int y) => Raylib.SetWindowPosition(x, y); /// See public void SetMonitor(int monitor) => Raylib.SetWindowMonitor(monitor); /// See public void SetMinSize(int width, int height) => Raylib.SetWindowMinSize(width, height); /// See public void SetSize(int width, int height) => Raylib.SetWindowSize(width, height); /// See public void SetOpacity(float opacity) => Raylib.SetWindowOpacity(opacity); /// See public void EnableEventWaiting() => Raylib.EnableEventWaiting(); /// See public void DisableEventWaiting() => Raylib.DisableEventWaiting(); /// See public int GetScreenWidth() => Raylib.GetScreenWidth(); /// See public int GetScreenHeight() => Raylib.GetScreenHeight(); /// See public int GetRenderWidth() => Raylib.GetRenderWidth(); /// See public int GetRenderHeight() => Raylib.GetRenderHeight(); /// See public int GetMonitorCount() => Raylib.GetMonitorCount(); /// See public int GetCurrentMonitor() => Raylib.GetCurrentMonitor(); /// See public Vector2 GetMonitorPosition(int monitor) => Raylib.GetMonitorPosition(monitor); /// See public int GetMonitorWidth(int monitor) => Raylib.GetMonitorWidth(monitor); /// See public int GetMonitorHeight(int monitor) => Raylib.GetMonitorHeight(monitor); /// See public int GetMonitorPhysicalWidth(int monitor) => Raylib.GetMonitorPhysicalWidth(monitor); /// See public int GetMonitorPhysicalHeight(int monitor) => Raylib.GetMonitorPhysicalHeight(monitor); /// See public int GetMonitorRefreshRate(int monitor) => Raylib.GetMonitorRefreshRate(monitor); /// See public Vector2 GetPosition() => Raylib.GetWindowPosition(); /// See public Vector2 GetScaleDpi() => Raylib.GetWindowScaleDPI(); /// See public string GetMonitorName(int monitor) => Raylib.GetMonitorName_(monitor); public void Dispose() { if (!IsReady()) return; this.Close(); } }