ImGui stuff: Some tweaks

* Binding menu makes sure that the AllBindingsMenu always gets focus
  when opened
* Give binding-related popups slightly rounder edges
* Move Game Options tab behind Video and Audio Options
* Make warning overlays a bit less translucent
This commit is contained in:
Daniel Gibson 2024-05-28 04:45:53 +02:00
parent 4bdee4f638
commit 7af7508a7f
2 changed files with 14 additions and 11 deletions

View file

@ -369,6 +369,7 @@ struct BindingEntry {
winPos.x = btnMax.x + ImGui::GetStyle().ItemInnerSpacing.x;
ImGui::OpenPopup( menuWinTitle );
ImGui::SetNextWindowPos(winPos);
ImGui::SetNextWindowFocus();
}
if ( ImGui::Begin( menuWinTitle, &showThisMenu, menuWinFlags ) )
@ -914,9 +915,6 @@ struct BindingEntry {
{
const char* keyName = GetKeyName( rebindKeyNum );
// TODO: if rebindOtherEntry == NULL, get command for rebindKeyNum from Doom3 directly
// and don't use rebindOtherEntry !
if ( rebindOtherEntry != nullptr ) {
ImGui::Text( "Key '%s' is already bound to command %s !\nBind to %s instead?",
keyName, rebindOtherEntry->displayName.c_str(), displayName.c_str() );
@ -1011,6 +1009,9 @@ struct BindingEntry {
ImVec2 center = ImGui::GetMainViewport()->GetCenter();
ImGui::SetNextWindowPos( center, ImGuiCond_Appearing, ImVec2(0.5f, 0.5f) );
// with the default rounding the modal popup edges don't look rounded at all
ImGui::PushStyleVar( ImGuiStyleVar_WindowRounding, 4.0f );
BindingEntrySelectionState newSelState = BESS_Selected;
if ( selectionState == BESS_WantClear ) {
newSelState = HandleClearPopup( popupName, newOpen );
@ -1020,6 +1021,8 @@ struct BindingEntry {
newSelState = HandleRebindPopup( popupName, newOpen );
}
ImGui::PopStyleVar(); // ImGuiStyleVar_WindowRounding
if ( newSelState != selectionState ) {
popupOpened = false;
selectionState = newSelState;
@ -1653,13 +1656,6 @@ void Com_DrawDhewm3SettingsMenu()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Game Options"))
{
BeginTabChild( "gamechild" );
ImGui::Text("This is the Game Options tab!\nblah blah blah blah blah");
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Video Options"))
{
BeginTabChild( "vidchild" );
@ -1674,6 +1670,13 @@ void Com_DrawDhewm3SettingsMenu()
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Game Options"))
{
BeginTabChild( "gamechild" );
ImGui::Text("This is the Game Options tab!\nblah blah blah blah blah");
ImGui::EndChild();
ImGui::EndTabItem();
}
if (ImGui::BeginTabItem("Other Options"))
{
BeginTabChild( "otherchild" );

View file

@ -92,7 +92,7 @@ static void UpdateWarningOverlay()
}
ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Always, ImVec2(0.5f, 0.5f));
ImGui::PushStyleColor( ImGuiCol_WindowBg, ImVec4(1.0f, 0.4f, 0.4f, 0.4f) );
ImGui::PushStyleColor( ImGuiCol_WindowBg, ImVec4(1.0f, 0.4f, 0.4f, 0.6f) );
float padSize = fontSize * 2.0f;
ImGui::PushStyleVar( ImGuiStyleVar_WindowPadding, ImVec2(padSize, padSize) );