-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fb4d396
commit 9281764
Showing
2 changed files
with
44 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package ua.mei.kuwu.client | ||
|
||
import io.wispforest.owo.ui.container.Containers | ||
import io.wispforest.owo.ui.container.FlowLayout | ||
import io.wispforest.owo.ui.core.Sizing | ||
import ua.mei.kowo.ops.button | ||
import ua.mei.kowo.ops.label | ||
import ua.mei.kowo.ops.literal | ||
import ua.mei.kowo.ui.base.BaseKowoScreen | ||
|
||
class ButtonTestScreen : BaseKowoScreen<FlowLayout>() { | ||
override fun createRoot(horizontalSizing: Sizing, verticalSizing: Sizing): FlowLayout { | ||
return Containers.verticalFlow(horizontalSizing, verticalSizing) | ||
} | ||
|
||
override fun build() { | ||
// like rootComponent, but better | ||
root { | ||
// components can be stored in variables... | ||
val exampleLabel = label { | ||
text("Example screen: 0".literal()) | ||
} | ||
|
||
// or directly added to the root | ||
button { | ||
message = "Example button".literal() | ||
|
||
// variables can be stored within components | ||
var value = 0 | ||
onPress { | ||
// components stored in variables can be modified | ||
exampleLabel.text("Example screen: ${++value}".literal()) | ||
} | ||
} | ||
} | ||
} | ||
} |
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