From 5d01d431335cc6832fb58a88c202b043270a9c1f Mon Sep 17 00:00:00 2001 From: Lyzev Date: Sun, 26 May 2024 15:05:44 +0200 Subject: [PATCH] added close screen feature Signed-off-by: Lyzev --- .../render/ModuleToggleableCloseScreen.kt | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 src/main/kotlin/dev/lyzev/schizoid/feature/features/module/modules/render/ModuleToggleableCloseScreen.kt diff --git a/src/main/kotlin/dev/lyzev/schizoid/feature/features/module/modules/render/ModuleToggleableCloseScreen.kt b/src/main/kotlin/dev/lyzev/schizoid/feature/features/module/modules/render/ModuleToggleableCloseScreen.kt new file mode 100644 index 0000000000..8219bfd18d --- /dev/null +++ b/src/main/kotlin/dev/lyzev/schizoid/feature/features/module/modules/render/ModuleToggleableCloseScreen.kt @@ -0,0 +1,37 @@ +/* + * Copyright (c) 2024. Schizoid + * All rights reserved. + */ + +package dev.lyzev.schizoid.feature.features.module.modules.render + +import dev.lyzev.api.imgui.font.ImGuiFonts.OPEN_SANS_REGULAR +import dev.lyzev.api.setting.settings.switch +import dev.lyzev.schizoid.feature.IFeature +import dev.lyzev.schizoid.feature.features.gui.guis.ImGuiScreenFeature +import dev.lyzev.schizoid.feature.features.module.ModuleToggleableRenderImGuiContent +import imgui.ImGui +import imgui.ImGui.button +import imgui.ImGui.getStyle + +object ModuleToggleableCloseScreen : + ModuleToggleableRenderImGuiContent( + "Close Screen", + "Shows a close screen button in ingame screens.", + category = IFeature.Category.RENDER + ) { + + val showInFeatureScreen by switch( + "Show in feature screen", + "Shows the close screen button in the feature screen.", + false + ) + + override fun renderImGuiContent() { + if (button("Close Screen", 200f, OPEN_SANS_REGULAR.size + getStyle().framePaddingY * 2)) + mc.currentScreen?.close() + } + + override val shouldHandleEvents: Boolean + get() = super.shouldHandleEvents && mc.currentScreen != null && (showInFeatureScreen || mc.currentScreen !is ImGuiScreenFeature) +}