UI WIP
This commit is contained in:
@@ -7,14 +7,26 @@ namespace DaggerFramework.Rendering
|
||||
{
|
||||
public class RaylibRenderer : Renderer
|
||||
{
|
||||
public override Vector2 WindowSize => _windowSize;
|
||||
public override Vector2 WindowSize => new Vector2(Raylib.GetScreenWidth(), Raylib.GetScreenHeight());
|
||||
public override bool ShouldRun => !WindowShouldClose();
|
||||
|
||||
public override void CreateWindow(string title, Vector2 size)
|
||||
// public override void CreateWindow(string title, Vector2 size)
|
||||
// {
|
||||
// Raylib.SetTraceLogLevel(TraceLogLevel.LOG_NONE);
|
||||
// _windowSize = size;
|
||||
// Raylib.InitWindow((int)_windowSize.X, (int)_windowSize.Y, title);
|
||||
// }
|
||||
|
||||
public override void CreateWindow(WindowSettings windowSettings)
|
||||
{
|
||||
Raylib.SetTraceLogLevel(TraceLogLevel.LOG_NONE);
|
||||
_windowSize = size;
|
||||
Raylib.InitWindow((int)_windowSize.X, (int)_windowSize.Y, title);
|
||||
_windowSize = windowSettings.Size;
|
||||
|
||||
ConfigFlags windowFlags = 0;
|
||||
windowFlags |= windowSettings.Resizable ? ConfigFlags.FLAG_WINDOW_RESIZABLE : 0;
|
||||
|
||||
Raylib.InitWindow((int)_windowSize.X, (int)_windowSize.Y, windowSettings.Title);
|
||||
Raylib.SetWindowState(windowFlags);
|
||||
}
|
||||
|
||||
public override void SetWindowTitle(string title)
|
||||
@@ -179,6 +191,7 @@ namespace DaggerFramework.Rendering
|
||||
|
||||
// Fullscreen
|
||||
flags |= settings.Fullscreen ? ConfigFlags.FLAG_FULLSCREEN_MODE : 0;
|
||||
|
||||
Raylib.SetConfigFlags(flags);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,15 +32,10 @@ namespace DaggerFramework.Rendering
|
||||
/// </summary>
|
||||
public abstract Vector2 WindowSize { get; }
|
||||
/// <summary>
|
||||
/// Creates the window with a given title and size.
|
||||
/// Creates a window.
|
||||
/// </summary>
|
||||
/// <param name="title">Title of the window.</param>
|
||||
/// <param name="size">Vector2 representing size.</param>
|
||||
public abstract void CreateWindow(string title, Vector2 size);
|
||||
public void CreateWindow(WindowSettings windowSettings)
|
||||
{
|
||||
CreateWindow(windowSettings.Title, windowSettings.Size);
|
||||
}
|
||||
/// <param name="windowSettings">Window settings to use to create the window.</param>
|
||||
public abstract void CreateWindow(WindowSettings windowSettings);
|
||||
|
||||
// TODO: use properties for these.
|
||||
public abstract void SetWindowTitle(string title);
|
||||
@@ -151,6 +146,7 @@ namespace DaggerFramework.Rendering
|
||||
{
|
||||
public string Title;
|
||||
public Vector2 Size = new Vector2(640, 480);
|
||||
public bool Resizable { get; set; }
|
||||
|
||||
public WindowSettings(string title, Vector2 size)
|
||||
{
|
||||
|
||||
@@ -49,9 +49,6 @@ namespace DaggerFramework.Rendering
|
||||
_gl.Clear((uint)ClearBufferMask.ColorBufferBit);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void CreateWindow(string title, Vector2 size) => CreateWindowUnsafe(title, size);
|
||||
|
||||
/// <inheritdoc />
|
||||
public override void Shutdown()
|
||||
{
|
||||
@@ -176,6 +173,10 @@ namespace DaggerFramework.Rendering
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public override void CreateWindow(WindowSettings windowSettings)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private GL _gl;
|
||||
private Glfw _glfw;
|
||||
|
||||
Reference in New Issue
Block a user