Files
games/common/elements/v1/blocks/options.go
2025-09-06 09:32:53 -04:00

36 lines
504 B
Go

package blocks
import (
"image/color"
"git.vezzani.net/ben/games/common/elements/v1/core"
)
type OptFunc func(*Block)
func Core(fs ...core.OptFunc) OptFunc {
return func(b *Block) {
for _, f := range fs {
f(&b.Element)
}
}
}
func Size(w, h int) OptFunc {
return func(b *Block) {
b.width, b.height = w, h
}
}
func BackgroundColor(c color.Color) OptFunc {
return func(b *Block) {
b.backgroundColor = &c
}
}
func Name(n string) OptFunc {
return func(b *Block) {
b.name = n
}
}