yohamta / donburi

Just another ECS library for Go/Ebitengine

Home Page:https://pkg.go.dev/github.com/yohamta/donburi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Consider `system` feature

yohamta opened this issue · comments

The system as a "foreach-system" function feature in Bevy looks interesting.
I am wondering if there's way to achieve the same in donburi using Generics.
This way the user doesn't have to get components directly using query.EachEntity() but it will be suppilied to the system function automatically, which is nice.

One idea:

func collisionSystem(query1, query2 *donburi.Query) {
  // ...
}

world.AddSystem(query1, query2, collisionSystem)

Draw system:

func playerDrawer(screen *ebiten.Image, query *donburi.Query) {
  // ...
}

world.AddDrawerSystem(query, playerDrawer)
world.Draw(screen)

Implemented as ECS package