Adding native libui ui
This commit is contained in:
4 files changed
+99
-21
No files matched your search
+2
-1
@@ -1,5 +1,6 @@
|
||||
import com.ionspin.kotlin.crypto.sample.Sample
|
||||
|
||||
fun main() {
|
||||
fun main() : Unit {
|
||||
Sample.runSample()
|
||||
ui()
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
import com.ionspin.kotlin.crypto.hash.Hash
|
||||
import com.ionspin.kotlin.crypto.util.encodeToUByteArray
|
||||
import com.ionspin.kotlin.crypto.util.toHexString
|
||||
import libui.ktx.TextArea
|
||||
import libui.ktx.appWindow
|
||||
import libui.ktx.button
|
||||
import libui.ktx.textarea
|
||||
import libui.ktx.vbox
|
||||
|
||||
fun ui() = appWindow(
|
||||
title = "Hello",
|
||||
width = 320,
|
||||
height = 240
|
||||
) {
|
||||
val hash = Hash.sha512("123".encodeToUByteArray())
|
||||
val text = "Hash (SHA512) of 123: ${hash.toHexString()}"
|
||||
vbox {
|
||||
lateinit var scroll: TextArea
|
||||
|
||||
button("Test") {
|
||||
action {
|
||||
scroll.append(text.trimMargin())
|
||||
}
|
||||
}
|
||||
scroll = textarea {
|
||||
readonly = true
|
||||
stretchy = true
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user