Lint: rename públicos al inglés + refactor cognitive-complexity + unused-includes
Identifier-naming: rename de métodos públicos y cross-file al inglés
(camelBack), traducción de campos y locales en el proceso (TitleShip,
StageManager, SpawnController, ShipAnimator, helpers de PlayArea, etc.).
Refactor por cognitive-complexity (>25): GameScene::draw (59→3) con 9
helpers de estado, PhysicsWorld::resolveBodyCollisions (35→5) extrayendo
resolveBodyPair, Options::load{Window,Physics,Audio}ConfigFromYaml
(32/49/57→5/2/3) con templates readField, TitleScene::update (68→4) con
5 sub-pasos por estado + handleSkipInput/handleStartInput +
triggerExitForJoinedPlayers, DebrisManager::explode (39→3) con
extractSegments/spawnDebris/applyAngularVelocity/applyVisualRotation.
use-anyofallof: bucles → std::ranges::any_of/all_of en Input,
ShipAnimator y SpawnController.
readability-static-accessed-through-instance: Director::run y
VectorText::getTextWidth/Height invocados por clase.
readability-convert-member-functions-to-static: ResourcePack::decryptData.
unused-includes: eliminación de <utility>, <cstdint>, <vector>,
<iostream>, defaults.hpp y otros no usados directamente en headers y
unidades de traducción. Restablecido core/defaults.hpp en title_scene.cpp
(falsa "unused" del header).
Bug fix: eliminado isActive() duplicado en Bullet (redeclaración tras
rename de esta_activa→isActive que chocaba con el override de Entity).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -11,21 +11,21 @@ namespace Rendering {
|
||||
extern float g_current_scale_factor;
|
||||
|
||||
// Transforma coordenada lógica a física con arrodoniment
|
||||
inline auto transform_x(int logical_x, float scale) -> int {
|
||||
inline auto transformX(int logical_x, float scale) -> int {
|
||||
return static_cast<int>(std::round(logical_x * scale));
|
||||
}
|
||||
|
||||
inline auto transform_y(int logical_y, float scale) -> int {
|
||||
inline auto transformY(int logical_y, float scale) -> int {
|
||||
return static_cast<int>(std::round(logical_y * scale));
|
||||
}
|
||||
|
||||
// Variant que usa el factor de scale global
|
||||
inline auto transform_x(int logical_x) -> int {
|
||||
return transform_x(logical_x, g_current_scale_factor);
|
||||
inline auto transformX(int logical_x) -> int {
|
||||
return transformX(logical_x, g_current_scale_factor);
|
||||
}
|
||||
|
||||
inline auto transform_y(int logical_y) -> int {
|
||||
return transform_y(logical_y, g_current_scale_factor);
|
||||
inline auto transformY(int logical_y) -> int {
|
||||
return transformY(logical_y, g_current_scale_factor);
|
||||
}
|
||||
|
||||
} // namespace Rendering
|
||||
|
||||
@@ -362,7 +362,7 @@ void GpuFrameRenderer::compositePass() {
|
||||
ubo.flicker_amplitude = FLICKER_AMPLITUDE;
|
||||
ubo.flicker_frequency_hz = postfx_params_.flicker_frequency_hz;
|
||||
ubo.background_pulse_freq_hz = postfx_params_.background_pulse_freq_hz;
|
||||
ubo.pad_a_ = 0.0F;
|
||||
ubo.pad_a = 0.0F;
|
||||
ubo.background_min_r = BG_MIN_R;
|
||||
ubo.background_min_g = BG_MIN_G;
|
||||
ubo.background_min_b = BG_MIN_B;
|
||||
@@ -373,8 +373,8 @@ void GpuFrameRenderer::compositePass() {
|
||||
ubo.background_max_a = 1.0F;
|
||||
ubo.texel_size_x = 1.0F / logical_w_;
|
||||
ubo.texel_size_y = 1.0F / logical_h_;
|
||||
ubo.pad_b_ = 0.0F;
|
||||
ubo.pad_c_ = 0.0F;
|
||||
ubo.pad_b = 0.0F;
|
||||
ubo.pad_c = 0.0F;
|
||||
|
||||
SDL_PushGPUFragmentUniformData(cmd_buffer_, 0, &ubo, sizeof(ubo));
|
||||
|
||||
|
||||
@@ -9,8 +9,6 @@
|
||||
|
||||
#include <SDL3/SDL_gpu.h>
|
||||
|
||||
#include <cstdint>
|
||||
|
||||
namespace Rendering::GPU {
|
||||
|
||||
class GpuDevice;
|
||||
|
||||
@@ -29,7 +29,7 @@ struct PostFxUniforms {
|
||||
float flicker_amplitude; // Profundidad del flicker (0..1)
|
||||
float flicker_frequency_hz; // Hz
|
||||
float background_pulse_freq_hz; // Hz
|
||||
float pad_a_;
|
||||
float pad_a;
|
||||
|
||||
float background_min_r; // Color min RGB en [0..1], A=1
|
||||
float background_min_g;
|
||||
@@ -43,8 +43,8 @@ struct PostFxUniforms {
|
||||
|
||||
float texel_size_x; // 1.0 / texture_width
|
||||
float texel_size_y;
|
||||
float pad_b_;
|
||||
float pad_c_;
|
||||
float pad_b;
|
||||
float pad_c;
|
||||
};
|
||||
|
||||
class GpuPostFxPipeline {
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/input/mouse.hpp"
|
||||
#include "core/rendering/coordinate_transform.hpp"
|
||||
#include "core/rendering/line_renderer.hpp"
|
||||
#include "game/options.hpp"
|
||||
#include "project.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "core/defaults.hpp"
|
||||
#include "core/rendering/line_renderer.hpp"
|
||||
|
||||
namespace Rendering {
|
||||
@@ -48,7 +47,7 @@ static auto transformPoint(const Vec2& point, const Vec2& shape_centre, const Ve
|
||||
float centered_y = point.y - shape_centre.y;
|
||||
|
||||
// 2. Aplicar rotación 3D (si es proporciona)
|
||||
if ((rotation_3d != nullptr) && rotation_3d->has_rotation()) {
|
||||
if ((rotation_3d != nullptr) && rotation_3d->hasRotation()) {
|
||||
Vec2 rotated_3d = apply3dRotation(centered_x, centered_y, *rotation_3d);
|
||||
centered_x = rotated_3d.x;
|
||||
centered_y = rotated_3d.y;
|
||||
@@ -72,7 +71,7 @@ static auto transformPoint(const Vec2& point, const Vec2& shape_centre, const Ve
|
||||
return {.x = rotated_x + position.x, .y = rotated_y + position.y};
|
||||
}
|
||||
|
||||
void render_shape(Rendering::Renderer* renderer,
|
||||
void renderShape(Rendering::Renderer* renderer,
|
||||
const std::shared_ptr<Graphics::Shape>& shape,
|
||||
const Vec2& position,
|
||||
float angle,
|
||||
@@ -90,7 +89,7 @@ void render_shape(Rendering::Renderer* renderer,
|
||||
|
||||
const Vec2& shape_centre = shape->getCenter();
|
||||
|
||||
for (const auto& primitive : shape->get_primitives()) {
|
||||
for (const auto& primitive : shape->getPrimitives()) {
|
||||
if (primitive.type == Graphics::PrimitiveType::POLYLINE) {
|
||||
// POLYLINE: conectar puntos consecutivos.
|
||||
for (size_t i = 0; i < primitive.points.size() - 1; i++) {
|
||||
|
||||
@@ -29,7 +29,7 @@ struct Rotation3D {
|
||||
yaw(y),
|
||||
roll(r) {}
|
||||
|
||||
[[nodiscard]] auto has_rotation() const -> bool {
|
||||
[[nodiscard]] auto hasRotation() const -> bool {
|
||||
return pitch != 0.0F || yaw != 0.0F || roll != 0.0F;
|
||||
}
|
||||
};
|
||||
@@ -42,7 +42,7 @@ struct Rotation3D {
|
||||
// - scale: factor de scale (1.0 = mida original)
|
||||
// - progress: progrés de l'animación (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(Rendering::Renderer* renderer,
|
||||
void renderShape(Rendering::Renderer* renderer,
|
||||
const std::shared_ptr<Graphics::Shape>& shape,
|
||||
const Vec2& position,
|
||||
float angle,
|
||||
|
||||
Reference in New Issue
Block a user