diff --git a/src/Apps/GameDesktop/Game.cs b/src/Apps/GameDesktop/Game.cs index 09ce3ad..45428a7 100644 --- a/src/Apps/GameDesktop/Game.cs +++ b/src/Apps/GameDesktop/Game.cs @@ -11,6 +11,7 @@ using Microsoft.Xna.Framework.Graphics; using Scellecs.Morpeh; using Serilog; +using Systems.Debugging; namespace GameDesktop; @@ -22,6 +23,8 @@ public class Game : Microsoft.Xna.Framework.Game private ImGuiRenderer _guiRenderer; private SpriteBatch _spriteBatch; + private SystemsGroup _debugSystemsGroup; + // TODO: Frames updating // https://gafferongames.com/post/fix_your_timestep/ @@ -45,6 +48,9 @@ protected override void Initialize() _container.RegisterSingleton(_ => new SpriteBatch(GraphicsDevice)); _spriteBatch = _container.GetInstance(); + _guiRenderer = new(this); + _guiRenderer.RebuildFontAtlas(); + _logger.ForContext().Verbose("SpriteBatch initialized"); base.Initialize(); @@ -68,6 +74,11 @@ protected override void LoadContent() var dummy = _container.GetInstance(); dummy.Create(@in: world); +#if DEBUG + _debugSystemsGroup = world.CreateSystemsGroup(); + _debugSystemsGroup.AddSystem(new EntitiesList(world)); +#endif + _logger.ForContext().Verbose("LoadContent(): end"); } @@ -108,6 +119,7 @@ private void LateUpdate(GameTime gameTime) protected override void Draw(GameTime gameTime) { + float deltaTime = (float)gameTime.ElapsedGameTime.TotalSeconds; GraphicsDevice.Clear(Color.CornflowerBlue); base.Draw(gameTime); @@ -115,7 +127,7 @@ protected override void Draw(GameTime gameTime) #if DEBUG _guiRenderer.BeginLayout(gameTime); - ImGui.Text("Hi!"); + _debugSystemsGroup.Update(deltaTime); _guiRenderer.EndLayout(); #endif diff --git a/src/Libs/Systems.Debugging/EntitiesList.cs b/src/Libs/Systems.Debugging/EntitiesList.cs index 41575bc..831f847 100644 --- a/src/Libs/Systems.Debugging/EntitiesList.cs +++ b/src/Libs/Systems.Debugging/EntitiesList.cs @@ -23,6 +23,7 @@ public void OnUpdate(float deltaTime) foreach (Entity e in filter) { + ImGui.Text(e.ToString()); } }