diff --git a/Raylib-cs/types/Window.cs b/Raylib-cs/types/Window.cs new file mode 100644 index 0000000..26a71f5 --- /dev/null +++ b/Raylib-cs/types/Window.cs @@ -0,0 +1,173 @@ +using System; +using System.Numerics; + +namespace Raylib_cs; + +public class Window : IDisposable +{ + + private readonly int _width; + private readonly int _height; + private readonly string _title; + + public static bool HasInitialized { get; private set; } + + public Window(int width, int height, string title) + { + this._width = width; + this._height = height; + this._title = title; + } + + /// + /// Initializes the object if it is not ready. + /// + public void Init() + { + if (!HasInitialized) + Raylib.InitWindow(this._width, this._height, this._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 SetConfigFlag(ConfigFlags state) => Raylib.SetConfigFlags(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 (!HasInitialized) return; + + this.Close(); + HasInitialized = false; + } +} \ No newline at end of file