Skip to content
A header-only implementation of an entity-component system
C++ CMake
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
include
tests
.clang-format
CHANGELOG
CMakeLists.txt
LICENSE
README.md

README.md

simple-ecs

A simple header-only implementation of entity-component system

Installation

Just add include/simple_ecs.hpp to your source code.

It's a part of SFML gamedev libraries: https://github.com/lchsk/knight-libs

Example

#include "simple_ecs.hpp"

struct Position {
  int x;
  int y;

  Position(int x, int y) : x(x), y(y) {}
};

ecs::System system;

auto entity = system.create();

system.add<Position>(e, 3, 5);

auto &pos = entity->get<Position>();

std::cout << pos->x << std::endl; // prints 3

Building tests

Make sure that you have CMake and a C++ compiler installed.

You also need pkg-config and googletest.

Then open a terminal, go to the source directory and type the following commands:

$ mkdir build
$ cd build
$ cmake ..
$ make

Running tests

$ ctest

License

MIT

You can’t perform that action at this time.