Skip to content

A small Entity Component System (ECS) as a proof of concept.

License

EUPL-1.2, Unknown licenses found

Licenses found

EUPL-1.2
LICENSE
Unknown
COPYING
Notifications You must be signed in to change notification settings

KoneLinx/small_ECS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

small_ECS

A small Entity Component System (ECS) as a proof of concept.

How to use

Store

A store holds entities, components and systems. It will handle all the storage and logic for you.

EntityStore store{};

Components

They can be anything!

Entity

An entity is a collection of components. Just define one as a type and start using it. Use AddEntity to add an entity to the store.

using DenseObject = Entity<std::string, float>;
store.AddEntity(DenseObject{ "Ice" , .956f });
store.AddEntity(DenseObject{ "Wood", .753f });

System

A system is a function that will execute on each matching entity. The parameter list of the system is matched to the entities containing the correct components.

Add a system to the store with AddSystem

store.AddSystem(
  [] (int i, float& f)
  {
    f += 0.123f * i;
  }
)

Execution

By calling CallHandles, all systems will be matched and executed when entities apply to them.

store.CallHandles();

This project is a proof of concept and I hope it helps.

About

A small Entity Component System (ECS) as a proof of concept.

Topics

Resources

License

EUPL-1.2, Unknown licenses found

Licenses found

EUPL-1.2
LICENSE
Unknown
COPYING

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages