42 lines
944 B
C++
42 lines
944 B
C++
// bullet_config.hpp - Configuració de la bala carregada des de YAML
|
|
// © 2026 JailDesigner
|
|
//
|
|
// Paral·lel a Player/EnemyConfig. Una sola instància a tot el joc (per ara);
|
|
// es comparteix entre totes les bales actives via BulletRegistry.
|
|
|
|
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
#include "external/fkyaml_node.hpp"
|
|
|
|
struct BulletConfig {
|
|
struct ShapeCfg {
|
|
std::string path;
|
|
float scale;
|
|
float collision_factor;
|
|
};
|
|
|
|
struct PhysicsCfg {
|
|
float mass;
|
|
float restitution;
|
|
float linear_damping;
|
|
float angular_damping;
|
|
float impact_momentum_factor; // factor de transferència bullet→enemic
|
|
};
|
|
|
|
struct ColorsCfg {
|
|
SDL_Color normal;
|
|
};
|
|
|
|
std::string name;
|
|
ShapeCfg shape;
|
|
PhysicsCfg physics;
|
|
ColorsCfg colors;
|
|
|
|
static auto fromYaml(const fkyaml::node& node) -> std::optional<BulletConfig>;
|
|
};
|