Disable docking since there's a weird bug where windows get locked up

main
Charlotte Som 2022-02-03 22:41:39 +00:00
parent 5e1cb85754
commit 7d939c6fe9
3 changed files with 14 additions and 12 deletions

View File

@ -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()
}

View File

@ -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()

View File

@ -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<Feature, BooleanArray>()
private val moduleValueWindows = mutableMapOf<Feature, ImBoolean>()
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()
}