Skip to content

Commit 30a594f

Browse files
Feature: Module Hiding (#303)
1 parent 81fd2b8 commit 30a594f

3 files changed

Lines changed: 6 additions & 7 deletions

File tree

src/main/kotlin/com/lambda/gui/MenuBar.kt

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import com.lambda.imgui.ImGui
3939
import com.lambda.imgui.ImGui.closeCurrentPopup
4040
import com.lambda.imgui.flag.ImGuiCol
4141
import com.lambda.imgui.flag.ImGuiStyleVar
42+
import com.lambda.imgui.type.ImBoolean
4243
import com.lambda.imgui.flag.ImGuiWindowFlags
4344
import com.lambda.interaction.BaritoneHandler
4445
import com.lambda.module.ModuleRegistry
@@ -264,22 +265,19 @@ object MenuBar {
264265
private fun ImGuiBuilder.buildModulesMenu() {
265266
menu("Module Tag") {
266267
ModuleTag.defaults.forEach { tag ->
267-
menuItem(tag.name, selected = ModuleTag.isTagShown(tag)) {
268+
checkbox(tag.name, ImBoolean(ModuleTag.isTagShown(tag))) {
268269
ModuleTag.toggleTag(tag)
269270
}
270271
}
271272
}
272273
separator()
273-
// By Tag → quick enable/disable per module
274+
// By Tag → toggle whether each module is shown in the ClickGui layout
274275
ModuleTag.defaults.forEach { tag ->
275276
menu(tag.name) {
276277
ModuleRegistry.modules
277278
.filter { it.tag == tag }
278279
.forEach { module ->
279-
menuItem(module.name, selected = module.isEnabled) {
280-
module.toggle()
281-
}
282-
// Optionally, offer a "Settings..." item to focus this module’s details UI.
280+
checkbox(module.name, module.showInClickGui::value)
283281
}
284282
}
285283
}

src/main/kotlin/com/lambda/gui/components/ClickGuiLayout.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ object ClickGuiLayout : Loadable, Config(
344344
}
345345

346346
ModuleRegistry.modules
347-
.filter { it.tag == tag }
347+
.filter { it.tag == tag && it.showInClickGui.value }
348348
.forEach { with(ModuleEntry(it)) { buildLayout() } }
349349

350350
val vis = snapOverlays[tag.name]

src/main/kotlin/com/lambda/module/Module.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ abstract class Module(
146146
.onRelease { if (disableOnRelease) disable() }
147147
val disableOnReleaseSetting = setting("Disable On Release", false) { false }
148148
val drawSetting = setting("Draw", true, "Draws the module in the module list hud element") { false }
149+
val showInClickGui = setting("Show In ClickGui", true, "Shows the module in the ClickGui layout") { false }
149150

150151
var isEnabled by isEnabledSetting
151152
private set

0 commit comments

Comments
 (0)