Update method names for Game, add documentation for renderers, remove position argument from DrawSdfText and DrawDebugText in Renderer.

This commit is contained in:
2023-06-17 23:09:21 +02:00
parent 52a3b2f87d
commit d5f5fb5614
7 changed files with 148 additions and 246 deletions

View File

@@ -6,16 +6,23 @@ using Silk.NET.OpenGL;
namespace DaggerFramework.Rendering
{
public class GlRenderer : Renderer
/// <summary>
/// A standard, OpenGL-based renderer.
/// </summary>
public class StandardRenderer : Renderer
{
/// <inheritdoc />
public override Vector2 WindowSize => throw new NotImplementedException();
/// <inheritdoc />
public override bool ShouldRun => throw new NotImplementedException();
/// <inheritdoc />
public override void Initialize(RendererSettings settings)
{
}
/// <inheritdoc />
public override void CreateAndInitialize(WindowSettings windowSettings, RendererSettings renderSettings)
{
CreateWindow(windowSettings);
@@ -28,80 +35,97 @@ namespace DaggerFramework.Rendering
_gl.Viewport(new Size((int)_windowSize.X, (int)_windowSize.Y));
}
/// <inheritdoc />
public override void EndFrame()
{
// throw new NotImplementedException();
EndFrameUnsafe();
}
/// <inheritdoc />
public override void ClearBackground(Color color)
{
_gl.ClearColor(color.ToSystemColor());
_gl.Clear((uint)ClearBufferMask.ColorBufferBit);
}
/// <inheritdoc />
public override void CreateWindow(string title, Vector2 size) => CreateWindowUnsafe(title, size);
/// <inheritdoc />
public override void Shutdown()
{
CloseWindowUnsafe();
_glfw.Terminate();
}
/// <inheritdoc />
public override void DrawCircle(float radius, Color color)
{
throw new NotImplementedException();
}
public override void DrawDebugText(Vector2 position, string text, int fontSize, Color color)
/// <inheritdoc />
public override void DrawDebugText(string text, int fontSize, Color color)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override void DrawRectangle(Vector2 size, Color color)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override void DrawTexture(int id, Color tint)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override double GetFrameTime()
{
return 0.0;
}
/// <inheritdoc />
public override int LoadTexture(Texture2d texture)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override void SetTargetFps(int fps)
{
return;
}
/// <inheritdoc />
public override void SetTransform(Vector2 position, float rotation = 0)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override void SetTransform(Matrix4x4 transform)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override void SetWindowTitle(string title)
{
SetWindowTitleUnsafe(title);
}
/// <inheritdoc />
public override void SetWindowVSync(bool value)
{
throw new NotImplementedException();
}
/// <inheritdoc />
public override bool WindowShouldClose() => WindowShouldCloseUnsafe();
private unsafe void CreateWindowUnsafe(string title, Vector2 size)
@@ -127,7 +151,7 @@ namespace DaggerFramework.Rendering
_glfw.SwapBuffers(_windowHandle);
}
public override void DrawSdfText(Vector2 position, string text, int fontSize, Color color)
public override void DrawSdfText(string text, int fontSize, Color color)
{
throw new NotImplementedException();
}