2021-19-03
SM.Base: ~ Improved Keyboard.AreSpecificKeysPressed(int, int) ~ Made GenericTransformation.LastMaster's set public ~ Made the fixed update use the property "IsExiting" to determent if it should stop. ~ The MainFramebuffer of each RenderPipeline now has always a name. SM2D: ~ Moved the checking code of Mouse2D.MouseOver into a own method.
This commit is contained in:
parent
c8db1ce8bc
commit
71a22df8bd
7 changed files with 31 additions and 18 deletions
|
|
@ -121,12 +121,6 @@ namespace SM.Base.Window
|
|||
Mouse.MouseMoveEvent(e, this);
|
||||
}
|
||||
|
||||
protected override void OnClosing(CancelEventArgs e)
|
||||
{
|
||||
base.OnClosing(e);
|
||||
_fixedUpdateThread?.Abort();
|
||||
}
|
||||
|
||||
public void Update(UpdateContext context)
|
||||
{
|
||||
|
||||
|
|
@ -201,7 +195,7 @@ namespace SM.Base.Window
|
|||
private void ExecuteFixedUpdate()
|
||||
{
|
||||
Stopwatch deltaStop = new Stopwatch();
|
||||
while (Thread.CurrentThread.ThreadState != System.Threading.ThreadState.AbortRequested)
|
||||
while (!IsExiting)
|
||||
{
|
||||
deltaStop.Restart();
|
||||
|
||||
|
|
@ -210,7 +204,8 @@ namespace SM.Base.Window
|
|||
CurrentScene?.FixedUpdate(context);
|
||||
|
||||
long delta = deltaStop.ElapsedMilliseconds;
|
||||
Thread.Sleep(Math.Max((int)(Deltatime.FixedUpdateDelta * 1000) - (int)delta, 0));
|
||||
int waitTime = Math.Max((int)(Deltatime.FixedUpdateDelta * 1000) - (int)delta, 0);
|
||||
Thread.Sleep(waitTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue