Implementar modo real fullscreen y resolver conflictos

MODO REAL FULLSCREEN (F4):
- F4: Cambia resolución interna a resolución nativa del escritorio
- Pelotas usan dimensiones dinámicas del terreno de juego
- Interfaz se adapta automáticamente (texto, debug, gradiente)
- Reinicio automático de escena con nuevas dimensiones

RESOLUCIÓN DINÁMICA:
- Ball constructor acepta screen_width/height como parámetros
- Colisiones usan dimensiones dinámicas en lugar de constantes
- Spawn de pelotas usa margen configurable (BALL_SPAWN_MARGIN)
- Toda la interfaz se adapta a resolución actual

MODOS FULLSCREEN MUTUAMENTE EXCLUYENTES:
- F3 (fullscreen normal) y F4 (real fullscreen) se desactivan mutuamente
- F1/F2 (zoom) bloqueados durante cualquier modo fullscreen
- Sin estados mixtos que rompan el renderizado
- Transiciones seguras entre todos los modos

MEJORAS DE CONFIGURACIÓN:
- BALL_SPAWN_MARGIN: margen lateral configurable para spawn de pelotas
- Resolución base actualizada a 640x360 (16:9)
- Spawn margin reducido a 15% para mayor dispersión

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

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-09-18 19:20:02 +02:00
parent 9908165104
commit 7b24e387b7
5 changed files with 117 additions and 38 deletions

View File

@@ -22,7 +22,7 @@ float generateLateralLoss() {
}
// Constructor
Ball::Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> texture, GravityDirection gravity_dir, float mass_factor)
Ball::Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> texture, int screen_width, int screen_height, GravityDirection gravity_dir, float mass_factor)
: sprite_(std::make_unique<Sprite>(texture)),
pos_({x, 0.0f, BALL_SIZE, BALL_SIZE}) {
// Convertir velocidades de píxeles/frame a píxeles/segundo (multiplicar por 60)
@@ -36,6 +36,8 @@ Ball::Ball(float x, float vx, float vy, Color color, std::shared_ptr<Texture> te
gravity_force_ = GRAVITY_FORCE * 60.0f * 60.0f;
gravity_mass_factor_ = mass_factor; // Factor de masa individual para esta pelota
gravity_direction_ = gravity_dir;
screen_width_ = screen_width; // Dimensiones del terreno de juego
screen_height_ = screen_height;
on_surface_ = false;
stopped_ = false;
// Coeficiente base IGUAL para todas las pelotas (solo variación por rebote individual)
@@ -76,7 +78,7 @@ void Ball::update(float deltaTime) {
// Si está en superficie, mantener posición según dirección de gravedad
switch (gravity_direction_) {
case GravityDirection::DOWN:
pos_.y = SCREEN_HEIGHT - pos_.h;
pos_.y = screen_height_ - pos_.h;
pos_.x += vx_ * deltaTime; // Seguir moviéndose en X
break;
case GravityDirection::UP:
@@ -88,7 +90,7 @@ void Ball::update(float deltaTime) {
pos_.y += vy_ * deltaTime; // Seguir moviéndose en Y
break;
case GravityDirection::RIGHT:
pos_.x = SCREEN_WIDTH - pos_.w;
pos_.x = screen_width_ - pos_.w;
pos_.y += vy_ * deltaTime; // Seguir moviéndose en Y
break;
}
@@ -113,8 +115,8 @@ void Ball::update(float deltaTime) {
}
// Comprueba las colisiones con el lateral derecho
if (pos_.x + pos_.w > SCREEN_WIDTH) {
pos_.x = SCREEN_WIDTH - pos_.w;
if (pos_.x + pos_.w > screen_width_) {
pos_.x = screen_width_ - pos_.w;
if (gravity_direction_ == GravityDirection::RIGHT) {
// Colisión con superficie de gravedad - aplicar variación aleatoria
vx_ = -vx_ * loss_ * generateBounceVariation();
@@ -149,8 +151,8 @@ void Ball::update(float deltaTime) {
}
// Comprueba las colisiones con la parte inferior
if (pos_.y + pos_.h > SCREEN_HEIGHT) {
pos_.y = SCREEN_HEIGHT - pos_.h;
if (pos_.y + pos_.h > screen_height_) {
pos_.y = screen_height_ - pos_.h;
if (gravity_direction_ == GravityDirection::DOWN) {
// Colisión con superficie de gravedad - aplicar variación aleatoria
vy_ = -vy_ * loss_ * generateBounceVariation();