-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: init rect collision feat & sys
- Loading branch information
Showing
30 changed files
with
191 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
src/Apps/GameDesktop/CompositionRoots/DebugFeatures/DebugRootFeatureCompositionRoot.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<GameEntity>[] 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<Func<IMatcher<GameEntity>[], IGroup<GameEntity>>>(Matcher.AllOf); | ||
IGroup<GameEntity> group = getGroup(Matchers); | ||
|
||
return new DrawRectangleCollisionComponentsSystem(factory.GetInstance<Contexts>(), group, | ||
factory.GetInstance<ILogger>()); | ||
}); | ||
} | ||
|
||
private static void RegisterFeature(IServiceRegistry serviceRegistry) => | ||
serviceRegistry.RegisterSingleton<DebugRootFeature>(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
.../Components/MovementAnimationComponent.cs → ...onents/Data/MovementAnimationComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...ents/World/RectangleCollisionComponent.cs → ...nents/Data/RectangleCollisionComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
src/Libs/Components/SpriteComponent.cs → src/Libs/Components/Data/SpriteComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...bs/Components/World/TransformComponent.cs → ...ibs/Components/Data/TransformComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Libs/Components/DrawableComponent.cs → ...Libs/Components/Tags/DrawableComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
using Entitas; | ||
|
||
namespace Components; | ||
namespace Components.Tags; | ||
|
||
public class DrawableComponent : IComponent | ||
{ | ||
|
2 changes: 1 addition & 1 deletion
2
...Libs/Components/World/MovableComponent.cs → src/Libs/Components/Tags/MovableComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/Libs/Components/World/PlayerComponent.cs → src/Libs/Components/Tags/PlayerComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,20 @@ | ||
using Components; | ||
using Components.World; | ||
using Components.Data; | ||
using Microsoft.Xna.Framework; | ||
|
||
namespace Entities; | ||
|
||
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); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
using Systems.Debugging; | ||
|
||
namespace Features.Debugging; | ||
|
||
public sealed class DebugRootFeature : Entitas.Extended.Feature | ||
{ | ||
public DebugRootFeature(DrawRectangleCollisionComponentsSystem drawRectangleCollisionComponentsSystem) | ||
{ | ||
Add(drawRectangleCollisionComponentsSystem); | ||
} | ||
} |
Oops, something went wrong.