using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Syntriax.Engine.Core; namespace Syntriax.Engine.Integration.MonoGame; 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(IUniverse? universe = null) { Preserver.Preserve(); Graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; IsMouseVisible = true; Universe = universe ?? new Universe(); Universe.InstantiateUniverseObject().SetUniverseObject("Window Container") .BehaviourController.AddBehaviour(this); } protected override void Initialize() { Universe.Initialize(); base.Initialize(); } protected override void Update(GameTime gameTime) { Universe.Update(gameTime.ToEngineTime()); base.Update(gameTime); } protected override void Draw(GameTime gameTime) { GraphicsDevice.Clear(((ColorRGBA)BackgroundColor).ToColor()); Universe.Draw(); base.Draw(gameTime); } }