-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #94 from Lyzev/92-suggestion-close-screen-button
added close screen feature
- Loading branch information
Showing
1 changed file
with
37 additions
and
0 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
.../dev/lyzev/schizoid/feature/features/module/modules/render/ModuleToggleableCloseScreen.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
} |