Add Run button

This commit is contained in:
Shadowfacts 2019-08-11 23:23:02 -04:00
parent 34dba86788
commit 82bb799c64
Signed by: shadowfacts
GPG Key ID: 94A5AB95422746E5
1 changed files with 10 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import net.shadowfacts.cacao.util.texture.NinePatchTexture
import net.shadowfacts.cacao.view.Label import net.shadowfacts.cacao.view.Label
import net.shadowfacts.cacao.view.NinePatchView import net.shadowfacts.cacao.view.NinePatchView
import net.shadowfacts.cacao.view.View import net.shadowfacts.cacao.view.View
import net.shadowfacts.cacao.view.button.Button
import net.shadowfacts.cacao.viewcontroller.ViewController import net.shadowfacts.cacao.viewcontroller.ViewController
/** /**
@ -22,6 +23,12 @@ class ManagerViewController(val managerBlockEntity: ManagerBlockEntity): ViewCon
val background = panel.addSubview(NinePatchView(NinePatchTexture.PANEL_BG)) val background = panel.addSubview(NinePatchView(NinePatchTexture.PANEL_BG))
val label = panel.addSubview(Label("test label")) val label = panel.addSubview(Label("test label"))
val canvas = panel.addSubview(ProgramCanvasView(managerBlockEntity.program)) val canvas = panel.addSubview(ProgramCanvasView(managerBlockEntity.program))
val runButton = panel.addSubview(Button(Label("Run"))).apply {
zIndex = 10.0
handler = {
managerBlockEntity.program.execute()
}
}
createConstraints { createConstraints {
panel.widthAnchor equalTo (view.widthAnchor - 20) panel.widthAnchor equalTo (view.widthAnchor - 20)
@ -41,6 +48,9 @@ class ManagerViewController(val managerBlockEntity: ManagerBlockEntity): ViewCon
canvas.heightAnchor equalTo (panel.heightAnchor - 8) canvas.heightAnchor equalTo (panel.heightAnchor - 8)
canvas.centerXAnchor equalTo panel.centerXAnchor canvas.centerXAnchor equalTo panel.centerXAnchor
canvas.centerYAnchor equalTo panel.centerYAnchor canvas.centerYAnchor equalTo panel.centerYAnchor
runButton.topAnchor equalTo panel.topAnchor
runButton.rightAnchor equalTo panel.rightAnchor
} }
} }