Created
November 9, 2021 12:56
-
-
Save rudyryk/7d5e3cfa37b1bb24b2529cb3e4865817 to your computer and use it in GitHub Desktop.
SpheroidScript interactive example with button and label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"client": [ | |
"./InteractiveClient.spheroid" | |
], | |
"version": "1.0.0" | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var counter = 0 | |
var counterText = null | |
fun main() { | |
println("Hello from InteractiveClient") | |
MainMenu { | |
Container(top = 60dp, right = 20dp, bottom=60dp, left = 20dp) { | |
Vertical(spacing = 0, left = 0, right = 0, verticalAlign = "center") { | |
Container( | |
backgroundColor = Color(rgba = 0x00000033), | |
height = 50dp | |
) { | |
counterText = Text( | |
text = "---", | |
textColor = Color(rgba = 0xffffffaa), | |
left = 20dp, | |
verticalAlign = "center" | |
) | |
} | |
Container( | |
backgroundColor = Color(rgb = 0x0000aa), | |
height = 50dp | |
) { | |
Text( | |
text = "Button", | |
textColor = Color(rgba = 0xffffffaa), | |
left = 20dp, | |
verticalAlign = "center" | |
) | |
}.onClick { doClick() } | |
} | |
} | |
} | |
} | |
fun doClick() { | |
counter = counter + 1 | |
println("Clicked: ${counter}") | |
counterText.text = "${counter}" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment