@@ -318,6 +318,7 @@ def refresh_fonts(self):
318318 # Big font + more glyphs
319319 self .big_font = imgui .io .fonts .add_font_from_file_ttf (karla_path , size_28 , font_config = karla_config , glyph_ranges = karla_range )
320320 imgui .io .fonts .add_font_from_file_ttf ( noto_path , size_28 , font_config = noto_config , glyph_ranges = noto_range )
321+ imgui .io .fonts .add_font_from_file_ttf ( mdi_path , size_28 , font_config = mdi_config , glyph_ranges = mdi_range )
321322 # MsgBox type icons
322323 msgbox .icon_font = imgui .io .fonts .add_font_from_file_ttf (mdi_path , size_69 , glyph_ranges = msgbox_range )
323324 self .impl .refresh_font_texture ()
@@ -918,6 +919,8 @@ def popup_content():
918919 return utils .popup (f"{ count } update{ 's' if count > 1 else '' } " , popup_content , buttons = True , closable = True , outside = False )
919920
920921 def draw_game_info_popup (self , game : Game ):
922+ popup_pos = [None ]
923+ popup_size = [None ]
921924 def popup_content ():
922925 # Image
923926 image = game .image
@@ -1108,7 +1111,44 @@ def popup_content():
11081111
11091112 imgui .end_tab_bar ()
11101113 imgui .pop_text_wrap_pos ()
1111- return utils .popup ("Game info" , popup_content , closable = True , outside = True )
1114+ popup_pos [0 ] = imgui .get_window_position ()
1115+ popup_size [0 ] = imgui .get_window_size ()
1116+ return_args = utils .popup ("Game info" , popup_content , closable = True , outside = True )
1117+ if not imgui .is_any_item_active () and getattr (globals .popup_stack [- 1 ], "func" , None ) == self .draw_game_info_popup and game .id in self .sorted_games_ids :
1118+ imgui .push_font (self .big_font )
1119+ text_size = imgui .calc_text_size ("" )
1120+ offset = self .scaled (10 )
1121+ pos = popup_pos [0 ]
1122+ size = popup_size [0 ]
1123+ mouse_pos = imgui .get_mouse_pos ()
1124+ mouse_clicked = imgui .is_mouse_clicked ()
1125+ y = pos .y + (size .y + text_size .y ) / 2
1126+ x1 = pos .x - offset - text_size .x
1127+ x2 = pos .x + size .x + offset
1128+ draw_list = imgui .get_foreground_draw_list ()
1129+ col = imgui .get_color_u32_rgba (* globals .settings .style_text_dim )
1130+ draw_list .add_text (x1 , y , col , "" )
1131+ draw_list .add_text (x2 , y , col , "" )
1132+ y_ok = y <= mouse_pos .y <= y + text_size .y
1133+ clicked_left = mouse_clicked and x1 <= mouse_pos .x <= x1 + text_size .x and y_ok
1134+ clicked_right = mouse_clicked and x2 <= mouse_pos .x <= x2 + text_size .x and y_ok
1135+ imgui .pop_font ()
1136+ change_id = None
1137+ idx = self .sorted_games_ids .index (game .id )
1138+ if imgui .is_key_pressed (glfw .KEY_LEFT ) or clicked_left :
1139+ idx -= 1
1140+ if idx == - 1 :
1141+ idx = len (self .sorted_games_ids ) - 1
1142+ change_id = self .sorted_games_ids [idx ]
1143+ if imgui .is_key_pressed (glfw .KEY_RIGHT ) or clicked_right :
1144+ idx += 1
1145+ if idx == len (self .sorted_games_ids ):
1146+ idx = 0
1147+ change_id = self .sorted_games_ids [idx ]
1148+ if change_id is not None :
1149+ utils .push_popup (self .draw_game_info_popup , globals .games [change_id ])
1150+ return 1 , True
1151+ return return_args
11121152
11131153 def draw_about_popup (self ):
11141154 def popup_content ():
0 commit comments