some refinement and beginning of a table element
This commit is contained in:
@@ -3,32 +3,30 @@ package blocks
|
||||
import (
|
||||
"image/color"
|
||||
|
||||
"git.vezzani.net/ben/games/common/elements/v1"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/mouse"
|
||||
|
||||
"git.vezzani.net/ben/games/common/elements/v1/core"
|
||||
"git.vezzani.net/ben/games/common/geo"
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
"github.com/hajimehoshi/ebiten/v2/vector"
|
||||
)
|
||||
|
||||
func New(ops ...OptFunc) elements.Element {
|
||||
b := Block{}
|
||||
func New(ops ...OptFunc) *Block {
|
||||
b := &Block{}
|
||||
for i := range ops {
|
||||
ops[i](&b)
|
||||
ops[i](b)
|
||||
}
|
||||
return &b
|
||||
return b
|
||||
}
|
||||
|
||||
type Block struct {
|
||||
elements.Core
|
||||
core.Element
|
||||
|
||||
backgroundColor *color.Color
|
||||
mouse.NopHandler
|
||||
width, height int
|
||||
name string
|
||||
width, height int
|
||||
name string
|
||||
}
|
||||
|
||||
func (b *Block) Bounds() elements.Bounds {
|
||||
return elements.Bounds{
|
||||
func (b *Block) Bounds() geo.Bounds {
|
||||
return geo.Bounds{
|
||||
Min: b.Anchor(),
|
||||
Width: b.width,
|
||||
Height: b.height,
|
||||
|
||||
Reference in New Issue
Block a user