mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-04-17 17:43:52 +00:00
Add UI opacity slider to settings window
Adds an Interface section with a UI Opacity slider (20-100%) that controls the transparency of all ImGui UI elements via the global style alpha.
This commit is contained in:
parent
5439a6a5eb
commit
7e172e30fe
2 changed files with 23 additions and 0 deletions
|
|
@ -75,6 +75,10 @@ private:
|
||||||
int pendingSfxVolume = 100;
|
int pendingSfxVolume = 100;
|
||||||
float pendingMouseSensitivity = 0.2f;
|
float pendingMouseSensitivity = 0.2f;
|
||||||
bool pendingInvertMouse = false;
|
bool pendingInvertMouse = false;
|
||||||
|
int pendingUiOpacity = 100;
|
||||||
|
|
||||||
|
// UI element transparency (0.0 = fully transparent, 1.0 = fully opaque)
|
||||||
|
float uiOpacity_ = 1.0f;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Render player info window
|
* Render player info window
|
||||||
|
|
|
||||||
|
|
@ -54,6 +54,10 @@ GameScreen::GameScreen() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScreen::render(game::GameHandler& gameHandler) {
|
void GameScreen::render(game::GameHandler& gameHandler) {
|
||||||
|
// Apply UI transparency setting
|
||||||
|
float prevAlpha = ImGui::GetStyle().Alpha;
|
||||||
|
ImGui::GetStyle().Alpha = uiOpacity_;
|
||||||
|
|
||||||
// Process targeting input before UI windows
|
// Process targeting input before UI windows
|
||||||
processTargetInput(gameHandler);
|
processTargetInput(gameHandler);
|
||||||
|
|
||||||
|
|
@ -222,6 +226,9 @@ void GameScreen::render(game::GameHandler& gameHandler) {
|
||||||
renderer->clearSelectionCircle();
|
renderer->clearSelectionCircle();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restore previous alpha
|
||||||
|
ImGui::GetStyle().Alpha = prevAlpha;
|
||||||
}
|
}
|
||||||
|
|
||||||
void GameScreen::renderPlayerInfo(game::GameHandler& gameHandler) {
|
void GameScreen::renderPlayerInfo(game::GameHandler& gameHandler) {
|
||||||
|
|
@ -2612,6 +2619,7 @@ void GameScreen::renderSettingsWindow() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
pendingUiOpacity = static_cast<int>(uiOpacity_ * 100.0f + 0.5f);
|
||||||
settingsInit = true;
|
settingsInit = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2678,7 +2686,18 @@ void GameScreen::renderSettingsWindow() {
|
||||||
ImGui::Separator();
|
ImGui::Separator();
|
||||||
ImGui::Spacing();
|
ImGui::Spacing();
|
||||||
|
|
||||||
|
ImGui::Text("Interface");
|
||||||
|
ImGui::SliderInt("UI Opacity", &pendingUiOpacity, 20, 100, "%d%%");
|
||||||
|
if (ImGui::Button("Restore Interface Defaults", ImVec2(-1, 0))) {
|
||||||
|
pendingUiOpacity = 100;
|
||||||
|
}
|
||||||
|
|
||||||
|
ImGui::Spacing();
|
||||||
|
ImGui::Separator();
|
||||||
|
ImGui::Spacing();
|
||||||
|
|
||||||
if (ImGui::Button("Apply", ImVec2(-1, 0))) {
|
if (ImGui::Button("Apply", ImVec2(-1, 0))) {
|
||||||
|
uiOpacity_ = static_cast<float>(pendingUiOpacity) / 100.0f;
|
||||||
window->setVsync(pendingVsync);
|
window->setVsync(pendingVsync);
|
||||||
window->setFullscreen(pendingFullscreen);
|
window->setFullscreen(pendingFullscreen);
|
||||||
window->applyResolution(kResolutions[pendingResIndex][0], kResolutions[pendingResIndex][1]);
|
window->applyResolution(kResolutions[pendingResIndex][0], kResolutions[pendingResIndex][1]);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue