29 lines
450 B
Go
29 lines
450 B
Go
package elements
|
|
|
|
import (
|
|
"github.com/hajimehoshi/ebiten/v2"
|
|
)
|
|
|
|
type BlockOption func(*block)
|
|
|
|
func Block(ops ...BlockOption) ElementFunc {
|
|
return func(d Dimensions) Element {
|
|
b := block{}
|
|
for i := range ops {
|
|
ops[i](&b)
|
|
}
|
|
return &b
|
|
}
|
|
}
|
|
|
|
type block struct {
|
|
width float64
|
|
height float64
|
|
xAlign xAlign
|
|
yAlign yAlign
|
|
}
|
|
|
|
func (b block) Draw(image *ebiten.Image, anchorX, anchorY float64) (w, h float64) {
|
|
return b.width, b.height
|
|
}
|