Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added close screen feature #94

Merged
merged 1 commit into from
May 26, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}
Loading