Skip to content
Closed
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
UseMonochromeLogo,
ShowFooter,
CenterHeader,
DisableClearCacheButton,
TooltipHoverDelay,
BackgroundBlurEnabled,
ScrollbarOpacity,
Expand Down
17 changes: 9 additions & 8 deletions src/Menu.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,14 +242,15 @@ class Menu
return roles;
}();

bool UseSimplePalette = false; // DEPRECATED: No longer affects behavior. UI now shows both Simple and Advanced controls.
bool ShowActionIcons = true; // whether to show action buttons as icons
bool UseMonochromeIcons = false; // whether to use monochrome (white) action icons with text color tinting
bool UseMonochromeLogo = false; // whether to use monochrome CS logo
bool ShowFooter = true; // whether to show the footer with game version/GPU info
bool CenterHeader = false; // whether to center the header title and logo
float TooltipHoverDelay = 0.5f; // tooltip hover delay in seconds
bool BackgroundBlurEnabled = false; // enable background blur effect
bool UseSimplePalette = false; // DEPRECATED: No longer affects behavior. UI now shows both Simple and Advanced controls.
bool ShowActionIcons = true; // whether to show action buttons as icons
bool UseMonochromeIcons = false; // whether to use monochrome (white) action icons with text color tinting
bool UseMonochromeLogo = false; // whether to use monochrome CS logo
bool ShowFooter = true; // whether to show the footer with game version/GPU info
bool CenterHeader = false; // whether to center the header title and logo
bool DisableClearCacheButton = false; // disable the Clear Shader Cache button in the menu header
float TooltipHoverDelay = 0.5f; // tooltip hover delay in seconds
bool BackgroundBlurEnabled = false; // enable background blur effect
// Scrollbar opacity settings
struct ScrollbarOpacitySettings
{
Expand Down
65 changes: 46 additions & 19 deletions src/Menu/MenuHeaderRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,10 +206,19 @@ void MenuHeaderRenderer::RenderHeader(bool isDocked, bool showLogo, bool canShow

// Clear Shader Cache Button
ImGui::TableNextColumn();
if (ImGui::Button("Clear Shader Cache", { -1, 0 })) {
shaderCache->Clear();
if (shaderCache->IsDiskCache()) {
shaderCache->DeleteDiskCache();
{
bool isDisabled = globals::menu->GetSettings().Theme.DisableClearCacheButton;
if (isDisabled) {
ImGui::BeginDisabled();
}
if (ImGui::Button("Clear Shader Cache", { -1, 0 })) {
shaderCache->Clear();
if (shaderCache->IsDiskCache()) {
shaderCache->DeleteDiskCache();
}
}
if (isDisabled) {
ImGui::EndDisabled();
}
}
if (auto _tt = Util::HoverTooltipWrapper()) {
Expand Down Expand Up @@ -292,19 +301,22 @@ std::vector<MenuHeaderRenderer::ActionIcon> MenuHeaderRenderer::BuildActionIcons
}
if (uiIcons.clearCache.texture) {
auto shaderCache = globals::shaderCache;
bool isDisabled = globals::menu->GetSettings().Theme.DisableClearCacheButton;
actionIcons.push_back({ uiIcons.clearCache.texture,
"Clear Shader Cache\n\n"
"Clears the shader cache and disk cache (if enabled).\n"
"The Shader Cache is the collection of compiled shaders which replace\n"
"the vanilla shaders at runtime. The Disk Cache is a collection of\n"
"compiled shaders on disk. Clearing will mean that shaders are\n"
"recompiled only when the game re-encounters them.",
isDisabled ? "Clear Shader Cache (Disabled)" :
"Clear Shader Cache\n\n"
"Clears the shader cache and disk cache (if enabled).\n"
"The Shader Cache is the collection of compiled shaders which replace\n"
"the vanilla shaders at runtime. The Disk Cache is a collection of\n"
"compiled shaders on disk. Clearing will mean that shaders are\n"
"recompiled only when the game re-encounters them.",
[shaderCache]() {
shaderCache->Clear();
if (shaderCache->IsDiskCache()) {
shaderCache->DeleteDiskCache();
}
} });
},
isDisabled });
}

return actionIcons;
Expand Down Expand Up @@ -365,25 +377,31 @@ void MenuHeaderRenderer::RenderDockedIcons(const std::vector<ActionIcon>& action
// Draw icon with hover effect, using reduced area to minimize padding
ImU32 tintColor;
if (globals::menu->GetSettings().Theme.UseMonochromeIcons) {
// Use theme text color for monochrome icons
ImVec4 textColor = globals::menu->GetSettings().Theme.Palette.Text;
if (!isHovered) {
textColor.w *= 0.85f; // Slightly reduce alpha when not hovered
if (it->disabled) {
textColor.w *= 0.35f;
} else if (!isHovered) {
textColor.w *= 0.85f;
}
tintColor = ImGui::GetColorU32(textColor);
} else {
// Use white/gray tint for colored icons
tintColor = isHovered ? IM_COL32(255, 255, 255, 255) : IM_COL32(220, 220, 220, 220);
if (it->disabled) {
tintColor = IM_COL32(128, 128, 128, 90);
} else {
tintColor = isHovered ? IM_COL32(255, 255, 255, 255) : IM_COL32(220, 220, 220, 220);
}
}
fgDrawList->AddImage(it->texture, iconMin, iconMax, ImVec2(0, 0), ImVec2(1, 1), tintColor);
}

// Handle interaction
if (isHovered) {
// Draw subtle background for hovered icon using interaction area
fgDrawList->AddRectFilled(interactionMin, interactionMax, IM_COL32(255, 255, 255, 40));
// Draw subtle background for hovered icon using interaction area (only if not disabled)
if (!it->disabled) {
fgDrawList->AddRectFilled(interactionMin, interactionMax, IM_COL32(255, 255, 255, 40));
}

if (ImGui::IsMouseClicked(ImGuiMouseButton_Left)) {
if (ImGui::IsMouseClicked(ImGuiMouseButton_Left) && !it->disabled) {
it->callback();
}

Expand Down Expand Up @@ -429,6 +447,11 @@ void MenuHeaderRenderer::RenderUndockedIcons(const std::vector<ActionIcon>& acti

std::string buttonId = std::format("##ActionBtn{}", i);

// Disable interaction for disabled icons
if (icon.disabled) {
ImGui::BeginDisabled();
}

// Use ImageButton with reduced image size to minimize padding
if (ImGui::ImageButton(buttonId.c_str(), icon.texture, imageSize, ImVec2(0, 0), ImVec2(1, 1), ImVec4(0, 0, 0, 0), tintColor)) {
icon.callback();
Expand All @@ -437,6 +460,10 @@ void MenuHeaderRenderer::RenderUndockedIcons(const std::vector<ActionIcon>& acti
ImGui::Text("%s", icon.tooltip);
}

if (icon.disabled) {
ImGui::EndDisabled();
}

// Add SameLine except for the last button
if (i < actionIcons.size() - 1) {
ImGui::SameLine();
Expand Down
1 change: 1 addition & 0 deletions src/Menu/MenuHeaderRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class MenuHeaderRenderer
ID3D11ShaderResourceView* texture;
const char* tooltip;
std::function<void()> callback;
bool disabled = false;
};

static void RenderHeader(bool isDocked, bool showLogo, bool canShowIcons, float uiScale, const Menu::UIIcons& uiIcons);
Expand Down
15 changes: 15 additions & 0 deletions src/Menu/SettingsTabRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,21 @@ void SettingsTabRenderer::RenderInterfaceTab()
RenderColorsTab();
ImGui::EndTabBar();
}

// Additional Interface Settings (outside of sub-tabs)
ImGui::Spacing();
SeparatorTextWithFont("Header Buttons", Menu::FontRole::Subheading);

bool disableClearCache = globals::menu->GetSettings().Theme.DisableClearCacheButton;
if (ImGui::Checkbox("Disable Clear Shader Cache Button", &disableClearCache)) {
globals::menu->GetSettings().Theme.DisableClearCacheButton = disableClearCache;
}
if (auto _tt = Util::HoverTooltipWrapper()) {
ImGui::Text(
"Disables the Clear Shader Cache button in the menu header.\n"
"The button will appear greyed out and non-functional.");
}

ImGui::EndTabItem();
}
}
Expand Down