Implementar toggle de escalado INTEGER/STRETCH en fullscreen (F5)

Funcionalidad:
- Tecla F5 alterna entre escalado INTEGER y STRETCH
- Solo activo en modo fullscreen F3 (no aplica en F4)
- INTEGER: Mantiene aspecto 4:3 con bandas negras
- STRETCH: Estira imagen a pantalla completa
- Texto informativo: 'SCALING: INTEGER' o 'SCALING: STRETCH'

Implementación:
- Variable integer_scaling_enabled_ (true por defecto)
- toggleIntegerScaling() cambia SDL_RendererLogicalPresentation
- Solo funciona si fullscreen_enabled_ == true
- Ignora la tecla si no estás en modo F3

README actualizado:
- Añadida tecla F5 en controles de ventana
- Actualizada descripción de F3
- Nueva característica en lista principal

Comportamiento:
- Por defecto: INTEGER (mantiene aspecto)
- Presionar F5: Cambia a STRETCH (pantalla completa)
- Presionar F5 otra vez: Vuelve a INTEGER

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-10-04 08:38:41 +02:00
parent 3be3833e55
commit 59c5ebe9be
3 changed files with 33 additions and 2 deletions

View File

@@ -463,6 +463,11 @@ void Engine::handleEvents() {
case SDLK_F4:
toggleRealFullscreen();
break;
// Toggle escalado entero/estirado (solo en fullscreen F3)
case SDLK_F5:
toggleIntegerScaling();
break;
}
}
}
@@ -784,6 +789,28 @@ void Engine::toggleRealFullscreen() {
}
}
void Engine::toggleIntegerScaling() {
// Solo permitir cambio si estamos en modo fullscreen normal (F3)
if (!fullscreen_enabled_) {
return; // No hacer nada si no estamos en fullscreen
}
integer_scaling_enabled_ = !integer_scaling_enabled_;
// Aplicar el nuevo modo de escalado
SDL_RendererLogicalPresentation presentation = integer_scaling_enabled_
? SDL_LOGICAL_PRESENTATION_INTEGER_SCALE
: SDL_LOGICAL_PRESENTATION_STRETCH;
SDL_SetRenderLogicalPresentation(renderer_, SCREEN_WIDTH, SCREEN_HEIGHT, presentation);
// Mostrar texto informativo
text_ = integer_scaling_enabled_ ? "SCALING: INTEGER" : "SCALING: STRETCH";
text_pos_ = (current_screen_width_ - static_cast<int>(text_.length() * 8)) / 2;
show_text_ = true;
text_init_time_ = SDL_GetTicks();
}
std::string Engine::gravityDirectionToString(GravityDirection direction) const {
switch (direction) {
case GravityDirection::DOWN: return "DOWN";