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

Add ComponentType.Get(World, *donburi.Entry) Method

yohamta opened this issue · comments

Add Generics method and eliminate the need for making tons of helper functions like this. Also, it will be Type-safe!

func GetVelocity(entry *donburi.Entry) *VelocityData {
  return donburi.Get[VelocityData](entry, Velocity)
}
  • Add (c *ComponentType[T]) ComponentType.Get(World, *donburi.Entry) *T
  • Add (c *ComponentType[T]) ComponentType.Set(World, *donburi.Entry, *T)
  • Add (c *ComponentType[T]) ComponentType.SetValue(World, *donburi.Entry, T)
  • Update README.md

Done in v1.3.0