1
0
mirror of https://github.com/DarthAffe/CUE.NET.git synced 2025-12-13 00:58:31 +00:00

Added deltaTime-parameter to UpdatingEventArgs

This commit is contained in:
Darth Affe 2016-06-03 22:02:35 +02:00
parent 5d1c8a1433
commit d453cdc9bc
2 changed files with 20 additions and 2 deletions

View File

@ -64,6 +64,7 @@ namespace CUE.NET.Devices.Generic
private CancellationTokenSource _updateTokenSource; private CancellationTokenSource _updateTokenSource;
private CancellationToken _updateToken; private CancellationToken _updateToken;
private Task _updateTask; private Task _updateTask;
private DateTime _lastUpdate = DateTime.Now;
#endregion #endregion
@ -356,7 +357,9 @@ namespace CUE.NET.Devices.Generic
{ {
try try
{ {
Updating?.Invoke(this, new UpdatingEventArgs()); long lastUpdateTicks = _lastUpdate.Ticks;
_lastUpdate = DateTime.Now;
Updating?.Invoke(this, new UpdatingEventArgs((float)((DateTime.Now.Ticks - lastUpdateTicks) / 10000000f)));
} }
catch catch
{ {

View File

@ -1,5 +1,20 @@
namespace CUE.NET.Devices.Generic.EventArgs namespace CUE.NET.Devices.Generic.EventArgs
{ {
public class UpdatingEventArgs : System.EventArgs public class UpdatingEventArgs : System.EventArgs
{ } {
#region Properties & Fields
public float DeltaTime { get; }
#endregion
#region Constructors
public UpdatingEventArgs(float deltaTime)
{
this.DeltaTime = deltaTime;
}
#endregion
}
} }