The Entity Component System of Brenta Engine. The ECS is a design pattern that allows you to structure your code in a way that is more modular and scalable.
You can read the official online documentation here.
Entities are objects in the game, It's just an ID:
entity entity = world::new_entity();
Components are pieces of data that are attached to an entity:
struct physics_component : component {
float mass;
float density;
glm::vec3 velocity;
glm::vec3 acceleration;
physics_component() {}
};
// Somehwere
world::add_component<physics_component>(entity, physics_component);
Systems are functions that operate on entities with specific components. They
are called at each game tick by the world
:
struct fps_system : system<none> {
void run(std::vector<entity_t> _) const override {
text::render_text("FPS: " + std::to_string(time::get_fps()), 25.0f, 25.0f,
0.35f, glm::vec3(1.0f, 0.9f, 0.0f));
}
};
// Somewhere
REGISTER_SYSTEMS(fps_system);
Resources are like global data, accessible by any system:
struct my_resource : resource {
int my_data;
bool is_ok;
my_resource() {}
}
The library uses the engine's testing framework valFuzz. To run tests, follow the guide in tests/README.md.
The library is licensed under MIT license.