diff --git a/src/main/kotlin/codes/som/hibiscus/features/FeaturesRegistry.kt b/src/main/kotlin/codes/som/hibiscus/features/FeaturesRegistry.kt index 8f9e3a5..2aac70c 100644 --- a/src/main/kotlin/codes/som/hibiscus/features/FeaturesRegistry.kt +++ b/src/main/kotlin/codes/som/hibiscus/features/FeaturesRegistry.kt @@ -1,6 +1,6 @@ package codes.som.hibiscus.features class FeaturesRegistry { - private val features = ALL_FEATURES.map { it() } + private val features = ALL_FEATURES.map { it() }.sortedBy { it.name } fun getAllFeatures() = features.asSequence() } diff --git a/src/main/kotlin/codes/som/hibiscus/gui/ImGuiRenderer.kt b/src/main/kotlin/codes/som/hibiscus/gui/ImGuiRenderer.kt index ec01458..507ec74 100644 --- a/src/main/kotlin/codes/som/hibiscus/gui/ImGuiRenderer.kt +++ b/src/main/kotlin/codes/som/hibiscus/gui/ImGuiRenderer.kt @@ -17,9 +17,9 @@ object ImGuiRenderer { with(ImGui.getIO()) { iniFilename = null // We don't want to save .ini file addConfigFlags(ImGuiConfigFlags.NavEnableKeyboard) // Enable Keyboard Controls - addConfigFlags(ImGuiConfigFlags.DockingEnable) // Enable Docking addConfigFlags(ImGuiConfigFlags.ViewportsEnable) // Enable Multi-Viewport / Platform Windows configViewportsNoTaskBarIcon = true + configDockingWithShift = true } applyHibiscusImGuiTheme() diff --git a/src/main/kotlin/codes/som/hibiscus/gui/ModuleControlsUI.kt b/src/main/kotlin/codes/som/hibiscus/gui/ModuleControlsUI.kt index 5ce2513..98ba796 100644 --- a/src/main/kotlin/codes/som/hibiscus/gui/ModuleControlsUI.kt +++ b/src/main/kotlin/codes/som/hibiscus/gui/ModuleControlsUI.kt @@ -5,17 +5,18 @@ import codes.som.hibiscus.api.feature.Feature import codes.som.hibiscus.api.feature.FeatureCategory import imgui.ImGui import imgui.flag.ImGuiCol -import imgui.flag.ImGuiCond.FirstUseEver +import imgui.flag.ImGuiCond.Once import imgui.flag.ImGuiWindowFlags import imgui.flag.ImGuiWindowFlags.AlwaysVerticalScrollbar +import imgui.type.ImBoolean object ModuleControlsUI { - private val moduleValueWindows = mutableMapOf() + private val moduleValueWindows = mutableMapOf() private fun categoryPanel(category: FeatureCategory, initialX: Float, initialY: Float) { - ImGui.setNextWindowPos(initialX, initialY, FirstUseEver) - ImGui.setNextWindowCollapsed(true, FirstUseEver) - ImGui.setNextWindowSize(300f, 0f, FirstUseEver) + ImGui.setNextWindowPos(initialX, initialY, Once) + ImGui.setNextWindowCollapsed(true, Once) + ImGui.setNextWindowSize(300f, 0f, Once) ImGui.begin(category.humanName, AlwaysVerticalScrollbar) @@ -51,15 +52,16 @@ object ModuleControlsUI { ImGui.popStyleColor() if (feature.values.exist()) { - val showValueWindow = moduleValueWindows.getOrPut(feature) { booleanArrayOf(false) } + val showValueWindow = moduleValueWindows.getOrPut(feature) { ImBoolean(false) } ImGui.nextColumn() - if (ImGui.radioButton("##${feature.name} values", showValueWindow[0])) { - showValueWindow[0] = !showValueWindow[0] + if (ImGui.radioButton("##${feature.name} values", showValueWindow.get())) { + showValueWindow.set(!showValueWindow.get()) } + ImGui.nextColumn() - if (showValueWindow[0]) { - if (ImGui.begin("${feature.name}##Feature Controls", ImGuiWindowFlags.NoCollapse)) { + if (showValueWindow.get()) { + if (ImGui.begin("${feature.name}##Feature Controls", showValueWindow, ImGuiWindowFlags.NoCollapse)) { for (value in feature.values) value.drawUIControl() }