Skip to content

iliser/ECS

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ECS

A simple ECS base implementation

Usage:

//define component type
DataComponent(Velocity,glm::vec3);
DataComponent(Position,glm::vec3);

//create state
ComponentsState gs;

//create entity
Entity e = gs.createEntity(Position,Velocity);

//set component data
e[Position].data = glm::vec3{12,3,0};
e[Velocity].data = glm::vec3{-1,2,0};


//Define system
void MoveSystem(ComponentsState & gs)
{
    for(auto &[k,v]:gs[Velocity])
    {
        auto & p = gs[Position][k];
        p.data += v.data;
    }
}

//call system
MoveSystem(gs);

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages