Skip to content
Merged
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
5 changes: 4 additions & 1 deletion src/Features/LightLimitFix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,10 @@
#include "InverseSquareLighting.h"
#include "LinearLighting.h"

#include "Menu/ThemeManager.h"
#include "Shadercache.h"
#include "State.h"
#include "Util.h"

static constexpr uint CLUSTER_MAX_LIGHTS = 128;
static constexpr uint MAX_LIGHTS = 1024;
Expand Down Expand Up @@ -53,7 +55,8 @@ void LightLimitFix::DrawOverlay()
{
if (!settings.EnableLightsVisualisation)
return;
ImGui::SetNextWindowPos(ImVec2(10, 10), ImGuiCond_Always);
const float pos = ThemeManager::Constants::OVERLAY_WINDOW_POSITION * Util::GetUIScale();
ImGui::SetNextWindowPos(ImVec2(pos, pos), ImGuiCond_Always);
ImGui::Begin("##LLFDebug", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings);
ImGui::TextColored(ImVec4(1.0f, 0.3f, 0.3f, 1.0f), "DEBUG FEATURE - LIGHT LIMIT VISUALISATION ENABLED");
ImGui::End();
Expand Down
26 changes: 13 additions & 13 deletions src/Features/PerformanceOverlay.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -310,12 +310,15 @@ void PerformanceOverlay::DrawOverlay()
ImGui::GetStyleColorVec4(ImGuiCol_WindowBg).z,
this->settings.BackgroundOpacity));

ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, this->settings.ShowBorder ? 1.0f : 0.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, this->settings.ShowBorder ? ImGui::GetStyle().WindowBorderSize : 0.0f);

const float scale = Util::GetUIScale();

// Set initial position if not already set
if (!this->settings.PositionSet) {
ImGui::SetNextWindowPos(ImVec2(PerformanceOverlay::Settings::kDefaultWindowPadding, PerformanceOverlay::Settings::kDefaultWindowPadding));
this->settings.Position = ImVec2(PerformanceOverlay::Settings::kDefaultWindowPadding, PerformanceOverlay::Settings::kDefaultWindowPadding);
const float defaultPad = Settings::kDefaultWindowPadding * scale;
ImGui::SetNextWindowPos(ImVec2(defaultPad, defaultPad));
this->settings.Position = ImVec2(defaultPad, defaultPad);
this->settings.PositionSet = true;
} else {
ImGui::SetNextWindowPos(this->settings.Position, ImGuiCond_FirstUseEver);
Expand All @@ -336,19 +339,16 @@ void PerformanceOverlay::DrawOverlay()
fpsText = std::format("Raw FPS: {:.1f} ({:.2f} ms)", this->state.smoothFps, this->state.smoothFrameTimeMs);
}
float fpsWidth = ImGui::CalcTextSize(fpsText.c_str()).x;
minWidth = std::max(minWidth, fpsWidth + PerformanceOverlay::Settings::kLabelPadding); // Add padding for labels
minWidth = std::max(minWidth, fpsWidth + Settings::kLabelPadding * scale);
}
if (this->settings.ShowDrawCalls) {
// Draw calls table needs significant width for all columns
minWidth = std::max(minWidth, PerformanceOverlay::Settings::kDrawCallsTableWidth * this->settings.TextSize);
minWidth = std::max(minWidth, Settings::kDrawCallsTableWidth * scale * this->settings.TextSize);
}
if (this->settings.ShowVRAM && menu->GetDXGIAdapter3()) {
// VRAM section needs width for the progress bar and text
minWidth = std::max(minWidth, PerformanceOverlay::Settings::kVRAMSectionWidth * this->settings.TextSize);
minWidth = std::max(minWidth, Settings::kVRAMSectionWidth * scale * this->settings.TextSize);
}

// Add some padding for window borders and spacing
minWidth += PerformanceOverlay::Settings::kWindowBorderPadding;
minWidth += Settings::kWindowBorderPadding * scale;

// Set minimum width, but allow auto-resize for larger content
ImGui::SetNextWindowSize(ImVec2(minWidth, 0), ImGuiCond_FirstUseEver);
Expand All @@ -368,7 +368,7 @@ void PerformanceOverlay::DrawOverlay()
this->settings.Position = currentPos;
}

ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4.0f, 1.0f)); // Tighter spacing
ImGui::PushStyleVar(ImGuiStyleVar_ItemSpacing, ImVec2(4.0f * scale, 1.0f * scale));
ImGui::SetWindowFontScale(this->settings.TextSize);

// Update graph values
Expand Down Expand Up @@ -456,7 +456,7 @@ void PerformanceOverlay::DrawFPS()
static_cast<int>(this->state.frameTimeHistory.GetHeadIdx()),
overlay_text,
this->state.smoothedMinFrameTime, this->state.smoothedMaxFrameTime,
ImVec2(graphWidth, 50.0f * this->settings.TextSize));
ImVec2(graphWidth, 50.0f * Util::GetUIScale() * this->settings.TextSize));

ImGui::PopStyleColor();

Expand Down Expand Up @@ -553,7 +553,7 @@ void PerformanceOverlay::DrawPostFGFrameTimeGraph()
static_cast<int>(state.postFGFrameTimeHistory.GetHeadIdx()),
overlay_text,
state.smoothedMinFrameTime, state.smoothedMaxFrameTime,
ImVec2(graphWidth, 50.0f * settings.TextSize));
ImVec2(graphWidth, 50.0f * Util::GetUIScale() * settings.TextSize));

ImGui::PopStyleColor();

Expand Down
6 changes: 4 additions & 2 deletions src/Features/PerformanceOverlay/ABTesting/ABTesting.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "ABTesting.h"
#include "Features/PerformanceOverlay.h"
#include "Menu.h"
#include "Menu/ThemeManager.h"
#include "State.h"
#include "Utils/FileSystem.h"
#include "Utils/UI.h"
Expand Down Expand Up @@ -235,9 +236,10 @@ void ABTestingManager::DrawOverlayUI()
float seconds = (currentTime.QuadPart - lastTestSwitch.QuadPart) / static_cast<float>(timingFrequency.QuadPart);
auto remaining = static_cast<float>(testInterval) - seconds;

