okay new ux idea
This commit is contained in:
@@ -10,24 +10,24 @@ import (
|
||||
)
|
||||
import "git.vezzani.net/ben/games/common/ux/v1"
|
||||
|
||||
type XAlign int
|
||||
type YAlign int
|
||||
type xAlign int
|
||||
type yAlign int
|
||||
|
||||
const (
|
||||
AlignCente XAlign = iota
|
||||
AlignCente xAlign = iota
|
||||
AlignLeft
|
||||
AlignRight
|
||||
)
|
||||
|
||||
const (
|
||||
AlignCenter YAlign = iota
|
||||
AlignCenter yAlign = iota
|
||||
AlignTop
|
||||
AlignBottom
|
||||
)
|
||||
|
||||
type Button struct {
|
||||
mouseHandler
|
||||
Block
|
||||
block
|
||||
Label string
|
||||
OnClick func() error
|
||||
OnRightClick func() error
|
||||
@@ -44,17 +44,17 @@ func (b *Button) HandleClick(_ MouseState) error {
|
||||
}
|
||||
|
||||
func (b *Button) getFont() font.Face {
|
||||
if b.Block.Style.Font == nil {
|
||||
if b.block.block.Font == nil {
|
||||
return ux.FontFace
|
||||
}
|
||||
|
||||
return *b.Block.Style.Font
|
||||
return *b.block.block.Font
|
||||
}
|
||||
|
||||
func (b *Button) backgroundColor() color.Color {
|
||||
var c *color.Color
|
||||
if b.Block.Style.BackgroundColor != nil {
|
||||
c = b.Block.Style.BackgroundColor
|
||||
if b.block.block.BackgroundColor != nil {
|
||||
c = b.block.block.BackgroundColor
|
||||
} else {
|
||||
c = &ux.BackgroundColor
|
||||
}
|
||||
@@ -67,8 +67,6 @@ func (b *Button) backgroundColor() color.Color {
|
||||
}
|
||||
|
||||
func (b *Button) Draw(ctx context.Context, image *ebiten.Image) error {
|
||||
xz, yz := GetZero(ctx)
|
||||
w, h := b.size(ctx)
|
||||
|
||||
vector.StrokeRect(image, xz, yz, w, h, 1, b.backgroundColor(), true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user