Skip to content

Instantly share code, notes, and snippets.

@AlexeyDsov
Last active September 19, 2022 09:48
Show Gist options
  • Save AlexeyDsov/78e2f499d96700f163bf87915cfa2b54 to your computer and use it in GitHub Desktop.
Save AlexeyDsov/78e2f499d96700f163bf87915cfa2b54 to your computer and use it in GitHub Desktop.
Panic illustration at "github.com/yohamta/donburi"
package main
import "github.com/yohamta/donburi"
type MyData1 struct {
}
type MyData2 struct {
}
var (
My1 = donburi.NewComponentType[MyData1]()
My2 = donburi.NewComponentType[MyData1]()
)
func main() {
world := donburi.NewWorld()
entity := world.Create(My1)
entry := world.Entry(entity)
_ = donburi.Get[MyData1](entry, My1)
donburi.Add[MyData2](entry, My2, &MyData2{})
entity = world.Create(My1)
entry = world.Entry(entity)
donburi.Add[MyData2](entry, My2, &MyData2{})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment