You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
35 lines
1.1 KiB
35 lines
1.1 KiB
using System.Linq; |
|
using gaemstone.ECS; |
|
|
|
namespace gaemstone; |
|
|
|
public class Universe : World |
|
{ |
|
public ModuleManager Modules { get; } |
|
|
|
public Universe(params string[] args) |
|
: base(args) |
|
{ |
|
Modules = new(this); |
|
|
|
// Bootstrap some stuff, so we can register flecs properly. |
|
New("/gaemstone/Doc/DisplayType") |
|
.Add(LookupByPathOrThrow("/flecs/core/Exclusive")) |
|
.Build().CreateLookup<Doc.DisplayType>(); |
|
New("/gaemstone/Doc/Relation").Build().CreateLookup<Doc.Relation>(); |
|
LookupByPathOrThrow("/flecs/core/Module" ).CreateLookup<Flecs.Core.Module>(); |
|
LookupByPathOrThrow("/flecs/core/Component").CreateLookup<Flecs.Core.Component>(); |
|
LookupByPathOrThrow("/flecs/core/Tag" ).CreateLookup<Flecs.Core.Tag>(); |
|
|
|
// Register built-in (static) modules, which |
|
// are defined in the "gaemstone.Flecs" namespace. |
|
Modules.RegisterAll(GetType().Assembly.GetTypes() |
|
.Where(t => t.IsAbstract && t.IsSealed)); |
|
|
|
Modules.Register<Doc>(); |
|
|
|
// Create "Game" entity to store global state. |
|
New("/Game").Symbol("Game").Build() |
|
.CreateLookup<Game>().Add<Game>(); |
|
} |
|
}
|
|
|