forked from Mirrors/RGSX
Correction de l'erreur de police non initialisée et mise à jour de display.py
This commit is contained in:
@@ -46,8 +46,9 @@ REPEAT_DELAY = 300 # Délai initial avant répétition (ms)
|
||||
REPEAT_INTERVAL = 100 # Intervalle entre répétitions (ms)
|
||||
REPEAT_ACTION_DEBOUNCE = 50 # Délai anti-rebond pour répétitions (ms)
|
||||
|
||||
# Initialisation de Pygame
|
||||
# Initialisation de Pygame et des polices
|
||||
pygame.init()
|
||||
config.init_font()
|
||||
pygame.joystick.init()
|
||||
pygame.mouse.set_visible(True)
|
||||
|
||||
|
||||
44
config.py
44
config.py
@@ -7,7 +7,6 @@ logger = logging.getLogger(__name__)
|
||||
# Version actuelle de l'application
|
||||
app_version = "1.4.0"
|
||||
|
||||
|
||||
# Variables d'état
|
||||
platforms = []
|
||||
current_platform = 0
|
||||
@@ -50,27 +49,48 @@ previous_menu_state = None
|
||||
# Résolution de l'écran
|
||||
screen_width = 800
|
||||
screen_height = 600
|
||||
|
||||
# Polices
|
||||
progress_font = None
|
||||
title_font = None
|
||||
search_font = None
|
||||
small_font = None
|
||||
|
||||
|
||||
SCREEN_WIDTH = 800
|
||||
"""Largeur de l'écran en pixels."""
|
||||
SCREEN_HEIGHT = 600
|
||||
"""Hauteur de l'écran en pixels."""
|
||||
FONT = pygame.font.Font(None, 36)
|
||||
"""Police par défaut pour l'affichage."""
|
||||
|
||||
# Polices
|
||||
FONT = None
|
||||
"""Police par défaut pour l'affichage, initialisée via init_font()."""
|
||||
progress_font = None
|
||||
"""Police pour l'affichage de la progression."""
|
||||
title_font = None
|
||||
"""Police pour les titres."""
|
||||
search_font = None
|
||||
"""Police pour la recherche."""
|
||||
small_font = None
|
||||
"""Police pour les petits textes."""
|
||||
|
||||
CONTROLS_CONFIG_PATH = "/userdata/saves/ports/rgsx/controls.json"
|
||||
"""Chemin du fichier de configuration des contrôles."""
|
||||
|
||||
def init_font():
|
||||
"""Initialise les polices après pygame.init()."""
|
||||
global FONT, progress_font, title_font, search_font, small_font
|
||||
try:
|
||||
FONT = pygame.font.Font(None, 36)
|
||||
progress_font = pygame.font.Font(None, 28)
|
||||
title_font = pygame.font.Font(None, 48)
|
||||
search_font = pygame.font.Font(None, 36)
|
||||
small_font = pygame.font.Font(None, 24)
|
||||
logger.debug("Polices initialisées avec succès")
|
||||
except pygame.error as e:
|
||||
logger.error(f"Erreur lors de l'initialisation des polices : {e}")
|
||||
FONT = None
|
||||
progress_font = None
|
||||
title_font = None
|
||||
search_font = None
|
||||
small_font = None
|
||||
|
||||
def validate_resolution():
|
||||
"""Valide la résolution de l'écran par rapport aux capacités du matériel."""
|
||||
display_info = pygame.display.Info()
|
||||
if SCREEN_WIDTH > display_info.current_w or SCREEN_HEIGHT > display_info.current_h:
|
||||
logging.warning(f"Résolution {SCREEN_WIDTH}x{SCREEN_HEIGHT} dépasse les limites de l'écran")
|
||||
logger.warning(f"Résolution {SCREEN_WIDTH}x{SCREEN_HEIGHT} dépasse les limites de l'écran")
|
||||
return display_info.current_w, display_info.current_h
|
||||
return SCREEN_WIDTH, SCREEN_HEIGHT
|
||||
Reference in New Issue
Block a user