// Match CS menu background alpha (0.85f from FullPalette[ImGuiCol_ChildBg])
// Scale position for resolution
const float pos = ThemeManager::Constants::OVERLAY_WINDOW_POSITION * Util::GetUIScale();
ImGui::SetNextWindowBgAlpha(0.85f);
ImGui::SetNextWindowPos(ImVec2(10, 10));
ImGui::SetNextWindowPos(ImVec2(pos, pos));
if (!ImGui::Begin("A/B Testing", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
ImGui::End();
return;
Expand Down
29 changes: 24 additions & 5 deletions src/Features/UnifiedWater.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

#include "Menu.h"
#include "Menu/ThemeManager.h"
#include "ShaderCache.h"
#include "Util.h"

#include <imgui_internal.h>

NLOHMANN_DEFINE_TYPE_NON_INTRUSIVE_WITH_DEFAULT(
UnifiedWater::Settings,
Expand Down Expand Up @@ -52,8 +54,25 @@ void UnifiedWater::DrawOverlay()
if (!waterCache || !waterCache->IsBuildRunning() && !waterCache->HasBuildFailed())
return;

const auto shaderCache = globals::shaderCache;
const float vOffset = shaderCache->IsCompiling() || shaderCache->GetFailedTasks() > 0 && !shaderCache->IsHideErrors() ? 120.0f : 0.0f;
const float scale = Util::GetUIScale();
const float pos = ThemeManager::Constants::OVERLAY_WINDOW_POSITION * scale;
const auto& style = ImGui::GetStyle();

// Stack below shader compilation window if it's visible this frame
float vOffset = 0.0f;
if (auto* shaderWin = ImGui::FindWindowByName("ShaderCompilationInfo")) {
if (shaderWin->Active) {
vOffset = (shaderWin->Pos.y + shaderWin->Size.y) - pos + style.ItemSpacing.y;
}
}
Comment thread
Dlizzio marked this conversation as resolved.
// Also stack below shader blocking overlay if visible
if (auto* blockingWin = ImGui::FindWindowByName("ShaderBlockingInfo")) {
if (blockingWin->Active) {
float blockingBottom = (blockingWin->Pos.y + blockingWin->Size.y) - pos + style.ItemSpacing.y;
if (blockingBottom > vOffset)
vOffset = blockingBottom;
}
}

const auto snapshot = waterCache->GetBuildProgressSnapshot();

Expand All @@ -64,7 +83,7 @@ void UnifiedWater::DrawOverlay()
auto percent = static_cast<float>(snapshot.completed) / static_cast<float>(snapshot.total);
auto progressOverlay = fmt::format("{}/{} ({:2.1f}%)", snapshot.completed, snapshot.total, 100 * percent);

ImGui::SetNextWindowPos(ImVec2(ThemeManager::Constants::OVERLAY_WINDOW_POSITION, ThemeManager::Constants::OVERLAY_WINDOW_POSITION + vOffset));
ImGui::SetNextWindowPos(ImVec2(pos, pos + vOffset));
if (!ImGui::Begin("UWCacheCreationInfo", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
ImGui::End();
return;
Expand All @@ -74,7 +93,7 @@ void UnifiedWater::DrawOverlay()

ImGui::End();
} else if (waterCache->HasBuildFailed()) {
ImGui::SetNextWindowPos(ImVec2(ThemeManager::Constants::OVERLAY_WINDOW_POSITION, ThemeManager::Constants::OVERLAY_WINDOW_POSITION + vOffset));
ImGui::SetNextWindowPos(ImVec2(pos, pos + vOffset));
if (!ImGui::Begin("UWCacheCreationInfo", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoSavedSettings)) {
ImGui::End();
return;
Expand Down
9 changes: 5 additions & 4 deletions src/Features/VR/SettingsUI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,16 @@ void VR::DrawOverlay()
int secondsLeft = int(std::ceil(autoHideSeconds - elapsed));

ImGuiIO& io = ImGui::GetIO();
ImVec2 overlaySize(520, 0);
const float scale = Util::GetUIScale();
ImVec2 overlaySize(520 * scale, 0);
ImVec2 overlayPos = ImVec2((io.DisplaySize.x - overlaySize.x) * 0.5f, (io.DisplaySize.y * 0.35f));
ImGui::SetNextWindowPos(overlayPos, ImGuiCond_Always);
ImGui::SetNextWindowSize(overlaySize, ImGuiCond_Always);
ImGui::SetNextWindowBgAlpha(0.95f);

ImGui::Begin("HowToUseOverlay", nullptr, ImGuiWindowFlags_NoTitleBar | ImGuiWindowFlags_AlwaysAutoResize | ImGuiWindowFlags_NoSavedSettings | ImGuiWindowFlags_NoFocusOnAppearing | ImGuiWindowFlags_NoNav);

ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 500.0f);
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 500.0f * scale);
ImGui::TextWrapped("How to Use VR Community Shaders Menu:");
ImGui::Separator();
ImGui::TextWrapped("You must open the Main Menu or Tween Menu before VR controls work.");
Expand All @@ -123,7 +124,7 @@ void VR::DrawOverlay()
Util::DrawButtonCombo(settings.VRMenuCloseKeys, true);

ImGui::Spacing();
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 500.0f);
ImGui::PushTextWrapPos(ImGui::GetCursorPos().x + 500.0f * scale);
ImGui::TextWrapped("Grip + Thumbstick: Adjust overlay depth (closer/farther)");
ImGui::Spacing();
ImGui::TextWrapped("Tip: Disable this VR overlay by setting Attach Mode to 'None' in VR settings.");
Expand Down Expand Up @@ -998,7 +999,7 @@ void VR::DrawSettings()
// Combo recording popup
if (this->isCapturingCombo) {
ImGui::OpenPopup("Record Combo");
ImGui::SetNextWindowSize(ImVec2(400, 200), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(400 * Util::GetUIScale(), 200 * Util::GetUIScale()), ImGuiCond_FirstUseEver);
if (ImGui::BeginPopupModal("Record Combo", nullptr, ImGuiWindowFlags_AlwaysAutoResize)) {
auto GetButtonName = [](uint32_t key) -> const char* {
switch (key) {
Expand Down
8 changes: 5 additions & 3 deletions src/Features/WeatherEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,15 +278,17 @@ void WeatherEditor::RenderWeatherDetailsWindow(bool* open)
return;

// Set initial position if not already set
const float scale = Util::GetUIScale();
if (!WeatherDetailsWindow.PositionSet) {
ImGui::SetNextWindowPos(ImVec2(50.0f, 50.0f));
WeatherDetailsWindow.Position = ImVec2(50.0f, 50.0f);
const float pos = 50.0f * scale;
ImGui::SetNextWindowPos(ImVec2(pos, pos));
WeatherDetailsWindow.Position = ImVec2(pos, pos);
WeatherDetailsWindow.PositionSet = true;
} else {
ImGui::SetNextWindowPos(WeatherDetailsWindow.Position, ImGuiCond_FirstUseEver);
}

ImGui::SetNextWindowSize(ImVec2(600, 800), ImGuiCond_FirstUseEver);
ImGui::SetNextWindowSize(ImVec2(600 * scale, 800 * scale), ImGuiCond_FirstUseEver);
if (ImGui::Begin("Weather Details##Popup", open, ImGuiWindowFlags_None)) {
// Remember window position for next frame
ImVec2 currentPos = ImGui::GetWindowPos();
Expand Down
4 changes: 2 additions & 2 deletions src/Menu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -707,7 +707,7 @@ void Menu::DrawSettings()
globalScale = ThemeManager::Constants::DEFAULT_GLOBAL_SCALE; // Ensure built-in themes stay at 0.0
}

const float uiScale = exp2(globalScale); // Get current UI scale
const float uiScale = exp2(globalScale); // User's manual GlobalScale for header icons
// Check if we can show icons - require setting enabled and at least some icons loaded (for undocked)
// For docked mode, always show icons if textures are available
bool canShowIcons = settings.Theme.ShowActionIcons &&
Expand All @@ -722,7 +722,7 @@ void Menu::DrawSettings()
// Main content starts here - no additional separator needed as it's already handled in the conditions above

float footer_height = settings.Theme.ShowFooter ?
(ImGui::GetFrameHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y * 3 + 3.0f) :
(ImGui::GetFrameHeightWithSpacing() + ImGui::GetStyle().ItemSpacing.y * 3) :
0.0f;

// Static storage for menu state - must persist across frames
Expand Down
5 changes: 3 additions & 2 deletions src/Menu/AdvancedSettingsRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,9 @@ void AdvancedSettingsRenderer::RenderShaderDebugSection()
// Show blocked shader status as a regular section
if (!shaderCache->blockedKey.empty()) {
// Create a visually distinct box for the blocked shader info with rounded corners and border
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 8.0f);
ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 2.0f);
const float scale = Util::GetUIScale();
ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 8.0f * scale);
ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, ImGui::GetStyle().WindowBorderSize);
ImVec4 blockedBgColor = Util::Colors::GetError();
blockedBgColor.w = 0.15f; // Semi-transparent background
ImGui::PushStyleColor(ImGuiCol_ChildBg, blockedBgColor);
Expand Down
22 changes: 10 additions & 12 deletions src/Menu/FeatureListRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,8 +179,8 @@ namespace
ImGui::SetWindowFontScale(1.0f);
}

// Reset cursor to after the title block (reduced spacing for tighter layout)
ImGui::SetCursorScreenPos(ImVec2(startPos.x, startPos.y + titleSize.y + 2.0f));
// Reset cursor to after the title block
ImGui::SetCursorScreenPos(ImVec2(startPos.x, startPos.y + titleSize.y + ImGui::GetStyle().ItemSpacing.y * 0.25f));
}

// Draw description if provided (wrapped to content width)
Expand Down Expand Up @@ -838,19 +838,17 @@ void FeatureListRenderer::DrawMenuVisitor::RenderRestoreDefaultsButton(Feature*
return;
}

// Position button in screen coordinates so it stays fixed in viewport when scrolling
// Position button in bottom-right corner, accounting for full button frame size
const auto& style = ImGui::GetStyle();
ImVec2 windowPos = ImGui::GetWindowPos();
ImVec2 windowSize = ImGui::GetWindowSize();
float scrollbarWidth = ImGui::GetScrollMaxY() > 0 ? ImGui::GetStyle().ScrollbarSize : 0.0f;

float scrollbarWidth = ImGui::GetScrollMaxY() > 0 ? style.ScrollbarSize : 0.0f;
float iconDimension = ImGui::GetFrameHeight() * 1.2f;
ImVec2 iconSize = ImVec2(iconDimension, iconDimension);

float padding = ThemeManager::Constants::OVERLAY_WINDOW_POSITION;
ImVec2 buttonPos = ImVec2(
windowPos.x + windowSize.x - iconSize.x - padding - scrollbarWidth,
windowPos.y + windowSize.y - iconSize.y - padding);
ImGui::SetCursorScreenPos(buttonPos);
ImVec2 iconSize(iconDimension, iconDimension);
ImVec2 frameSize(iconSize.x + style.FramePadding.x * 2, iconSize.y + style.FramePadding.y * 2);
ImGui::SetCursorScreenPos(ImVec2(
windowPos.x + windowSize.x - frameSize.x - style.WindowPadding.x - scrollbarWidth,
windowPos.y + windowSize.y - frameSize.y - style.WindowPadding.y));

ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(0.0f, 0.0f, 0.0f, 0.0f));
ImGui::PushStyleColor(ImGuiCol_ButtonHovered, ImVec4(1.0f, 1.0f, 1.0f, 0.3f));
Expand Down
Loading
Loading