mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2024-12-23 00:28:51 -05:00
Audio & Rendering backend option greyed out if theres only one (#1958)
This commit is contained in:
parent
3914781ebf
commit
8be2c4ddd7
@ -540,17 +540,23 @@ namespace GameMenuBar {
|
|||||||
auto audioBackends = SohImGui::GetAvailableAudioBackends();
|
auto audioBackends = SohImGui::GetAvailableAudioBackends();
|
||||||
auto currentAudioBackend = SohImGui::GetCurrentAudioBackend();
|
auto currentAudioBackend = SohImGui::GetCurrentAudioBackend();
|
||||||
|
|
||||||
|
if (audioBackends.size() <= 1) {
|
||||||
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||||
|
}
|
||||||
if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) {
|
if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) {
|
||||||
if (audioBackends.size() > 1) {
|
|
||||||
for (uint8_t i = 0; i < audioBackends.size(); i++) {
|
for (uint8_t i = 0; i < audioBackends.size(); i++) {
|
||||||
if (ImGui::Selectable(audioBackends[i].second, audioBackends[i] == currentAudioBackend)) {
|
if (ImGui::Selectable(audioBackends[i].second, audioBackends[i] == currentAudioBackend)) {
|
||||||
SohImGui::SetCurrentAudioBackend(i, audioBackends[i]);
|
SohImGui::SetCurrentAudioBackend(i, audioBackends[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
if (audioBackends.size() <= 1) {
|
||||||
|
ImGui::PopItemFlag();
|
||||||
|
ImGui::PopStyleVar(1);
|
||||||
|
}
|
||||||
|
|
||||||
ImGui::EndMenu();
|
ImGui::EndMenu();
|
||||||
}
|
}
|
||||||
@ -662,17 +668,23 @@ namespace GameMenuBar {
|
|||||||
auto renderingBackends = SohImGui::GetAvailableRenderingBackends();
|
auto renderingBackends = SohImGui::GetAvailableRenderingBackends();
|
||||||
auto currentRenderingBackend = SohImGui::GetCurrentRenderingBackend();
|
auto currentRenderingBackend = SohImGui::GetCurrentRenderingBackend();
|
||||||
|
|
||||||
|
if (renderingBackends.size() <= 1) {
|
||||||
|
ImGui::PushItemFlag(ImGuiItemFlags_Disabled, true);
|
||||||
|
ImGui::PushStyleVar(ImGuiStyleVar_Alpha, ImGui::GetStyle().Alpha * 0.5f);
|
||||||
|
}
|
||||||
if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) {
|
if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) {
|
||||||
if (renderingBackends.size() > 1) {
|
|
||||||
for (uint8_t i = 0; i < renderingBackends.size(); i++) {
|
for (uint8_t i = 0; i < renderingBackends.size(); i++) {
|
||||||
if (ImGui::Selectable(renderingBackends[i].second, renderingBackends[i] == currentRenderingBackend)) {
|
if (ImGui::Selectable(renderingBackends[i].second, renderingBackends[i] == currentRenderingBackend)) {
|
||||||
SohImGui::SetCurrentRenderingBackend(i, renderingBackends[i]);
|
SohImGui::SetCurrentRenderingBackend(i, renderingBackends[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
ImGui::EndCombo();
|
ImGui::EndCombo();
|
||||||
}
|
}
|
||||||
|
if (renderingBackends.size() <= 1) {
|
||||||
|
ImGui::PopItemFlag();
|
||||||
|
ImGui::PopStyleVar(1);
|
||||||
|
}
|
||||||
|
|
||||||
EXPERIMENTAL();
|
EXPERIMENTAL();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user