From c7f63dc63870015ce136100289f1ace246870c90 Mon Sep 17 00:00:00 2001 From: Syntriax Date: Wed, 4 Jun 2025 20:13:01 +0300 Subject: [PATCH] refactor: rewritten MonoGameWindow to take in a universe as a constructor parameter --- .../MonoGameWindow.cs | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Engine.Integration/Engine.Integration.MonoGame/MonoGameWindow.cs b/Engine.Integration/Engine.Integration.MonoGame/MonoGameWindow.cs index 77715d1..62e9ae5 100644 --- a/Engine.Integration/Engine.Integration.MonoGame/MonoGameWindow.cs +++ b/Engine.Integration/Engine.Integration.MonoGame/MonoGameWindow.cs @@ -5,38 +5,31 @@ using Syntriax.Engine.Core; namespace Syntriax.Engine.Integration.MonoGame; -public abstract class MonoGameWindow : Game +public class MonoGameWindow : Game { public GraphicsDeviceManager Graphics { get; protected set; } = null!; public IUniverse Universe { get; protected set; } = null!; public ColorRGB BackgroundColor { get; set; } = new ColorRGB(35, 20, 35); - public MonoGameWindow() + public MonoGameWindow(IUniverse? universe = null) { Preserver.Preserve(); Graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; - Universe = new Universe(); + Universe = universe ?? new Universe(); + + Universe.InstantiateUniverseObject().SetUniverseObject("Window Container") + .BehaviourController.AddBehaviour(this); } - protected abstract void PopulateUniverse(IUniverse universe); protected override void Initialize() { Universe.Initialize(); - Universe.InstantiateUniverseObject().SetUniverseObject("Window Container") - .BehaviourController.AddBehaviour(this); - - PopulateUniverse(Universe); base.Initialize(); } - protected override void LoadContent() - { - // TODO: use this.Content to load your game content here - } - protected override void Update(GameTime gameTime) { Universe.Update(gameTime.ToEngineTime());