Update Window.cs
This commit is contained in:
parent
a8bc5d5b58
commit
fd2e6ac69f
1 changed files with 7 additions and 14 deletions
|
|
@ -5,27 +5,19 @@ namespace Raylib_cs;
|
||||||
|
|
||||||
public class Window : IDisposable
|
public class Window : IDisposable
|
||||||
{
|
{
|
||||||
|
private static Window _instance;
|
||||||
|
|
||||||
private readonly int _width;
|
private Window(int width, int height, string title)
|
||||||
private readonly int _height;
|
|
||||||
private readonly string _title;
|
|
||||||
|
|
||||||
public Window(int width, int height, string title)
|
|
||||||
{
|
{
|
||||||
this._width = width;
|
Raylib.InitWindow(width, height, title);
|
||||||
this._height = height;
|
_instance = this;
|
||||||
this._title = title;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes the object if it is not ready.
|
/// Initializes the object if it is not ready.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Init()
|
public static Window Instance(int width, int height, string title) {
|
||||||
{
|
return _instance ?? new Window(width, height, title);
|
||||||
if (!IsReady())
|
|
||||||
{
|
|
||||||
Raylib.InitWindow(this._width, this._height, this._title);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary> See <see cref="Raylib.WindowShouldClose"/> </summary>
|
/// <summary> See <see cref="Raylib.WindowShouldClose"/> </summary>
|
||||||
|
|
@ -166,6 +158,7 @@ public class Window : IDisposable
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (!IsReady()) return;
|
if (!IsReady()) return;
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in a new issue