17.01.2021

+ WPF-Support
+ Game Controller System
+ GameKeybind System

+ SM_WPF_TEST
This commit is contained in:
Michel Fedde 2021-01-17 21:13:37 +01:00
parent af90d617d3
commit 6f23a80f7f
60 changed files with 1536 additions and 143 deletions

View file

@ -52,6 +52,8 @@ namespace SM.Base.Time
/// </summary>
public TimeSpan ElapsedSpan { get; protected set; }
public event Action<Stopwatch, UpdateContext> Tick;
/// <summary>
/// Starts the stopwatch.
/// </summary>
@ -69,10 +71,12 @@ namespace SM.Base.Time
/// Performs a tick.
/// </summary>
/// <param name="context"></param>
private protected virtual void Tick(UpdateContext context)
private protected virtual void Ticking(UpdateContext context)
{
Elapsed += context.Deltatime;
ElapsedSpan = TimeSpan.FromSeconds(Elapsed);
Tick?.Invoke(this, context);
}
/// <summary>
@ -115,7 +119,7 @@ namespace SM.Base.Time
for (var i = 0; i < _activeStopwatches.Count; i++)
{
if (_activeStopwatches[i].Paused) continue;
_activeStopwatches[i].Tick(context);
_activeStopwatches[i].Ticking(context);
}
}
}

View file

@ -1,6 +1,7 @@
#region usings
using System;
using System.Diagnostics.Eventing.Reader;
using SM.Base.Contexts;
#endregion
@ -43,7 +44,7 @@ namespace SM.Base.Time
/// <summary>
/// The event, that is triggered when the timer stops.
/// </summary>
public event Action<Timer, UpdateContext> EndAction;
public event Action<Timer, UpdateContext> End;
/// <inheritdoc />
public override void Start()
@ -52,9 +53,9 @@ namespace SM.Base.Time
Reset();
}
private protected override void Tick(UpdateContext context)
private protected override void Ticking(UpdateContext context)
{
base.Tick(context);
base.Ticking(context);
ElapsedNormalized = Elapsed / Target;
if (ElapsedNormalized >= 1) Stopping(context);
@ -70,12 +71,12 @@ namespace SM.Base.Time
}
/// <summary>
/// This will trigger <see cref="EndAction" />
/// This will trigger <see cref="End" />
/// </summary>
/// <param name="context"></param>
protected void TriggerEndAction(UpdateContext context)
{
EndAction?.Invoke(this, context);
End?.Invoke(this, context);
}
}
}