some refinement

This commit is contained in:
2025-09-05 22:18:36 -04:00
parent 4e6d720a91
commit 8e7db331a7
16 changed files with 371 additions and 119 deletions

View File

@@ -1,12 +1,16 @@
package stacks
import "git.vezzani.net/ben/games/common/elements/v1"
import (
"git.vezzani.net/ben/games/common/elements/v1/core"
)
type OptFunc func(*Stack)
func Core(f elements.OptFunc) OptFunc {
func Core(fs ...core.OptFunc) OptFunc {
return func(s *Stack) {
f(&s.Core)
for _, f := range fs {
f(&s.Element)
}
}
}

View File

@@ -1,13 +1,13 @@
package stacks
import (
"git.vezzani.net/ben/games/common/elements/v1"
"git.vezzani.net/ben/games/common/elements/v1/core"
"git.vezzani.net/ben/games/common/elements/v1/mouse"
"github.com/hajimehoshi/ebiten/v2"
)
func New(ops ...OptFunc) elements.Element {
func New(ops ...OptFunc) *Stack {
s := Stack{}
for op := range ops {
ops[op](&s)
@@ -29,7 +29,7 @@ func New(ops ...OptFunc) elements.Element {
}
type Stack struct {
elements.Core
core.Element
mouse.NopHandler
horizontal bool
}