Skip to content

Application lifeTime and main loop. #284

@Shadowblitz16

Description

@Shadowblitz16

We need something to handle the lifetime of the ecs app and the ability to extend it.

Something like this for an api would be nice...

var runner = new Runner();
runner.Add(new DefaultPlugin())
runner.Run();

[Query]
private static void DefaultPlugin(in ICommandBuffer buffer)
{
     buffer.Add(new PrintSystem());

      var world = buffer.CreateWorld();
      var entity = world.CreateEntity(new Message("hi"))
      // Do something with entity?
}

[Query][All<Message>]
private static void PrintSystem(ref Message message)
{
    Console.WriteLine(message.Text);
}

I would even say rename QueryAttribute to SystemAttribute and have a PluginAttribute.

var runner = new Runner();
runner.Add(new DefaultPlugin())
runner.Run();

[Plugin]
private static void DefaultPlugin(in ICommandBuffer buffer)
{
     buffer.Add(new PrintSystem());

      var world = buffer.CreateWorld();
      var entity = world.CreateEntity(new Message("hi"))
      // Do something with entity?
}

[System][All<Message>]
private static void PrintSystem(ref Message message)
{
    Console.WriteLine(message.Text);
}

There does need to be a way to post a quit message to the Runner though.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions