some refinement
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"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/buttons"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/core"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/mouse"
|
||||
"git.vezzani.net/ben/games/common/elements/v1/stacks"
|
||||
"git.vezzani.net/ben/games/common/geo"
|
||||
"git.vezzani.net/ben/games/common/sprites/v1"
|
||||
|
||||
"github.com/hajimehoshi/ebiten/v2"
|
||||
@@ -14,29 +15,30 @@ import (
|
||||
|
||||
var root = stacks.New(
|
||||
stacks.Horizontal(),
|
||||
//stacks.Core(blocks.BackgroundColor(color.White)),
|
||||
stacks.Core(elements.Name("parent")),
|
||||
stacks.Core(elements.Children(
|
||||
stacks.Core(core.Name("parent")),
|
||||
stacks.Core(core.Children(
|
||||
stacks.New(
|
||||
stacks.Core(elements.Name("left")),
|
||||
stacks.Core(elements.Children(
|
||||
buttons.New(
|
||||
buttons.BlockOpt(blocks.Size(100, 100)),
|
||||
buttons.Label("hello"),
|
||||
buttons.BlockOpt(blocks.BackgroundColor(colornames.Green)),
|
||||
buttons.OnClick(func(ms mouse.State) {
|
||||
println("green")
|
||||
}),
|
||||
stacks.Core(
|
||||
core.Name("left"),
|
||||
core.Children(
|
||||
buttons.New(
|
||||
buttons.BlockOpt(blocks.Size(100, 100)),
|
||||
buttons.Label("hello"),
|
||||
buttons.BlockOpt(blocks.BackgroundColor(colornames.Green)),
|
||||
buttons.OnClick(func(ms mouse.State) {
|
||||
println("green")
|
||||
}),
|
||||
),
|
||||
blocks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Yellow),
|
||||
),
|
||||
),
|
||||
blocks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Yellow),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
stacks.New(
|
||||
stacks.Core(elements.Name("right")),
|
||||
stacks.Core(elements.Children(
|
||||
stacks.Core(core.Name("right")),
|
||||
stacks.Core(core.Children(
|
||||
blocks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Blue),
|
||||
@@ -55,7 +57,7 @@ func newEditor() *editor {
|
||||
}
|
||||
|
||||
type editor struct {
|
||||
bounds elements.Bounds
|
||||
bounds geo.Bounds
|
||||
handleMouse func() bool
|
||||
}
|
||||
|
||||
@@ -71,8 +73,8 @@ func (e *editor) Draw(screen *ebiten.Image) {
|
||||
|
||||
func (e *editor) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
|
||||
if e.bounds.Width != outsideWidth || e.bounds.Height != outsideHeight {
|
||||
e.bounds = elements.Bounds{
|
||||
Min: elements.Point{},
|
||||
e.bounds = geo.Bounds{
|
||||
Min: geo.Point{},
|
||||
Width: outsideWidth,
|
||||
Height: outsideHeight,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user