// player_config.hpp - Configuració de la nau del player carregada des de YAML // © 2026 JailDesigner // // POD struct amb sub-structs per organitzar els paràmetres del jugador // (física, invulnerabilitat, hurt, empenta visual, colors, weapon). Es // construeix a partir d'un node fkyaml carregat per EntityLoader. #pragma once #include #include #include #include "external/fkyaml_node.hpp" struct PlayerConfig { struct ShapeCfg { std::string path; float scale; // multiplicador visual + hitbox sobre la mida nativa del .shp float collision_factor; // ajust opcional del hitbox respecte el cercle circumscrit (default 1.0) }; struct PhysicsCfg { float mass; float restitution; float linear_damping; float angular_damping; float rotation_speed; // rad/s float acceleration; // px/s^2 multiplicat per la massa float max_velocity; // px/s (clamp post-integració) float death_impact_factor; // [0..1] moment transferit a l'enemic al morir }; struct InvulnerabilityCfg { float duration; float blink_visible; float blink_invisible; }; struct HurtCfg { float duration; float blink_hz; }; struct VisualThrustCfg { float push_divisor; float scale_divisor; }; struct ColorsCfg { SDL_Color normal; SDL_Color hurt; }; struct WeaponCfg { float bullet_speed; }; std::string name; ShapeCfg shape; PhysicsCfg physics; InvulnerabilityCfg invulnerability; HurtCfg hurt; VisualThrustCfg visual_thrust; ColorsCfg colors; WeaponCfg weapon; // Construeix un PlayerConfig a partir del node YAML. Retorna std::nullopt // si falten camps requerits o el format no és vàlid (el caller decideix // si abortar). static auto fromYaml(const fkyaml::node& node) -> std::optional; };