Append allocation and generics fixes

This commit is contained in:
Simon Lübeß
2025-01-31 13:17:12 +01:00
parent 577cca5886
commit 2f0505241f
6 changed files with 15 additions and 20 deletions
+3 -10
View File
@@ -8,7 +8,7 @@ namespace GlitchyEngine
*/
public class GameTime
{
private Stopwatch _stopwatch;
private append Stopwatch _stopwatch = .() ~ delete:append _;
private uint64 _frameCount;
@@ -31,22 +31,15 @@ namespace GlitchyEngine
/// The interval in seconds from the last frame to the current one.
public float DeltaTime => (float)_frameTime.TotalSeconds;
/**
* Initializes a new instance of a GameTime.
*/
[AllowAppend]
public this() : this(false) {}
/**
* Initializes a new instance of a GameTime.
* @param startNow If set to true, the timer will start immediately.
* If set to false, the timer has to be started manually.
*/
[AllowAppend]
public this(bool startNow)
public this(bool startNow = false)
{
let sw = append Stopwatch(startNow);
_stopwatch = sw;
_stopwatch.Restart();
}
/**