29 lines
456 B
Go
29 lines
456 B
Go
package blocks
|
|
|
|
import (
|
|
"git.vezzani.net/ben/games/common/elements/v1"
|
|
"git.vezzani.net/ben/games/common/elements/v1/base"
|
|
)
|
|
|
|
type OptFunc func(*Block)
|
|
|
|
func Core(f base.OptFunc) OptFunc {
|
|
return func(b *Block) {
|
|
f(&b.Element)
|
|
}
|
|
}
|
|
|
|
func (b Builder) Size(w, h int) Builder {
|
|
return func() elements.Element {
|
|
bl := b().(*Block)
|
|
bl.width, bl.height = w, h
|
|
return bl
|
|
}
|
|
}
|
|
|
|
func Name(n string) OptFunc {
|
|
return func(b *Block) {
|
|
b.name = n
|
|
}
|
|
}
|