mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2024-12-27 18:16:23 +00:00
Resize trophy pop up windows based on window size (#1769)
This commit is contained in:
parent
715ac8a279
commit
8bb1e8fcdb
|
@ -38,21 +38,22 @@ void TrophyUI::Finish() {
|
|||
void TrophyUI::Draw() {
|
||||
const auto& io = GetIO();
|
||||
|
||||
float AdjustWidth = io.DisplaySize.x / 1280;
|
||||
float AdjustHeight = io.DisplaySize.y / 720;
|
||||
const ImVec2 window_size{
|
||||
std::min(io.DisplaySize.x, 250.f),
|
||||
std::min(io.DisplaySize.y, 70.f),
|
||||
std::min(io.DisplaySize.x, (300 * AdjustWidth)),
|
||||
std::min(io.DisplaySize.y, (70 * AdjustHeight)),
|
||||
};
|
||||
|
||||
SetNextWindowSize(window_size);
|
||||
SetNextWindowCollapsed(false);
|
||||
SetNextWindowPos(ImVec2(io.DisplaySize.x - 250, 50));
|
||||
SetNextWindowPos(ImVec2(io.DisplaySize.x - (300 * AdjustWidth), (50 * AdjustHeight)));
|
||||
KeepNavHighlight();
|
||||
|
||||
if (Begin("Trophy Window", nullptr,
|
||||
ImGuiWindowFlags_NoDecoration | ImGuiWindowFlags_NoSavedSettings |
|
||||
ImGuiWindowFlags_NoInputs)) {
|
||||
if (trophy_icon) {
|
||||
Image(trophy_icon.GetTexture().im_id, ImVec2(50, 50));
|
||||
Image(trophy_icon.GetTexture().im_id, ImVec2((50 * AdjustWidth), (50 * AdjustHeight)));
|
||||
ImGui::SameLine();
|
||||
} else {
|
||||
// placeholder
|
||||
|
@ -61,6 +62,7 @@ void TrophyUI::Draw() {
|
|||
GetColorU32(ImVec4{0.7f}));
|
||||
ImGui::Indent(60);
|
||||
}
|
||||
SetWindowFontScale((1.2 * AdjustHeight));
|
||||
TextWrapped("Trophy earned!\n%s", trophy_name.c_str());
|
||||
}
|
||||
End();
|
||||
|
|
Loading…
Reference in a new issue