From f86944ee9a63d7a8f60debf63f37f3ad03c83cbf Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Thu, 5 Dec 2019 17:35:24 +0100 Subject: [PATCH] added DoUpdate to MlemGame --- Demos/GameImpl.cs | 4 ++-- MLEM.Startup/MlemGame.cs | 10 ++++++---- Sandbox/GameImpl.cs | 4 ++-- 3 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Demos/GameImpl.cs b/Demos/GameImpl.cs index a54cacd..197acdc 100644 --- a/Demos/GameImpl.cs +++ b/Demos/GameImpl.cs @@ -79,8 +79,8 @@ namespace Demos { base.DoDraw(gameTime); } - protected override void Update(GameTime gameTime) { - base.Update(gameTime); + protected override void DoUpdate(GameTime gameTime) { + base.DoUpdate(gameTime); if (this.activeDemo != null) this.activeDemo.Update(gameTime); } diff --git a/MLEM.Startup/MlemGame.cs b/MLEM.Startup/MlemGame.cs index edfecf3..4e75435 100644 --- a/MLEM.Startup/MlemGame.cs +++ b/MLEM.Startup/MlemGame.cs @@ -40,12 +40,10 @@ namespace MLEM.Startup { this.OnLoadContent?.Invoke(this); } - protected override void Update(GameTime gameTime) { - base.Update(gameTime); - + protected sealed override void Update(GameTime gameTime) { this.InputHandler.Update(); + this.DoUpdate(gameTime); this.UiSystem.Update(gameTime); - this.OnUpdate?.Invoke(this, gameTime); CoroutineHandler.Tick(gameTime.GetElapsedSeconds()); CoroutineHandler.RaiseEvent(CoroutineEvents.Update); @@ -63,6 +61,10 @@ namespace MLEM.Startup { base.Draw(gameTime); } + protected virtual void DoUpdate(GameTime gameTime) { + base.Update(gameTime); + } + public static T LoadContent(string name) { return instance.Content.Load(name); } diff --git a/Sandbox/GameImpl.cs b/Sandbox/GameImpl.cs index fb38414..e9dee12 100644 --- a/Sandbox/GameImpl.cs +++ b/Sandbox/GameImpl.cs @@ -59,8 +59,8 @@ namespace Sandbox { this.UiSystem.Add("Panel", panel);*/ } - protected override void Update(GameTime gameTime) { - base.Update(gameTime); + protected override void DoUpdate(GameTime gameTime) { + base.DoUpdate(gameTime); if (this.InputHandler.IsKeyPressed(Keys.F11)) this.GraphicsDeviceManager.SetFullscreen(!this.GraphicsDeviceManager.IsFullScreen);