7ee359b910
Sweep final del naming a CamelCase/camelBack/lower_case:
Fitxers renombrats:
- effects/gestor_puntuacio_flotant.{hpp,cpp} -> floating_score_manager.{hpp,cpp}
- effects/puntuacio_flotant.hpp -> floating_score.hpp
Tipus (CamelCase):
- GestorPuntuacioFlotant -> FloatingScoreManager
- PuntuacioFlotant -> FloatingScore
- ConfigStage -> StageConfig
- ConfigSistemaStages -> StageSystemConfig
- NauTitol -> TitleShip
- EstatNau -> ShipState
Metodes publics (camelBack):
- obte_renderer -> getRenderer
- get_num_actius -> getActiveCount
- calcular_direccio_explosio -> computeExplosionDirection
- trobar_slot_lliure -> findFreeSlot
- explotar -> explode
- reiniciar -> reset
- es_valida -> isValid
- parsejar_fitxer -> parseFile
- carregar -> load
- crear_explosio -> createExplosion
- registrar_puntuacio -> registerScore
- construir_marcador -> buildScoreboard
- render_centered -> renderCentered
Camps struct publics (snake_case):
- actiu/actius -> active
- rotacio -> rotation, rotacio_visual -> visual_rotation
- acceleracio -> acceleration
- velocitat -> velocity
- escala/escala_inicial/objectiu/actual -> scale/initial_scale/...
- posicio/posicio_inicial/objectiu/actual -> position/initial_position/...
- fase_oscilacio -> oscillation_phase
- temps_estat -> state_time
- jugador_id -> player_id
- estat -> state
- brillantor -> brightness
- tipus -> type
Camps privats (sufix _):
- naus_ -> ships_, orni_ -> enemies_, bales_ -> bullets_
- gestor_puntuacio_ -> floating_score_manager_
- punt_mort_ -> death_position_, punt_spawn_ -> spawn_position_
- itocado_per_jugador_ -> hit_timer_per_player_
- vides_per_jugador_ -> lives_per_player_
- puntuacio_per_jugador_ -> score_per_player_
- estat_game_over_ -> game_over_state_
- continues_usados_ -> continues_used_
Constants:
- MARGE_ESQ/DRET/DALT/BAIX -> MARGIN_LEFT/RIGHT/TOP/BOTTOM
Variables locals i parametres comuns (snake_case):
- nau -> ship, enemic -> enemy, bala -> bullet
- forma -> shape, punt(s) -> point(s)
- jugador -> player, partida -> match
- temps -> time, missatge -> message
Diff: 59 fitxers, +1000/-1000 (simetric). Compila i enllaça.
Pendents per a futures fases (no bloquejants):
- Comentaris de capçalera en catala -> castella
- Variables locals/parametres minoritaris en catala
- Include guards (queden alguns #ifndef en lloc de #pragma once)
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
53 lines
1.5 KiB
C++
53 lines
1.5 KiB
C++
// shape_renderer.hpp - Renderitzat de formes vectorials
|
|
// © 2025 Port a C++20 amb SDL3
|
|
|
|
#pragma once
|
|
|
|
#include <SDL3/SDL.h>
|
|
|
|
#include <memory>
|
|
|
|
#include "core/graphics/shape.hpp"
|
|
#include "core/types.hpp"
|
|
|
|
namespace Rendering {
|
|
|
|
// Estructura per rotacions 3D (pitch, yaw, roll)
|
|
struct Rotation3D {
|
|
float pitch; // Rotació eix X (cabeceo arriba/baix)
|
|
float yaw; // Rotació eix Y (guiñada esquerra/dreta)
|
|
float roll; // Rotació eix Z (alabeo lateral)
|
|
|
|
Rotation3D()
|
|
: pitch(0.0F),
|
|
yaw(0.0F),
|
|
roll(0.0F) {}
|
|
Rotation3D(float p, float y, float r)
|
|
: pitch(p),
|
|
yaw(y),
|
|
roll(r) {}
|
|
|
|
[[nodiscard]] bool has_rotation() const {
|
|
return pitch != 0.0F || yaw != 0.0F || roll != 0.0F;
|
|
}
|
|
};
|
|
|
|
// Renderitzar shape amb transformacions
|
|
// - renderer: SDL renderer
|
|
// - shape: shape vectorial a draw
|
|
// - position: posició del centre en coordenades mundials
|
|
// - angle: rotació en radians (0 = amunt, sentit horari)
|
|
// - scale: factor d'scale (1.0 = mida original)
|
|
// - progress: progrés de l'animació (0.0-1.0, default 1.0 = tot visible)
|
|
// - brightness: factor de brightness (0.0-1.0, default 1.0 = màxima brightness)
|
|
void render_shape(SDL_Renderer* renderer,
|
|
const std::shared_ptr<Graphics::Shape>& shape,
|
|
const Vec2& position,
|
|
float angle,
|
|
float scale = 1.0F,
|
|
float progress = 1.0F,
|
|
float brightness = 1.0F,
|
|
const Rotation3D* rotation_3d = nullptr);
|
|
|
|
} // namespace Rendering
|