some refinement
This commit is contained in:
@@ -3,7 +3,6 @@ package buttons
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"git.vezzani.net/ben/games/common/elements/v1"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/blocks"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/mouse"
|
||||
"git.vezzani.net/ben/games/common/ux/v1"
|
||||
@@ -13,7 +12,7 @@ import (
|
||||
"golang.org/x/image/font"
|
||||
)
|
||||
|
||||
func New(ops ...OptFunc) elements.Element {
|
||||
func New(ops ...OptFunc) *Button {
|
||||
b := Button{
|
||||
Block: blocks.Block{},
|
||||
font: ux.FontFace,
|
||||
|
||||
@@ -3,16 +3,18 @@ package buttons
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"git.vezzani.net/ben/games/common/elements/v1"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/blocks"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/core"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/mouse"
|
||||
)
|
||||
|
||||
type OptFunc func(button *Button)
|
||||
|
||||
func Core(f elements.OptFunc) OptFunc {
|
||||
func Core(fs ...core.OptFunc) OptFunc {
|
||||
return func(b *Button) {
|
||||
f(&b.Core)
|
||||
for _, f := range fs {
|
||||
f(&b.Element)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user