https://github.com/lchsk/simple-ecs
A header-only implementation of an entity-component system
https://github.com/lchsk/simple-ecs
c-plus-plus c-plus-plus-11 cpp cpp11 entity-component-system
Last synced: 25 days ago
JSON representation
A header-only implementation of an entity-component system
- Host: GitHub
- URL: https://github.com/lchsk/simple-ecs
- Owner: lchsk
- License: mit
- Created: 2018-10-20T11:28:41.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2019-04-24T23:45:18.000Z (about 7 years ago)
- Last Synced: 2025-02-25T11:48:34.674Z (over 1 year ago)
- Topics: c-plus-plus, c-plus-plus-11, cpp, cpp11, entity-component-system
- Language: C++
- Homepage:
- Size: 13.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# 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
```C++
#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(e, 3, 5);
auto &pos = entity->get();
std::cout << pos->x << std::endl; // prints 3
```
## Building tests
Make sure that you have [CMake](http://www.cmake.org/) 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