@@ -6733,42 +6733,56 @@ void FullscreenUI::CloseSaveStateSelector()
67336733
67346734void FullscreenUI::DrawSaveStateSelector (bool is_loading)
67356735{
6736+ ImVec2 win_pos = s_window_padding;
6737+ ImVec2 win_size = s_game_size - s_window_padding * 2 - ImVec2 (LayoutScale (0 .0f ), LayoutScale (110 .0f ));
67366738 ImGuiIO& io = ImGui::GetIO ();
67376739
6738- ImGui::SetNextWindowPos (ImVec2 (0 .0f , 0 .0f ));
6739- ImGui::SetNextWindowSize (io. DisplaySize - LayoutScale ( 0 . 0f , LAYOUT_FOOTER_HEIGHT) );
6740+ // ImGui::SetNextWindowPos(GameBounds( ImVec2(0.0f, 0.0f) ));
6741+ // ImGui::SetNextWindowSize(s_game_size );
67406742
6741- ImGui::PushStyleVar (ImGuiStyleVar_WindowPadding, ImVec2 (0 .0f , 0 .0f ));
6742- ImGui::PushStyleVar (ImGuiStyleVar_WindowBorderSize, 0 .0f );
6743- ImGui::PushStyleVar (ImGuiStyleVar_WindowRounding, 0 .0f );
6744- ImGui::PushStyleVar (ImGuiStyleVar_ChildRounding, 0 .0f );
6745- ImGui::PushStyleVar (ImGuiStyleVar_ChildBorderSize, 0 .0f );
6743+ // ImGui::PushStyleVar(ImGuiStyleVar_WindowPadding, ImVec2(0.0f, 0.0f));
6744+ // ImGui::PushStyleVar(ImGuiStyleVar_WindowBorderSize, 0.0f);
6745+ // ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, 0.0f);
6746+ // ImGui::PushStyleVar(ImGuiStyleVar_ChildRounding, 0.0f);
6747+ // ImGui::PushStyleVar(ImGuiStyleVar_ChildBorderSize, 0.0f);
67466748
67476749 const char * window_title = is_loading ? FSUI_CSTR (" Load State" ) : FSUI_CSTR (" Save State" );
67486750 ImGui::OpenPopup (window_title);
6749-
6751+ ImU32 yellowcol = IM_COL32 ( 255 , 236 , 153 , 255 );
67506752 bool is_open = true ;
6751- const bool valid = ImGui::BeginPopupModal (window_title, &is_open,
6753+ /* const bool valid = ImGui::BeginPopupModal(window_title, &is_open,
67526754 ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove | ImGuiWindowFlags_NoTitleBar |
67536755 ImGuiWindowFlags_NoBackground);
6756+ */
6757+ const bool valid = ImGuiFullscreen::BeginPTR2PopupModal (win_pos, win_size, window_title, &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove);
6758+ ImGui::PushStyleColor (ImGuiCol_Text, HEX_TO_IMVEC4 (0x9e001f , 0xff ));
6759+ ImGuiContext& g = *GImGui;
6760+ float popup_title_height = g.FontSize + g.Style .FramePadding .y * 2 .0f ;
6761+ float scrollbar_width = g.Style .ScrollbarSize * 1.3 ;
6762+ ImVec2 inner_win_size = ImGui::GetWindowSize () - ImVec2 (scrollbar_width, popup_title_height);
67546763 if (!valid || !is_open)
67556764 {
67566765 if (valid)
6757- ImGui::EndPopup ();
6758-
6759- ImGui::PopStyleVar (5 );
6766+ {
6767+ // ImGuiFullscreen::EndPTR2PopupModal();
6768+ // ImGui::EndPopup();
6769+ }
6770+ // ImGui::PopStyleVar(5);
6771+ ImGui::PopStyleColor ();
6772+ ImGuiFullscreen::EndPTR2PopupModal ();
67606773 if (!is_open)
67616774 {
67626775 CloseSaveStateSelector ();
67636776 ReturnToPreviousWindow ();
67646777 }
67656778 return ;
67666779 }
6767-
6780+ // ImGuiFullscreen::EndPTR2PopupModal();
67686781 const ImVec2 heading_size =
6769- ImVec2 (io. DisplaySize .x , LayoutScale (LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) +
6782+ ImVec2 (s_game_size .x , LayoutScale (LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY) +
67706783 (LayoutScale (LAYOUT_MENU_BUTTON_Y_PADDING) * 2 .0f ) + LayoutScale (2 .0f ));
67716784
6785+ /*
67726786 ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIPrimaryColor, 0.9f));
67736787
67746788 if (ImGui::BeginChild("state_titlebar", heading_size, ImGuiChildFlags_NavFlattened, 0))
@@ -6784,37 +6798,41 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
67846798 EndNavBar();
67856799 ImGui::EndChild();
67866800 }
6787-
67886801 ImGui::PopStyleColor();
6789- ImGui::PushStyleColor (ImGuiCol_ChildBg, ModAlpha (UIBackgroundColor, 0 .9f ));
6790- ImGui::SetCursorPos (ImVec2 (0 .0f , heading_size.y ));
6791-
6802+ */
67926803 bool close_handled = false ;
6804+
6805+ // ImGui::PushStyleColor(ImGuiCol_ChildBg, ModAlpha(UIBackgroundColor, 0.0f));
6806+ ImGui::SetCursorPos (ImVec2 (0 .0f , popup_title_height));// heading_size.y));
6807+
6808+ /*
67936809 if (s_save_state_selector_open &&
6794- ImGui::BeginChild (" state_list" , ImVec2 (io. DisplaySize . x , io. DisplaySize . y - LayoutScale (LAYOUT_FOOTER_HEIGHT) - heading_size.y ),
6810+ ImGui::BeginChild("state_list", ImVec2(inner_win_size. x, inner_win_size.y), // - heading_size.y),
67956811 ImGuiChildFlags_NavFlattened, 0))
67966812 {
6813+ */
67976814 BeginMenuButtons ();
67986815
67996816 const ImGuiStyle& style = ImGui::GetStyle ();
68006817
68016818 const float title_spacing = LayoutScale (10 .0f );
68026819 const float summary_spacing = LayoutScale (4 .0f );
6803- const float item_spacing = LayoutScale (20 .0f );
6804- const float item_width_with_spacing = std::floor (LayoutScale (LAYOUT_SCREEN_WIDTH / 4 .0f ) );
6820+ const float item_spacing = LayoutScale (0 .0f );
6821+ const float item_width_with_spacing = std::floor (inner_win_size. x / 3 .0f );
68056822 const float item_width = item_width_with_spacing - item_spacing;
68066823 const float image_width = item_width - (style.FramePadding .x * 2 .0f );
68076824 const float image_height = image_width / 1 .33f ;
68086825 const ImVec2 image_size (image_width, image_height);
68096826 const float item_height = (style.FramePadding .y * 2 .0f ) + image_height + title_spacing + g_large_font->FontSize + summary_spacing +
68106827 g_medium_font->FontSize ;
68116828 const ImVec2 item_size (item_width, item_height);
6812- const u32 grid_count_x = std::floor (ImGui::GetWindowWidth () / item_width_with_spacing);
6813- const float start_x =
6814- (static_cast <float >(ImGui::GetWindowWidth ()) - (item_width_with_spacing * static_cast <float >(grid_count_x))) * 0 .5f ;
6829+ const u32 grid_count_x = std::floor (inner_win_size. x / item_width_with_spacing);
6830+ // const float start_x =
6831+ // (static_cast<float>(ImGui::GetWindowWidth()) - (item_width_with_spacing * static_cast<float>(grid_count_x))) * 0.5f;
68156832
68166833 u32 grid_x = 0 ;
6817- ImGui::SetCursorPos (ImVec2 (start_x, 0 .0f ));
6834+
6835+ // ImGui::SetCursorPos(ImVec2(start_x > 0? start_x : 0.0f, popup_title_height));
68186836 for (u32 i = 0 ; i < s_save_state_selector_slots.size ();)
68196837 {
68206838 if (i == 0 )
@@ -6826,30 +6844,32 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
68266844
68276845 // can't use a choice dialog here, because we're already in a modal...
68286846 ImGuiFullscreen::PushResetLayout ();
6829- ImGui::PushFont (g_large_font);
6847+ /* ImGui::PushFont(g_large_font);
68306848 ImGui::PushStyleVar(ImGuiStyleVar_WindowRounding, LayoutScale(10.0f));
68316849 ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, LayoutScale(LAYOUT_MENU_BUTTON_X_PADDING, LAYOUT_MENU_BUTTON_Y_PADDING));
68326850 ImGui::PushStyleVar(ImGuiStyleVar_FrameBorderSize, 0.0f);
68336851 ImGui::PushStyleColor(ImGuiCol_Text, UIPrimaryTextColor);
68346852 ImGui::PushStyleColor(ImGuiCol_TitleBg, UIPrimaryDarkColor);
68356853 ImGui::PushStyleColor(ImGuiCol_TitleBgActive, UIPrimaryColor);
68366854 ImGui::PushStyleColor(ImGuiCol_PopupBg, UIPopupBackgroundColor);
6837-
6855+ */
68386856 const float width = LayoutScale (600 .0f );
68396857 const float title_height =
68406858 g_large_font->FontSize + ImGui::GetStyle ().FramePadding .y * 2 .0f + ImGui::GetStyle ().WindowPadding .y * 2 .0f ;
68416859 const float height =
68426860 title_height + LayoutScale (LAYOUT_MENU_BUTTON_HEIGHT_NO_SUMMARY + (LAYOUT_MENU_BUTTON_Y_PADDING * 2 .0f )) * 3 .0f ;
6843- ImGui::SetNextWindowSize (ImVec2 (width, height));
6844- ImGui::SetNextWindowPos (ImGui::GetIO ().DisplaySize * 0 .5f , ImGuiCond_Always, ImVec2 (0 .5f , 0 .5f ));
6861+ // ImGui::SetNextWindowSize();
6862+ ImVec2 size = ImVec2 (width, height);
6863+ ImVec2 pos = s_game_size / 2 - size / 2 ;
6864+ ImGui::SetNextWindowPos (GameBounds (s_game_size * 0 .5f ), ImGuiCond_Always, ImVec2 (0 .5f , 0 .5f ));
68456865 ImGui::OpenPopup (entry.title .c_str ());
68466866
68476867 // don't let the back button flow through to the main window
68486868 bool submenu_open = !WantsToCloseMenu ();
68496869 close_handled ^= submenu_open;
68506870
68516871 bool closed = false ;
6852- if (ImGui::BeginPopupModal (
6872+ if (ImGuiFullscreen::BeginPTR2PopupModal (pos, size,
68536873 entry.title .c_str (), &is_open, ImGuiWindowFlags_NoCollapse | ImGuiWindowFlags_NoResize | ImGuiWindowFlags_NoMove))
68546874 {
68556875 ImGui::PushStyleColor (ImGuiCol_Text, UIBackgroundTextColor);
@@ -6920,10 +6940,10 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
69206940 if (!closed)
69216941 QueueResetFocus (FocusResetType::WindowChanged);
69226942 }
6923-
6924- ImGui::PopStyleColor (4 );
6925- ImGui::PopStyleVar (3 );
6926- ImGui::PopFont ();
6943+ ImGuiFullscreen::EndPTR2PopupModal ();
6944+ // ImGui::PopStyleColor(4);
6945+ // ImGui::PopStyleVar(3);
6946+ // ImGui::PopFont();
69276947 ImGuiFullscreen::PopResetLayout ();
69286948
69296949 if (closed || i >= s_save_state_selector_slots.size ())
@@ -6966,8 +6986,10 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
69666986 const ImRect image_rect (CenterImage (ImRect (bb.Min , bb.Min + image_size),
69676987 ImVec2 (static_cast <float >(screenshot->GetWidth ()), static_cast <float >(screenshot->GetHeight ()))));
69686988
6969- ImGui::GetWindowDrawList ()->AddImage (reinterpret_cast <ImTextureID>(screenshot->GetNativeHandle ()),
6970- image_rect.Min , image_rect.Max , ImVec2 (0 .0f , 0 .0f ), ImVec2 (1 .0f , 1 .0f ), IM_COL32 (255 , 255 , 255 , 255 ));
6989+ ImGui::GetWindowDrawList ()->AddImageRounded (reinterpret_cast <ImTextureID>(screenshot->GetNativeHandle ()),
6990+ image_rect.Min , image_rect.Max , ImVec2 (0 .0f , 0 .0f ), ImVec2 (1 .0f , 1 .0f ), IM_COL32 (255 , 255 , 255 , 255 ), LayoutScale (15 .0f ));
6991+
6992+ // ImGui::GetWindowDrawList()->AddRect(image_rect.Min, image_rect.Max, yellowcol, LayoutScale(15.0), 0, LayoutScale(15.0));
69716993
69726994 const ImVec2 title_pos (bb.Min .x , bb.Min .y + image_height + title_spacing);
69736995 const ImRect title_bb (title_pos, ImVec2 (bb.Max .x , title_pos.y + g_large_font->FontSize ));
@@ -7002,30 +7024,30 @@ void FullscreenUI::DrawSaveStateSelector(bool is_loading)
70027024 s_save_state_selector_submenu_index = static_cast <s32>(i);
70037025 }
70047026 }
7005-
70067027 grid_x++;
70077028 if (grid_x == grid_count_x)
70087029 {
70097030 grid_x = 0 ;
7010- ImGui::SetCursorPosX (start_x);
7031+ ImGui::SetCursorPosX (0 . 0f ); // start_x > 0 ? start_x : 0.0f );
70117032 ImGui::SetCursorPosY (ImGui::GetCursorPosY () + item_spacing);
70127033 }
70137034 else
70147035 {
7015- ImGui::SameLine (start_x + static_cast <float >(grid_x) * (item_width + item_spacing));
7036+ ImGui::SameLine (/* start_x + */ static_cast <float >(grid_x) * (item_width + item_spacing));
70167037 }
70177038
70187039 i++;
70197040 }
70207041
70217042 EndMenuButtons ();
7022- ImGui::EndChild ();
7023- }
7043+ // ImGui::EndChild();
7044+
70247045
70257046 ImGui::PopStyleColor ();
70267047
7048+ ImGuiFullscreen::EndPTR2PopupModal ();
70277049 ImGui::EndPopup ();
7028- ImGui::PopStyleVar (5 );
7050+ // ImGui::PopStyleVar(5);
70297051
70307052 if (!close_handled && WantsToCloseMenu ())
70317053 {
0 commit comments