fix: Notifier centrado correcto en viewport (F3 letterbox)
Problema: - Notificaciones se centraban usando dimensión física de ventana - En modo letterbox (F3 INTEGER/LETTERBOX) aparecían en barras negras - Mismo issue que tenía Help Overlay Causa: - notifier.cpp:165 usaba `window_width_` para calcular centrado - En F3 letterbox: viewport visible < ventana física - Ejemplo: ventana 1920px, viewport 1280px con offset 320px - Resultado: notificación descentrada fuera del área visible Solución: - Obtener viewport con SDL_GetRenderViewport() antes de calcular posición - Usar `viewport.w` en lugar de `window_width_` para centrado - Coordenadas relativas al viewport, printAbsolute() aplica offset automáticamente Código modificado: - notifier.cpp:162-170 - Centrado usando viewport dimensions Resultado: ✅ Notificaciones centradas en área visible (viewport) ✅ No aparecen en barras negras en F3 ✅ Funciona correctamente en ventana, F3 y F4 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -159,10 +159,14 @@ void Notifier::render() {
|
|||||||
int bg_width = text_width + (NOTIFICATION_PADDING * 2);
|
int bg_width = text_width + (NOTIFICATION_PADDING * 2);
|
||||||
int bg_height = text_height + (NOTIFICATION_PADDING * 2);
|
int bg_height = text_height + (NOTIFICATION_PADDING * 2);
|
||||||
|
|
||||||
// Centrar en la ventana FÍSICA (no usar viewport lógico)
|
// Obtener viewport actual (en modo letterbox F3 tiene dimensiones más pequeñas)
|
||||||
// CRÍTICO: Como renderizamos en píxeles físicos absolutos (bypass de presentación lógica),
|
// CRÍTICO: Centrar usando dimensiones del VIEWPORT, no de la ventana física
|
||||||
// debemos centrar usando dimensiones físicas, no el viewport lógico de SDL
|
// printAbsolute() aplicará el offset del viewport automáticamente
|
||||||
int x = (window_width_ / 2) - (bg_width / 2);
|
SDL_Rect viewport;
|
||||||
|
SDL_GetRenderViewport(renderer_, &viewport);
|
||||||
|
|
||||||
|
// Centrar en el viewport (coordenadas relativas al viewport, no absolutas)
|
||||||
|
int x = (viewport.w / 2) - (bg_width / 2);
|
||||||
int y = NOTIFICATION_TOP_MARGIN + static_cast<int>(current_notification_->y_offset);
|
int y = NOTIFICATION_TOP_MARGIN + static_cast<int>(current_notification_->y_offset);
|
||||||
|
|
||||||
// Renderizar fondo semitransparente (con bypass de presentación lógica)
|
// Renderizar fondo semitransparente (con bypass de presentación lógica)
|
||||||
|
|||||||
Reference in New Issue
Block a user