Always fills the window with responsive size
This commit is contained in:
parent
1dcf302665
commit
2b36953fdc
|
@ -2349,7 +2349,7 @@ static bool getGameImage(const GameBoxart *art, ImTextureID& textureId, bool all
|
|||
return false;
|
||||
}
|
||||
|
||||
static bool gameImageButton(ImTextureID textureId, const std::string& tooltip)
|
||||
static bool gameImageButton(ImTextureID textureId, const std::string& tooltip, ImVec2 size)
|
||||
{
|
||||
float ar = imguiDriver->getAspectRatio(textureId);
|
||||
ImVec2 uv0 { 0.f, 0.f };
|
||||
|
@ -2365,7 +2365,7 @@ static bool gameImageButton(ImTextureID textureId, const std::string& tooltip)
|
|||
uv0.x = -(ar - 1) / 2;
|
||||
uv1.x = 1 + (ar - 1) / 2;
|
||||
}
|
||||
bool pressed = ImGui::ImageButton(textureId, ScaledVec2(200, 200) - ImGui::GetStyle().FramePadding * 2, uv0, uv1);
|
||||
bool pressed = ImGui::ImageButton(textureId, size - ImGui::GetStyle().FramePadding * 2, uv0, uv1);
|
||||
gameTooltip(tooltip);
|
||||
|
||||
return pressed;
|
||||
|
@ -2412,6 +2412,9 @@ static void gui_display_content()
|
|||
ImGui::BeginChild(ImGui::GetID("library"), ImVec2(0, 0), true, ImGuiWindowFlags_DragScrolling);
|
||||
{
|
||||
const int itemsPerLine = std::max<int>(ImGui::GetContentRegionMax().x / (200 * settings.display.uiScale + ImGui::GetStyle().ItemSpacing.x), 1);
|
||||
const int responsiveBoxSize = ImGui::GetContentRegionMax().x / itemsPerLine - ImGui::GetStyle().FramePadding.x * 2;
|
||||
const ImVec2 responsiveBoxVec2 = ImVec2(responsiveBoxSize, responsiveBoxSize);
|
||||
|
||||
if (config::BoxartDisplayMode)
|
||||
ImGui::PushStyleVar(ImGuiStyleVar_SelectableTextAlign, ImVec2(0.5f, 0.5f));
|
||||
else
|
||||
|
@ -2434,9 +2437,9 @@ static void gui_display_content()
|
|||
loadedImages++;
|
||||
}
|
||||
if (textureId != ImTextureID())
|
||||
pressed = gameImageButton(textureId, "Dreamcast BIOS");
|
||||
pressed = gameImageButton(textureId, "Dreamcast BIOS", responsiveBoxVec2);
|
||||
else
|
||||
pressed = ImGui::Button("Dreamcast BIOS", ScaledVec2(200, 200));
|
||||
pressed = ImGui::Button("Dreamcast BIOS", responsiveBoxVec2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -2484,10 +2487,10 @@ static void gui_display_content()
|
|||
loadedImages++;
|
||||
}
|
||||
if (textureId != ImTextureID())
|
||||
pressed = gameImageButton(textureId, game.name);
|
||||
pressed = gameImageButton(textureId, game.name, responsiveBoxVec2);
|
||||
else
|
||||
{
|
||||
pressed = ImGui::Button(gameName.c_str(), ScaledVec2(200, 200));
|
||||
pressed = ImGui::Button(gameName.c_str(), responsiveBoxVec2);
|
||||
gameTooltip(game.name);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue