From fd2e6ac69f1b0c29dc844aaeccd8034dfbb9ca7a Mon Sep 17 00:00:00 2001 From: MrScautHD <65916181+MrScautHD@users.noreply.github.com> Date: Sat, 19 Aug 2023 22:40:07 +0200 Subject: [PATCH] Update Window.cs --- Raylib-cs/types/Window.cs | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/Raylib-cs/types/Window.cs b/Raylib-cs/types/Window.cs index dbf8ddb..6561a6c 100644 --- a/Raylib-cs/types/Window.cs +++ b/Raylib-cs/types/Window.cs @@ -5,27 +5,19 @@ namespace Raylib_cs; public class Window : IDisposable { + private static Window _instance; - private readonly int _width; - private readonly int _height; - private readonly string _title; - - public Window(int width, int height, string title) + private Window(int width, int height, string title) { - this._width = width; - this._height = height; - this._title = title; + Raylib.InitWindow(width, height, title); + _instance = this; } /// /// Initializes the object if it is not ready. /// - public void Init() - { - if (!IsReady()) - { - Raylib.InitWindow(this._width, this._height, this._title); - } + public static Window Instance(int width, int height, string title) { + return _instance ?? new Window(width, height, title); } /// See @@ -166,6 +158,7 @@ public class Window : IDisposable public void Dispose() { if (!IsReady()) return; + this.Close(); } } \ No newline at end of file