diff options
| author | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-30 14:38:34 +0000 |
|---|---|---|
| committer | James Barnett <noreply@jamesbarnett.xyz> | 2020-12-30 14:38:34 +0000 |
| commit | 83b0b4cb19d7f0137cde962ee81a900baf2bd953 (patch) | |
| tree | 838204167415de676190a1534767497f084e7a7b /src/main/kotlin/Ui.kt | |
| parent | ad192fe7068081ed88f8616581bf450d601e99b1 (diff) | |
| download | kotlin-raycaster-83b0b4cb19d7f0137cde962ee81a900baf2bd953.tar.xz kotlin-raycaster-83b0b4cb19d7f0137cde962ee81a900baf2bd953.zip | |
Add switchable texture sets. Fix minimap
Diffstat (limited to 'src/main/kotlin/Ui.kt')
| -rw-r--r-- | src/main/kotlin/Ui.kt | 23 |
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 |