mirror of
https://github.com/HarbourMasters/Shipwright.git
synced 2025-08-21 05:43:42 -07:00
Feature: Allow choosing audio backend (#1588)
* Fix X11 being searched for on macOS * Add ability to switch audio backends * Fix issues with c arrays of std dynamic size items * Fix old uses of sizeof() * Remove current selected option from list * Don’t show items if we only have one option
This commit is contained in:
parent
0e1248f840
commit
dbc4d8199e
7 changed files with 116 additions and 40 deletions
|
@ -502,6 +502,22 @@ namespace GameMenuBar {
|
|||
UIWidgets::Spacer(0);
|
||||
BindAudioSlider("Fanfare Volume: %d %%", "gFanfareVolume", 1.0f, SEQ_FANFARE);
|
||||
|
||||
ImGui::Text("Audio API (Needs reload)");
|
||||
auto audioBackends = SohImGui::GetAvailableAudioBackends();
|
||||
auto currentAudioBackend = SohImGui::GetCurrentAudioBackend();
|
||||
|
||||
if (ImGui::BeginCombo("##AApi", currentAudioBackend.second)) {
|
||||
if (audioBackends.size() > 1) {
|
||||
for (uint8_t i = 0; i < audioBackends.size(); i++) {
|
||||
if (ImGui::Selectable(audioBackends[i].second, audioBackends[i] == currentAudioBackend)) {
|
||||
SohImGui::SetCurrentAudioBackend(i, audioBackends[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ImGui::EndCombo();
|
||||
}
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
|
||||
|
@ -609,13 +625,15 @@ namespace GameMenuBar {
|
|||
}
|
||||
|
||||
ImGui::Text("Renderer API (Needs reload)");
|
||||
auto backends = SohImGui::GetAvailableRenderingBackends();
|
||||
auto currentBackend = SohImGui::GetCurrentRenderingBackend();
|
||||
auto renderingBackends = SohImGui::GetAvailableRenderingBackends();
|
||||
auto currentRenderingBackend = SohImGui::GetCurrentRenderingBackend();
|
||||
|
||||
if (ImGui::BeginCombo("##RApi", currentBackend.second)) {
|
||||
for (uint8_t i = 0; i < sizeof(backends) / sizeof(backends[0]); i++) {
|
||||
if (ImGui::Selectable(backends[i].second, backends[i] == currentBackend)) {
|
||||
SohImGui::SetCurrentRenderingBackend(i, backends[i]);
|
||||
if (ImGui::BeginCombo("##RApi", currentRenderingBackend.second)) {
|
||||
if (renderingBackends.size() > 1) {
|
||||
for (uint8_t i = 0; i < renderingBackends.size(); i++) {
|
||||
if (ImGui::Selectable(renderingBackends[i].second, renderingBackends[i] == currentRenderingBackend)) {
|
||||
SohImGui::SetCurrentRenderingBackend(i, renderingBackends[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue