Entitas
Entitas copied to clipboard
New namespace support
I started working on new approach to namespace support.
My ideas:
- Contexts: You can create namespaces for contexts by just declaring it in the Jenny.properties or the Jenny preferences window
Game, Input, MySharedStuff.Common
This should generate
- CommonAttribute
- CommonComponentsLookup
- CommonContext
- CommonEntity
- CommonMatcher etc.
and all of them are wrapped in MySharedStuff
namespace.
You can still access the contexts like contexts.game
, contexts.mySharedstuffCommon
You can still use the attributes
[MySharedStuff.Common]
public sealed class Position3Int : IComponent
{
public Vector3Int Value;
}
- Components
You can add namespaces to components
namespace Shmup.Core
{
public sealed class Player : IComponent
{
}
}
var e = contexts.game.CreateEntity(); // e is GameEntity
contexts.game.CreateEntity().isPlayer = true;
It's work in progress, I'm currently working on the details and see what works well and what doesn't. I try to keep the api the same, but in some cases it might be necessary to be more explicit to avoid name clashes.
I'll keep you updated and add more examples once it takes shapes more.
Update: I'm making some progress on this while at the same time tackling one of my favourite issue #307
This requires changes to the current code gen which generates partial classes for entities etc. This will be replaced with C# extension methods. More infos coming soon
Will close in favour of #1005 You can follow the progress there