Make frame time in Renderer a property, update TestGame.

This commit is contained in:
2024-01-20 20:01:40 +01:00
parent 2c42856fc2
commit 3e5e010527
5 changed files with 10 additions and 5 deletions

View File

@@ -100,7 +100,7 @@ namespace DaggerFramework.Rendering
Raylib.ClearBackground(DaggerColorToRaylibColor(color));
}
public override double GetFrameTime()
protected override double GetFrameTime()
{
return (double)Raylib.GetFrameTime();
}

View File

@@ -30,6 +30,7 @@ namespace DaggerFramework.Rendering
/// </summary>
public abstract int TargetFps { get; set; }
public abstract bool VSync { get; set; }
public double FrameTime => GetFrameTime();
// WINDOW
/// <summary>
@@ -52,6 +53,7 @@ namespace DaggerFramework.Rendering
protected abstract void SetWindowTitle(string title);
protected abstract void SetWindowVSync(bool value);
protected abstract void SetTargetFps(int fps);
protected abstract double GetFrameTime();
protected abstract int GetMonitorWidth(int monitorId);
protected abstract int GetMonitorHeight(int monitorId);
protected abstract int GetCurrentMonitor();
@@ -76,7 +78,6 @@ namespace DaggerFramework.Rendering
/// </summary>
/// <param name="color">Background color.</param>
public abstract void ClearBackground(Color color);
public abstract double GetFrameTime();
/// <summary>
/// Loads the texture onto the GPU for later use in DrawTexture or other Texture related methods.

View File

@@ -89,7 +89,7 @@ namespace DaggerFramework.Rendering
}
/// <inheritdoc />
public override double GetFrameTime()
protected override double GetFrameTime()
{
return 0.0;
}

View File

@@ -13,7 +13,7 @@ namespace DaggerFramework.SceneGraph
public AudioBackend Audio => _audioBackend;
public ResourceManager ResourceManager => _resourceManager;
public double DeltaTime => Renderer.GetFrameTime();
public double DeltaTime => _renderer.FrameTime;
public bool ShouldRun => Renderer.ShouldRun;
public Scene(Renderer renderer, InputHandler input, AudioBackend audioBackend, ResourceManager resourceManager)