mirror of
https://github.com/dhewm/dhewm3.git
synced 2025-04-19 08:58:56 +00:00
Dhewm3SettingsMenu: Default position is within main window again
Since switching to the Dear ImGui docking branch, the settings window usually was spawned outside the dhewm3 window (when playing in a window that's smaller than the screen). That's because in the docking branch positions are in global (screen) coordinates instead of relative to the viewport or (SDL) window. Now taking that into account.
This commit is contained in:
parent
81e857f1e1
commit
9f217c9c81
1 changed files with 6 additions and 5 deletions
|
@ -2413,11 +2413,12 @@ static void InitDhewm3SettingsMenu()
|
|||
const ImGuiStyle& style = ImGui::GetStyle();
|
||||
float defaultWidth = ImGui::CalcTextSize( "Control BindingsControl OptionsVideo OptionsAudio OptionsGame OptionsOther Options" ).x;
|
||||
defaultWidth += 2.0f * style.WindowPadding.x + 12.0f * style.FramePadding.x + 5.0f * style.ItemInnerSpacing.x;
|
||||
ImVec2 displaySize = ImGui::GetIO().DisplaySize;
|
||||
settingsMenuDefaultSize.x = fminf( defaultWidth, displaySize.x * 0.8f );
|
||||
settingsMenuDefaultSize.y = displaySize.y * 0.95f;
|
||||
|
||||
settingsMenuDefaultPos = displaySize * 0.025f;
|
||||
ImGuiViewport* mainViewPort = ImGui::GetMainViewport();
|
||||
ImVec2 viewPortSize = mainViewPort->Size;
|
||||
settingsMenuDefaultSize.x = fminf( defaultWidth, viewPortSize.x * 0.8f );
|
||||
settingsMenuDefaultSize.y = viewPortSize.y * 0.95f;
|
||||
// NOTE: in ImGui's docking branch, positions are in global (screen/OS) coordinates
|
||||
settingsMenuDefaultPos = mainViewPort->Pos + viewPortSize * 0.025f;
|
||||
d3settingsWinInitialized = true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue