aboutsummaryrefslogtreecommitdiff
path: root/src/main/kotlin/Ui.kt
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/kotlin/Ui.kt')
-rw-r--r--src/main/kotlin/Ui.kt23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/main/kotlin/Ui.kt b/src/main/kotlin/Ui.kt
new file mode 100644
index 0000000..e477bec
--- /dev/null
+++ b/src/main/kotlin/Ui.kt
@@ -0,0 +1,23 @@
+import kotlinx.browser.document
+import org.w3c.dom.HTMLSelectElement
+
+class Ui(private val textureManager: TextureManager, private val afterChange: () -> Unit) {
+ private val textureSelect: HTMLSelectElement
+ init {
+ textureSelect = registerTextureSetHandler()
+ }
+
+ private fun registerTextureSetHandler(): HTMLSelectElement {
+ val select = document.getElementById("texture-set") as HTMLSelectElement
+ select.onchange = {
+ textureManager.loadTextures(select.value)
+ afterChange()
+ }
+
+ return select
+ }
+
+ fun getSelectedTextureSet(): String {
+ return textureSelect.value
+ }
+} \ No newline at end of file