refactor: rewritten MonoGameWindow to take in a universe as a constructor parameter
This commit is contained in:
parent
beecefec1c
commit
c7f63dc638
@ -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<MonoGameWindowContainer>(this);
|
||||
}
|
||||
|
||||
protected abstract void PopulateUniverse(IUniverse universe);
|
||||
protected override void Initialize()
|
||||
{
|
||||
Universe.Initialize();
|
||||
Universe.InstantiateUniverseObject().SetUniverseObject("Window Container")
|
||||
.BehaviourController.AddBehaviour<MonoGameWindowContainer>(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());
|
||||
|
Loading…
x
Reference in New Issue
Block a user