Skip to content

ademirtug/ecs_s

Repository files navigation

ecs_s

Sparse set based ECS implementation.

Requirements

Installation

  • ecs_s is a header only library.
#include "ecs_s.hpp"

Basic Usage

#include "ecs_s.hpp"

using namespace ecs_s;

struct model{
  void draw();
};

class renderer_system : public sub_system<std::chrono::nanoseconds> {
public:
    renderer_system(){}
    void renderer_system::process(ecs_s::registry& world, std::chrono::nanoseconds interval) {
      world.view<std::shared_ptr<model>>([&](ecs_s::entity e, std::shared_ptr<model>& m) {
          m->draw();
      });

};

int main()
{
  renderer_system renderer;
  registry world;
  entity earth = world.new_entity();

  std::shared_ptr<model> world_plate_a = std::make_shared<model>();
  world.add_component(earth, world_plate_a);
  renderer.process(world, std::chrono::nanoseconds(100));
}

About

Sparse set based ECS implementation.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages