cleaning up the component system just a bit more...
This commit is contained in:
@@ -14,12 +14,12 @@ import (
|
||||
|
||||
var root = stacks.New(
|
||||
stacks.Horizontal(),
|
||||
//stacks.BlockOpt(blocks.BackgroundColor(color.White)),
|
||||
//stacks.BlockOpt(blocks.Name("parent")),
|
||||
stacks.Children(
|
||||
//stacks.Core(blocks.BackgroundColor(color.White)),
|
||||
stacks.Core(elements.Name("parent")),
|
||||
stacks.Core(elements.Children(
|
||||
stacks.New(
|
||||
//stacks.BlockOpt(blocks.Name("left")),
|
||||
stacks.Children(
|
||||
stacks.Core(elements.Name("left")),
|
||||
stacks.Core(elements.Children(
|
||||
buttons.New(
|
||||
buttons.BlockOpt(blocks.Size(100, 100)),
|
||||
buttons.Label("hello"),
|
||||
@@ -32,11 +32,11 @@ var root = stacks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Yellow),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
stacks.New(
|
||||
//stacks.BlockOpt(blocks.Name("right")),
|
||||
stacks.Children(
|
||||
stacks.Core(elements.Name("right")),
|
||||
stacks.Core(elements.Children(
|
||||
blocks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Blue),
|
||||
@@ -45,9 +45,9 @@ var root = stacks.New(
|
||||
blocks.Size(100, 100),
|
||||
blocks.BackgroundColor(colornames.Red),
|
||||
),
|
||||
),
|
||||
)),
|
||||
),
|
||||
),
|
||||
)),
|
||||
)
|
||||
|
||||
func newEditor() *editor {
|
||||
@@ -55,7 +55,6 @@ func newEditor() *editor {
|
||||
}
|
||||
|
||||
type editor struct {
|
||||
root elements.Element
|
||||
bounds elements.Bounds
|
||||
handleMouse func() bool
|
||||
}
|
||||
@@ -67,7 +66,7 @@ func (e *editor) Update() error {
|
||||
}
|
||||
|
||||
func (e *editor) Draw(screen *ebiten.Image) {
|
||||
e.root.Draw(screen)
|
||||
root.Draw(screen)
|
||||
}
|
||||
|
||||
func (e *editor) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHeight int) {
|
||||
@@ -77,8 +76,7 @@ func (e *editor) Layout(outsideWidth, outsideHeight int) (screenWidth, screenHei
|
||||
Width: outsideWidth,
|
||||
Height: outsideHeight,
|
||||
}
|
||||
e.root = root()
|
||||
e.handleMouse = mouse.Handler(e.root)
|
||||
e.handleMouse = mouse.Handler(root)
|
||||
}
|
||||
|
||||
return outsideWidth, outsideHeight
|
||||
|
||||
Reference in New Issue
Block a user