gg/keep.go
2024-05-28 13:24:12 +05:00

56 lines
1.2 KiB
Go

package gg
/*func (e *engine) Resolve() {
eng := (*Engine)(e)
type resHold struct{
Resolver Resolver
input chan *Context
}
colliders := map[CollisionType] []Collider{}
resolvers := []resHold{}
for _, object := range e.Objects.store {
if object.IsResolvable() {
interests := object.GetCollisionInterest()
for _, interest := range interests {
_, ok := colliders[interest]
if !ok {
colliders[interest] = []Collider{}
}
}
resolvers = append(resolvers, resHold{
object,
object.Input(),
})
}
}
for _, object := range e.Objects.store {
if object.IsCollidable() {
typ := object.CollisionType()
_, ok := colliders[typ]
if !ok {
continue
}
colliders[typ] = append(colliders[typ], object)
}
}
for _, resolver := range resolvers {
interests := resolver.Resolver.GetCollisionInterest()
cols := []Collision{}
for _, interest := range interests {
cols = append(cols, GetCollisions(resolver.Resolver, colliders[interest])...)
}
if len(cols) > 0 {
c := &Context{
typ: resolveContext,
Collisions: cols,
Engine: eng,
}
e.wg.Add(1)
resolver.input <- c
}
}
e.wg.Wait()
}*/