blob: e477becd0c319050bb5981054537f94cc7c3c878 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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
}
}
|