using System;
using System.Numerics;
namespace Raylib_cs;
public sealed class Window : IDisposable
{
public event OnInit Init;
public event OnUpdate Update;
public event OnDraw Draw;
public event OnClose Close;
private int _width;
private int _height;
private string _title;
public Window(int width, int height, string title) {
this._width = width;
this._height = height;
this._title = title;
}
public void Run() {
Raylib.InitWindow(_width, _height, _title);
Init?.Invoke();
while (!ShouldClose()) {
Update?.Invoke();
Raylib.BeginDrawing();
Raylib.ClearBackground(Color.SKYBLUE);
Draw?.Invoke();
Raylib.EndDrawing();
}
Close?.Invoke();
Raylib.CloseWindow();
}
///
public bool ShouldClose() => Raylib.WindowShouldClose();
///
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 delegate void OnInit();
public delegate void OnUpdate();
public delegate void OnDraw();
public delegate void OnClose();
public void Dispose() { }
}