21 lines
408 B
Go
21 lines
408 B
Go
package blas
|
|
|
|
import (
|
|
"fmt"
|
|
|
|
"dynatron.me/x/blasphem/pkg/blas/core"
|
|
"dynatron.me/x/blasphem/pkg/components"
|
|
)
|
|
|
|
type Setup func(core.Core) (components.Component, error)
|
|
|
|
var Registry = make(map[components.ComponentKey]Setup)
|
|
|
|
func Register(key components.ComponentKey, c Setup) {
|
|
_, already := Registry[key]
|
|
if already {
|
|
panic(fmt.Sprintf("component %s already exists", key))
|
|
}
|
|
|
|
Registry[key] = c
|
|
}
|