diff --git a/src/start_screen.cpp b/src/start_screen.cpp index c1f644c7..2bc8c31f 100644 --- a/src/start_screen.cpp +++ b/src/start_screen.cpp @@ -140,6 +140,9 @@ StartScreen::StartScreen(const std::vector& args, SDL_Renderer } Screen* StartScreen::render(float, bool&) { + const float TEXT_LOAD_WIDTH = ImGui::CalcTextSize("load").x; + const float TEXT_BASE_HEIGHT = ImGui::GetTextLineHeightWithSpacing(); + // TODO: imgui tox profile selector? @@ -252,7 +255,7 @@ Screen* StartScreen::render(float, bool&) { // load but file missing ImGui::BeginDisabled(); - ImGui::Button("load", {60, 25}); + ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f}); ImGui::EndDisabled(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_AllowWhenDisabled)) { @@ -262,14 +265,14 @@ Screen* StartScreen::render(float, bool&) { // new but file exists ImGui::BeginDisabled(); - ImGui::Button("load", {60, 25}); + ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f}); ImGui::EndDisabled(); if (ImGui::IsItemHovered(ImGuiHoveredFlags_ForTooltip | ImGuiHoveredFlags_AllowWhenDisabled)) { ImGui::SetTooltip("file already exists"); } } else { - if (ImGui::Button("load", {60, 25})) { + if (ImGui::Button("load", {TEXT_LOAD_WIDTH*1.5f, TEXT_BASE_HEIGHT*1.5f})) { auto new_screen = std::make_unique(std::move(_conf), _renderer, _theme, _tox_profile_path, _password, _user_name, queued_plugin_paths); return new_screen.release();