diff --git a/MonoGame.sln b/MonoGame.sln index 9957322..d6d5a9d 100644 --- a/MonoGame.sln +++ b/MonoGame.sln @@ -29,6 +29,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features", "src\Libs\Featur EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Entities", "src\Libs\Entities\Entities.csproj", "{8232C7AA-E217-465B-95A3-C42D1000FA3B}" EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Systems.Debugging", "src\Libs\Systems.Debugging\Systems.Debugging.csproj", "{7AD01EBF-370B-4F35-9AEC-172A889D643F}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Features.Debugging", "src\Libs\Features.Debugging\Features.Debugging.csproj", "{8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -70,6 +74,14 @@ Global {8232C7AA-E217-465B-95A3-C42D1000FA3B}.Debug|Any CPU.Build.0 = Debug|Any CPU {8232C7AA-E217-465B-95A3-C42D1000FA3B}.Release|Any CPU.ActiveCfg = Release|Any CPU {8232C7AA-E217-465B-95A3-C42D1000FA3B}.Release|Any CPU.Build.0 = Release|Any CPU + {7AD01EBF-370B-4F35-9AEC-172A889D643F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {7AD01EBF-370B-4F35-9AEC-172A889D643F}.Debug|Any CPU.Build.0 = Debug|Any CPU + {7AD01EBF-370B-4F35-9AEC-172A889D643F}.Release|Any CPU.ActiveCfg = Release|Any CPU + {7AD01EBF-370B-4F35-9AEC-172A889D643F}.Release|Any CPU.Build.0 = Release|Any CPU + {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(NestedProjects) = preSolution {5E3B6238-A92E-4703-8527-1C2410D7906A} = {F5258F7E-B0BA-466D-8CF8-4DAB84722BE3} @@ -84,5 +96,7 @@ Global {6EEBFA40-2814-43D0-A9DC-4A98F4837A1B} = {FE9CE932-6F98-4455-A80F-2A0CDB6DB46E} {F4C957C8-3B10-4614-99F4-E2F2398F38ED} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} {8232C7AA-E217-465B-95A3-C42D1000FA3B} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} + {7AD01EBF-370B-4F35-9AEC-172A889D643F} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} + {8E6812DB-F7B8-411D-BD15-4BCFA2BF6C28} = {7AE4DC46-59EB-4F69-9240-C7363F0778AA} EndGlobalSection EndGlobal diff --git a/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs index 159eeeb..4938d82 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Components/ComponentsCompositionRoot.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; using Components; -using Components.World; +using Components.Data; using GameDesktop.Resources.Internal; using LightInject; using Microsoft.Xna.Framework; @@ -10,7 +10,7 @@ namespace GameDesktop.CompositionRoots.Components; -public class ComponentsCompositionRoot : ICompositionRoot +internal class ComponentsCompositionRoot : ICompositionRoot { private static readonly string PlayerSpriteSheetPath = System.IO.Path.Join( Environment.GetEnvironmentVariable(EnvironmentVariable.AppBaseDirectory), @@ -22,6 +22,7 @@ public void Compose(IServiceRegistry serviceRegistry) RegisterMovementAnimationComponent(serviceRegistry); RegisterCameraComponent(serviceRegistry); RegisterTransformComponent(serviceRegistry); + RegisterRectangleCollisionComponent(serviceRegistry); } private static void RegisterSpriteComponent(IServiceRegistry serviceRegistry) @@ -57,4 +58,9 @@ private static void RegisterTransformComponent(IServiceRegistry serviceRegistry) { serviceRegistry.RegisterTransient(); } + + private static void RegisterRectangleCollisionComponent(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterTransient(_ => new RectangleCollisionComponent { Size = new Rectangle(0, 0, 8, 8)}); + } } diff --git a/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs new file mode 100644 index 0000000..a74508c --- /dev/null +++ b/src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs @@ -0,0 +1,36 @@ +using System; +using Entitas; +using Features.Debugging; +using GameDesktop.Resources.Internal; +using LightInject; +using Serilog; +using Systems.Debugging; + +namespace GameDesktop.CompositionRoots.DebugFeatures; + +internal class DebugRootFeatureCompositionRoot : ICompositionRoot +{ + private static readonly IMatcher[] Matchers = { GameMatcher.RectangleCollision, GameMatcher.Transform }; + + public void Compose(IServiceRegistry serviceRegistry) + { + RegisterSystems(serviceRegistry); + RegisterFeature(serviceRegistry); + } + + private static void RegisterSystems(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterSingleton(factory => + { + var getGroup = + factory.GetInstance[], IGroup>>(Matcher.AllOf); + IGroup group = getGroup(Matchers); + + return new DrawRectangleCollisionComponentsSystem(factory.GetInstance(), group, + factory.GetInstance()); + }); + } + + private static void RegisterFeature(IServiceRegistry serviceRegistry) => + serviceRegistry.RegisterSingleton(); +} diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs index 6f37738..75a5fb5 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/PlayerEntityCompositionRoot.cs @@ -3,7 +3,7 @@ namespace GameDesktop.CompositionRoots.Entities; -public class PlayerEntityCompositionRoot : ICompositionRoot +internal class PlayerEntityCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { diff --git a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs index 72d05cd..4770fb1 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Entities/StaticEntityCompositionRoot.cs @@ -3,7 +3,7 @@ namespace GameDesktop.CompositionRoots.Entities; -public class StaticEntityCompositionRoot : ICompositionRoot +internal class StaticEntityCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs index 2482ed4..28c2588 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/CameraFeatureCompositionRoot.cs @@ -1,5 +1,6 @@ using System; using Entitas; +using Entitas.Extended; using Features; using GameDesktop.Resources.Internal; using LightInject; @@ -7,7 +8,7 @@ namespace GameDesktop.CompositionRoots.Features; -public class CameraFeatureCompositionRoot : ICompositionRoot +internal class CameraFeatureCompositionRoot : ICompositionRoot { private static readonly IMatcher[] Matchers = { GameMatcher.Transform, GameMatcher.Drawable }; @@ -19,15 +20,15 @@ public void Compose(IServiceRegistry serviceRegistry) private static void RegisterSystem(IServiceRegistry serviceRegistry) { - serviceRegistry.RegisterFallback((type, s) => true, request => + serviceRegistry.RegisterSingleton(factory => { var getGroup = - request.ServiceFactory.GetInstance[], IGroup>>(Matcher.AllOf); + factory.GetInstance[], IGroup>>(Matcher.AllOf); IGroup group = getGroup(Matchers); - // return new CameraFollowingSystem(request.ServiceFactory.GetInstance(), group); + // return new CameraFollowingSystem(factory.GetInstance(), group); return new DefaultDrawSystem(group); - }, new PerContainerLifetime()); + }); } private static void RegisterFeature(IServiceRegistry serviceRegistry) => diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs index 1306d49..d1e6812 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/InputFeatureCompositionRoot.cs @@ -9,7 +9,7 @@ namespace GameDesktop.CompositionRoots.Features; -public class InputFeatureCompositionRoot : ICompositionRoot +internal class InputFeatureCompositionRoot : ICompositionRoot { private static readonly IMatcher[] Matchers = { diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs index 2e336b9..77cc3f1 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/MovementFeatureCompositionRoot.cs @@ -10,7 +10,7 @@ namespace GameDesktop.CompositionRoots.Features; -public class MovementFeatureCompositionRoot : ICompositionRoot +internal class MovementFeatureCompositionRoot : ICompositionRoot { private static readonly IMatcher[] MovableMatchers = { GameMatcher.Transform, GameMatcher.Movable }; diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs index fabe1b9..b391b2c 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/RootFeatureCompositionRoot.cs @@ -1,11 +1,12 @@ using Features; using GameDesktop.CompositionRoots.Components; +using GameDesktop.CompositionRoots.DebugFeatures; using GameDesktop.CompositionRoots.Entities; using LightInject; namespace GameDesktop.CompositionRoots.Features; -public class RootFeatureCompositionRoot : ICompositionRoot +internal class RootFeatureCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { @@ -23,8 +24,10 @@ public void Compose(IServiceRegistry serviceRegistry) RegisterFeatures(serviceRegistry); - // Main entry point - serviceRegistry.RegisterSingleton(); + // Extra pre-entry point for debugging, might be safely excluded + serviceRegistry.RegisterFrom(); + + RegisterEntryPoint(serviceRegistry); } private static void RegisterFundamental(IServiceRegistry serviceRegistry) @@ -50,4 +53,9 @@ private static void RegisterFeatures(IServiceRegistry serviceRegistry) serviceRegistry.RegisterFrom(); serviceRegistry.RegisterFrom(); } + + private static void RegisterEntryPoint(IServiceRegistry serviceRegistry) + { + serviceRegistry.RegisterSingleton(); + } } diff --git a/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs index 24b07c3..e6c7fd5 100644 --- a/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/Features/WorldInitializeFeatureCompositionRoot.cs @@ -3,7 +3,7 @@ namespace GameDesktop.CompositionRoots.Features; -public class WorldInitializeFeatureCompositionRoot : ICompositionRoot +internal class WorldInitializeFeatureCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { diff --git a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs index 6e58379..f6631a1 100644 --- a/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/FundamentalCompositionRoot.cs @@ -9,7 +9,7 @@ namespace GameDesktop.CompositionRoots; -public class FundamentalCompositionRoot : ICompositionRoot +internal class FundamentalCompositionRoot : ICompositionRoot { public void Compose(IServiceRegistry serviceRegistry) { diff --git a/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs b/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs index 4107273..2d2d1fa 100644 --- a/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs +++ b/src/Apps/GameDesktop/CompositionRoots/GameCompositionRoot.cs @@ -5,7 +5,7 @@ namespace GameDesktop.CompositionRoots; -public class GameCompositionRoot : ICompositionRoot +internal class GameCompositionRoot : ICompositionRoot { private const bool IsMouseVisible = true; diff --git a/src/Libs/Components/CameraComponent.cs b/src/Libs/Components/Data/CameraComponent.cs similarity index 86% rename from src/Libs/Components/CameraComponent.cs rename to src/Libs/Components/Data/CameraComponent.cs index 837a8e0..745245d 100644 --- a/src/Libs/Components/CameraComponent.cs +++ b/src/Libs/Components/Data/CameraComponent.cs @@ -2,7 +2,7 @@ using Entitas.CodeGeneration.Attributes; using Microsoft.Xna.Framework; -namespace Components; +namespace Components.Data; [Unique] public class CameraComponent : IComponent diff --git a/src/Libs/Components/MovementAnimationComponent.cs b/src/Libs/Components/Data/MovementAnimationComponent.cs similarity index 94% rename from src/Libs/Components/MovementAnimationComponent.cs rename to src/Libs/Components/Data/MovementAnimationComponent.cs index 7c4bb40..78e83e5 100644 --- a/src/Libs/Components/MovementAnimationComponent.cs +++ b/src/Libs/Components/Data/MovementAnimationComponent.cs @@ -1,9 +1,9 @@ -using Entitas; +using Components.Tags; using Microsoft.Xna.Framework; using MonoGame.Aseprite.Sprites; using Services.Math; -namespace Components; +namespace Components.Data; public class MovementAnimationComponent : DrawableComponent { diff --git a/src/Libs/Components/World/RectangleCollisionComponent.cs b/src/Libs/Components/Data/RectangleCollisionComponent.cs similarity index 82% rename from src/Libs/Components/World/RectangleCollisionComponent.cs rename to src/Libs/Components/Data/RectangleCollisionComponent.cs index 858b1ba..42c682d 100644 --- a/src/Libs/Components/World/RectangleCollisionComponent.cs +++ b/src/Libs/Components/Data/RectangleCollisionComponent.cs @@ -1,7 +1,7 @@ using Entitas; using Microsoft.Xna.Framework; -namespace Components.World; +namespace Components.Data; public class RectangleCollisionComponent : IComponent { diff --git a/src/Libs/Components/SpriteComponent.cs b/src/Libs/Components/Data/SpriteComponent.cs similarity index 81% rename from src/Libs/Components/SpriteComponent.cs rename to src/Libs/Components/Data/SpriteComponent.cs index 0ddb3c8..370dff6 100644 --- a/src/Libs/Components/SpriteComponent.cs +++ b/src/Libs/Components/Data/SpriteComponent.cs @@ -1,7 +1,7 @@ -using Entitas; +using Components.Tags; using MonoGame.Aseprite.Sprites; -namespace Components; +namespace Components.Data; public class SpriteComponent : DrawableComponent { diff --git a/src/Libs/Components/World/TransformComponent.cs b/src/Libs/Components/Data/TransformComponent.cs similarity index 93% rename from src/Libs/Components/World/TransformComponent.cs rename to src/Libs/Components/Data/TransformComponent.cs index ebb976b..657132c 100644 --- a/src/Libs/Components/World/TransformComponent.cs +++ b/src/Libs/Components/Data/TransformComponent.cs @@ -1,7 +1,7 @@ using Entitas; using Microsoft.Xna.Framework; -namespace Components.World; +namespace Components.Data; public class TransformComponent : IComponent { diff --git a/src/Libs/Components/GeneratedExtended/GameEntity.cs b/src/Libs/Components/GeneratedExtended/GameEntity.cs index 0979085..9cb0416 100644 --- a/src/Libs/Components/GeneratedExtended/GameEntity.cs +++ b/src/Libs/Components/GeneratedExtended/GameEntity.cs @@ -1,5 +1,5 @@ using Components; -using Components.World; +using Components.Data; using Microsoft.Xna.Framework; public partial class GameEntity @@ -25,4 +25,9 @@ public void AddSprite(SpriteComponent component) isDrawable = true; AddSprite(newSprite: component.Sprite); } + + public void AddRectangleCollision(RectangleCollisionComponent component) + { + AddRectangleCollision(newSize: component.Size); + } } diff --git a/src/Libs/Components/DrawableComponent.cs b/src/Libs/Components/Tags/DrawableComponent.cs similarity index 71% rename from src/Libs/Components/DrawableComponent.cs rename to src/Libs/Components/Tags/DrawableComponent.cs index dd8daf9..379ebb4 100644 --- a/src/Libs/Components/DrawableComponent.cs +++ b/src/Libs/Components/Tags/DrawableComponent.cs @@ -1,6 +1,6 @@ using Entitas; -namespace Components; +namespace Components.Tags; public class DrawableComponent : IComponent { diff --git a/src/Libs/Components/World/MovableComponent.cs b/src/Libs/Components/Tags/MovableComponent.cs similarity index 70% rename from src/Libs/Components/World/MovableComponent.cs rename to src/Libs/Components/Tags/MovableComponent.cs index e07dff6..0cbefb9 100644 --- a/src/Libs/Components/World/MovableComponent.cs +++ b/src/Libs/Components/Tags/MovableComponent.cs @@ -1,6 +1,6 @@ using Entitas; -namespace Components.World; +namespace Components.Tags; public class MovableComponent : IComponent { diff --git a/src/Libs/Components/World/PlayerComponent.cs b/src/Libs/Components/Tags/PlayerComponent.cs similarity index 70% rename from src/Libs/Components/World/PlayerComponent.cs rename to src/Libs/Components/Tags/PlayerComponent.cs index d2a7f5e..e1c00af 100644 --- a/src/Libs/Components/World/PlayerComponent.cs +++ b/src/Libs/Components/Tags/PlayerComponent.cs @@ -1,6 +1,6 @@ using Entitas; -namespace Components.World; +namespace Components.Tags; public class PlayerComponent : IComponent { diff --git a/src/Libs/Entities/PlayerEntity.cs b/src/Libs/Entities/PlayerEntity.cs index 73b6902..f42b3d1 100644 --- a/src/Libs/Entities/PlayerEntity.cs +++ b/src/Libs/Entities/PlayerEntity.cs @@ -1,5 +1,5 @@ using Components; -using Components.World; +using Components.Data; namespace Entities; @@ -8,7 +8,8 @@ public class PlayerEntity public PlayerEntity(Contexts contexts, MovementAnimationComponent movementAnimationComponent, TransformComponent transformComponent, - CameraComponent cameraComponent) + CameraComponent cameraComponent, + RectangleCollisionComponent rectangleCollisionComponent) { GameEntity entity = contexts.game.CreateEntity(); @@ -17,6 +18,6 @@ public PlayerEntity(Contexts contexts, entity.AddMovementAnimation(movementAnimationComponent); entity.AddTransform(transformComponent); entity.AddCamera(cameraComponent); - // e.AddRectangleCollision(new Rectangle(0, 0, 16, 16)); + entity.AddRectangleCollision(rectangleCollisionComponent); } } diff --git a/src/Libs/Entities/StaticEntity.cs b/src/Libs/Entities/StaticEntity.cs index 5a2edc7..a3b33e2 100644 --- a/src/Libs/Entities/StaticEntity.cs +++ b/src/Libs/Entities/StaticEntity.cs @@ -1,5 +1,6 @@ using Components; -using Components.World; +using Components.Data; +using Microsoft.Xna.Framework; namespace Entities; @@ -7,11 +8,13 @@ public class StaticEntity { public StaticEntity(Contexts contexts, TransformComponent transformComponent, - SpriteComponent spriteComponent) + SpriteComponent spriteComponent, + RectangleCollisionComponent rectangleCollision) { GameEntity e = contexts.game.CreateEntity(); e.AddTransform(transformComponent); e.AddSprite(spriteComponent); + e.AddRectangleCollision(rectangleCollision); } } diff --git a/src/Libs/Features.Debugging/DebugRootFeature.cs b/src/Libs/Features.Debugging/DebugRootFeature.cs new file mode 100644 index 0000000..23867f6 --- /dev/null +++ b/src/Libs/Features.Debugging/DebugRootFeature.cs @@ -0,0 +1,11 @@ +using Systems.Debugging; + +namespace Features.Debugging; + +public sealed class DebugRootFeature : Entitas.Extended.Feature +{ + public DebugRootFeature(DrawRectangleCollisionComponentsSystem drawRectangleCollisionComponentsSystem) + { + Add(drawRectangleCollisionComponentsSystem); + } +} diff --git a/src/Libs/Features.Debugging/Features.Debugging.csproj b/src/Libs/Features.Debugging/Features.Debugging.csproj new file mode 100644 index 0000000..42d7fb2 --- /dev/null +++ b/src/Libs/Features.Debugging/Features.Debugging.csproj @@ -0,0 +1,14 @@ + + + + net7.0 + enable + enable + + + + + + + + diff --git a/src/Libs/Features/Features.csproj b/src/Libs/Features/Features.csproj index 39bb8f8..742fe1c 100644 --- a/src/Libs/Features/Features.csproj +++ b/src/Libs/Features/Features.csproj @@ -9,6 +9,7 @@ + @@ -16,4 +17,8 @@ + + + + diff --git a/src/Libs/Features/RootFeature.cs b/src/Libs/Features/RootFeature.cs index 6b1fb79..815b056 100644 --- a/src/Libs/Features/RootFeature.cs +++ b/src/Libs/Features/RootFeature.cs @@ -1,4 +1,6 @@ -namespace Features; +using Features.Debugging; + +namespace Features; public sealed class RootFeature : Entitas.Extended.Feature { @@ -12,4 +14,13 @@ public RootFeature(WorldInitializeFeature worldInitializeFeature, Add(movementFeature); Add(cameraFeature); } + + public RootFeature(DebugRootFeature debugRootFeature, + WorldInitializeFeature worldInitializeFeature, + InputFeature inputFeature, + MovementFeature movementFeature, + CameraFeature cameraFeature) : this(worldInitializeFeature, inputFeature, movementFeature, cameraFeature) + { + Add(debugRootFeature); + } } diff --git a/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs b/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs new file mode 100644 index 0000000..c322b10 --- /dev/null +++ b/src/Libs/Systems.Debugging/DrawRectangleCollisionComponentsSystem.cs @@ -0,0 +1,24 @@ +using Entitas; +using Entitas.Extended; +using Microsoft.Xna.Framework; +using Microsoft.Xna.Framework.Graphics; +using Serilog; + +namespace Systems.Debugging; + +public class DrawRectangleCollisionComponentsSystem : IDrawSystem +{ + private readonly Contexts _contexts; + private readonly ILogger _logger; + + public DrawRectangleCollisionComponentsSystem(Contexts contexts, IGroup group, ILogger logger) + { + _contexts = contexts; + _logger = logger; + } + + public void Draw(GameTime gameTime, SpriteBatch spriteBatch) + { + _logger.ForContext().Verbose("Draw"); + } +} diff --git a/src/Libs/Systems.Debugging/Systems.Debugging.csproj b/src/Libs/Systems.Debugging/Systems.Debugging.csproj new file mode 100644 index 0000000..e5ff67c --- /dev/null +++ b/src/Libs/Systems.Debugging/Systems.Debugging.csproj @@ -0,0 +1,17 @@ + + + + net7.0 + enable + enable + + + + + + + + + + + diff --git a/src/Libs/Systems/AnimatedMovementSystem.cs b/src/Libs/Systems/AnimatedMovementSystem.cs index fc19a9d..2133102 100644 --- a/src/Libs/Systems/AnimatedMovementSystem.cs +++ b/src/Libs/Systems/AnimatedMovementSystem.cs @@ -1,4 +1,5 @@ using Components; +using Components.Data; using Entitas; using Entitas.Extended; using Microsoft.Xna.Framework;