From a9d7b66e8328bd82a6dadeb8f73d4900a1da6c9d Mon Sep 17 00:00:00 2001 From: Sergio Valor Date: Thu, 23 Oct 2025 13:49:58 +0200 Subject: [PATCH] =?UTF-8?q?Refactorizar=20estilo=20del=20proyecto:=20.h=20?= =?UTF-8?q?=E2=86=92=20.hpp,=20#pragma=20once,=20includes=20desde=20ra?= =?UTF-8?q?=C3=ADz?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Modernizar convenciones de código C++ aplicando las siguientes directivas: ## Cambios principales **1. Renombrar headers (.h → .hpp)** - 36 archivos renombrados a extensión .hpp (estándar C++) - Mantenidos como .h: stb_image.h, stb_image_resize2.h (librerías C externas) **2. Modernizar include guards (#ifndef → #pragma once)** - resource_manager.hpp: #ifndef RESOURCE_MANAGER_H → #pragma once - resource_pack.hpp: #ifndef RESOURCE_PACK_H → #pragma once - spatial_grid.hpp: #ifndef SPATIAL_GRID_H → #pragma once **3. Sistema de includes desde raíz del proyecto** - CMakeLists.txt: añadido include_directories(${CMAKE_SOURCE_DIR}/source) - Eliminadas rutas relativas (../) en todos los includes - Includes ahora usan rutas absolutas desde source/ **Antes:** ```cpp #include "../defines.h" #include "../text/textrenderer.h" ``` **Ahora:** ```cpp #include "defines.hpp" #include "text/textrenderer.hpp" ``` ## Archivos afectados - 1 archivo CMakeLists.txt modificado - 36 archivos renombrados (.h → .hpp) - 32 archivos .cpp actualizados (includes) - 36 archivos .hpp actualizados (includes + guards) - 1 archivo tools/ actualizado **Total: 70 archivos modificados** ## Verificación ✅ Proyecto compila sin errores ✅ Todas las rutas de includes correctas ✅ Include guards modernizados ✅ Librerías externas C mantienen extensión .h 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- CMakeLists.txt | 3 ++ source/app_logo.cpp | 6 ++-- source/{app_logo.h => app_logo.hpp} | 2 +- source/ball.cpp | 4 +-- source/{ball.h => ball.hpp} | 4 +-- source/boids_mgr/boid_manager.cpp | 12 ++++---- .../{boid_manager.h => boid_manager.hpp} | 4 +-- source/{defines.h => defines.hpp} | 0 source/engine.cpp | 28 ++++++++--------- source/{engine.h => engine.hpp} | 24 +++++++-------- source/external/mouse.cpp | 2 +- source/external/{mouse.h => mouse.hpp} | 0 source/external/sprite.cpp | 4 +-- source/external/{sprite.h => sprite.hpp} | 0 source/external/texture.cpp | 4 +-- source/external/{texture.h => texture.hpp} | 0 source/input/input_handler.cpp | 6 ++-- .../{input_handler.h => input_handler.hpp} | 0 source/logo_scaler.cpp | 4 +-- source/{logo_scaler.h => logo_scaler.hpp} | 0 source/main.cpp | 6 ++-- source/resource_manager.cpp | 4 +-- ...esource_manager.h => resource_manager.hpp} | 5 +--- source/resource_pack.cpp | 2 +- source/{resource_pack.h => resource_pack.hpp} | 5 +--- source/scene/scene_manager.cpp | 8 ++--- .../{scene_manager.h => scene_manager.hpp} | 4 +-- source/shapes/atom_shape.cpp | 4 +-- .../shapes/{atom_shape.h => atom_shape.hpp} | 2 +- source/shapes/cube_shape.cpp | 4 +-- .../shapes/{cube_shape.h => cube_shape.hpp} | 2 +- source/shapes/cylinder_shape.cpp | 4 +-- .../{cylinder_shape.h => cylinder_shape.hpp} | 2 +- source/shapes/helix_shape.cpp | 4 +-- .../shapes/{helix_shape.h => helix_shape.hpp} | 2 +- source/shapes/icosahedron_shape.cpp | 4 +-- ...sahedron_shape.h => icosahedron_shape.hpp} | 2 +- source/shapes/lissajous_shape.cpp | 4 +-- ...{lissajous_shape.h => lissajous_shape.hpp} | 2 +- source/shapes/png_shape.cpp | 6 ++-- source/shapes/{png_shape.h => png_shape.hpp} | 4 +-- source/shapes/{shape.h => shape.hpp} | 0 source/shapes/sphere_shape.cpp | 4 +-- .../{sphere_shape.h => sphere_shape.hpp} | 2 +- source/shapes/torus_shape.cpp | 4 +-- .../shapes/{torus_shape.h => torus_shape.hpp} | 2 +- source/shapes_mgr/shape_manager.cpp | 30 +++++++++---------- .../{shape_manager.h => shape_manager.hpp} | 4 +-- source/spatial_grid.cpp | 4 +-- source/{spatial_grid.h => spatial_grid.hpp} | 5 +--- source/state/state_manager.cpp | 8 ++--- .../{state_manager.h => state_manager.hpp} | 2 +- source/text/textrenderer.cpp | 4 +-- .../text/{textrenderer.h => textrenderer.hpp} | 0 source/theme_manager.cpp | 6 ++-- source/{theme_manager.h => theme_manager.hpp} | 8 ++--- source/themes/dynamic_theme.cpp | 2 +- .../{dynamic_theme.h => dynamic_theme.hpp} | 2 +- source/themes/static_theme.cpp | 2 +- .../{static_theme.h => static_theme.hpp} | 2 +- source/themes/{theme.h => theme.hpp} | 2 +- .../{theme_snapshot.h => theme_snapshot.hpp} | 2 +- source/ui/help_overlay.cpp | 8 ++--- .../ui/{help_overlay.h => help_overlay.hpp} | 0 source/ui/notifier.cpp | 10 +++---- source/ui/{notifier.h => notifier.hpp} | 0 source/ui/ui_manager.cpp | 20 ++++++------- source/ui/{ui_manager.h => ui_manager.hpp} | 0 ...asing_functions.h => easing_functions.hpp} | 0 tools/pack_resources.cpp | 2 +- 70 files changed, 158 insertions(+), 164 deletions(-) rename source/{app_logo.h => app_logo.hpp} (99%) rename source/{ball.h => ball.hpp} (98%) rename source/boids_mgr/{boid_manager.h => boid_manager.hpp} (97%) rename source/{defines.h => defines.hpp} (100%) rename source/{engine.h => engine.hpp} (93%) rename source/external/{mouse.h => mouse.hpp} (100%) rename source/external/{sprite.h => sprite.hpp} (100%) rename source/external/{texture.h => texture.hpp} (100%) rename source/input/{input_handler.h => input_handler.hpp} (100%) rename source/{logo_scaler.h => logo_scaler.hpp} (100%) rename source/{resource_manager.h => resource_manager.hpp} (96%) rename source/{resource_pack.h => resource_pack.hpp} (96%) rename source/scene/{scene_manager.h => scene_manager.hpp} (98%) rename source/shapes/{atom_shape.h => atom_shape.hpp} (97%) rename source/shapes/{cube_shape.h => cube_shape.hpp} (98%) rename source/shapes/{cylinder_shape.h => cylinder_shape.hpp} (98%) rename source/shapes/{helix_shape.h => helix_shape.hpp} (98%) rename source/shapes/{icosahedron_shape.h => icosahedron_shape.hpp} (98%) rename source/shapes/{lissajous_shape.h => lissajous_shape.hpp} (98%) rename source/shapes/{png_shape.h => png_shape.hpp} (98%) rename source/shapes/{shape.h => shape.hpp} (100%) rename source/shapes/{sphere_shape.h => sphere_shape.hpp} (97%) rename source/shapes/{torus_shape.h => torus_shape.hpp} (98%) rename source/shapes_mgr/{shape_manager.h => shape_manager.hpp} (97%) rename source/{spatial_grid.h => spatial_grid.hpp} (97%) rename source/state/{state_manager.h => state_manager.hpp} (98%) rename source/text/{textrenderer.h => textrenderer.hpp} (100%) rename source/{theme_manager.h => theme_manager.hpp} (95%) rename source/themes/{dynamic_theme.h => dynamic_theme.hpp} (99%) rename source/themes/{static_theme.h => static_theme.hpp} (99%) rename source/themes/{theme.h => theme.hpp} (98%) rename source/themes/{theme_snapshot.h => theme_snapshot.hpp} (97%) rename source/ui/{help_overlay.h => help_overlay.hpp} (100%) rename source/ui/{notifier.h => notifier.hpp} (100%) rename source/ui/{ui_manager.h => ui_manager.hpp} (100%) rename source/utils/{easing_functions.h => easing_functions.hpp} (100%) diff --git a/CMakeLists.txt b/CMakeLists.txt index d8fdd3a..7631f6a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -48,6 +48,9 @@ endif() # Incluir directorios de SDL3 y SDL3_ttf include_directories(${SDL3_INCLUDE_DIRS} ${SDL3_ttf_INCLUDE_DIRS}) +# Incluir directorio source/ para poder usar includes desde la raíz del proyecto +include_directories(${CMAKE_SOURCE_DIR}/source) + # Añadir el ejecutable reutilizando el nombre del proyecto add_executable(${PROJECT_NAME} ${SOURCE_FILES}) diff --git a/source/app_logo.cpp b/source/app_logo.cpp index 9b1dc9d..eaf83d5 100644 --- a/source/app_logo.cpp +++ b/source/app_logo.cpp @@ -1,12 +1,12 @@ -#include "app_logo.h" +#include "app_logo.hpp" #include // for SDL_DestroyTexture, SDL_RenderGeometry, SDL_SetTextureAlphaMod #include // for powf, sinf, cosf #include // for free() #include // for std::cout -#include "logo_scaler.h" // for LogoScaler -#include "defines.h" // for APPLOGO_HEIGHT_PERCENT, getResourcesDirectory +#include "logo_scaler.hpp" // for LogoScaler +#include "defines.hpp" // for APPLOGO_HEIGHT_PERCENT, getResourcesDirectory // ============================================================================ // Destructor - Liberar las 4 texturas SDL diff --git a/source/app_logo.h b/source/app_logo.hpp similarity index 99% rename from source/app_logo.h rename to source/app_logo.hpp index e19e8b9..81617ef 100644 --- a/source/app_logo.h +++ b/source/app_logo.hpp @@ -4,7 +4,7 @@ #include // for unique_ptr, shared_ptr -#include "defines.h" // for AppMode +#include "defines.hpp" // for AppMode class Texture; class Sprite; diff --git a/source/ball.cpp b/source/ball.cpp index 7569fa9..e688a9a 100644 --- a/source/ball.cpp +++ b/source/ball.cpp @@ -1,10 +1,10 @@ -#include "ball.h" +#include "ball.hpp" #include // for rand #include // for fabs -#include "defines.h" // for Color, SCREEN_HEIGHT, GRAVITY_FORCE +#include "defines.hpp" // for Color, SCREEN_HEIGHT, GRAVITY_FORCE class Texture; // Función auxiliar para generar pérdida aleatoria en rebotes diff --git a/source/ball.h b/source/ball.hpp similarity index 98% rename from source/ball.h rename to source/ball.hpp index 432e3ac..b0e43ff 100644 --- a/source/ball.h +++ b/source/ball.hpp @@ -4,8 +4,8 @@ #include // for shared_ptr, unique_ptr -#include "defines.h" // for Color -#include "external/sprite.h" // for Sprite +#include "defines.hpp" // for Color +#include "external/sprite.hpp" // for Sprite class Texture; class Ball { diff --git a/source/boids_mgr/boid_manager.cpp b/source/boids_mgr/boid_manager.cpp index e4928f1..a1711ee 100644 --- a/source/boids_mgr/boid_manager.cpp +++ b/source/boids_mgr/boid_manager.cpp @@ -1,13 +1,13 @@ -#include "boid_manager.h" +#include "boid_manager.hpp" #include // for std::min, std::max #include // for sqrt, atan2 -#include "../ball.h" // for Ball -#include "../engine.h" // for Engine (si se necesita) -#include "../scene/scene_manager.h" // for SceneManager -#include "../state/state_manager.h" // for StateManager -#include "../ui/ui_manager.h" // for UIManager +#include "ball.hpp" // for Ball +#include "engine.hpp" // for Engine (si se necesita) +#include "scene/scene_manager.hpp" // for SceneManager +#include "state/state_manager.hpp" // for StateManager +#include "ui/ui_manager.hpp" // for UIManager BoidManager::BoidManager() : engine_(nullptr) diff --git a/source/boids_mgr/boid_manager.h b/source/boids_mgr/boid_manager.hpp similarity index 97% rename from source/boids_mgr/boid_manager.h rename to source/boids_mgr/boid_manager.hpp index 50241dc..16d1c99 100644 --- a/source/boids_mgr/boid_manager.h +++ b/source/boids_mgr/boid_manager.hpp @@ -2,8 +2,8 @@ #include // for size_t -#include "../defines.h" // for SimulationMode, AppMode -#include "../spatial_grid.h" // for SpatialGrid +#include "defines.hpp" // for SimulationMode, AppMode +#include "spatial_grid.hpp" // for SpatialGrid // Forward declarations class Engine; diff --git a/source/defines.h b/source/defines.hpp similarity index 100% rename from source/defines.h rename to source/defines.hpp diff --git a/source/engine.cpp b/source/engine.cpp index dc7c1bb..f8d7ba7 100644 --- a/source/engine.cpp +++ b/source/engine.cpp @@ -1,4 +1,4 @@ -#include "engine.h" +#include "engine.hpp" #include // for SDL_GetError #include // for SDL_Event, SDL_PollEvent @@ -17,24 +17,24 @@ #include // for cout #include // for string -#include "resource_manager.h" // for ResourceManager +#include "resource_manager.hpp" // for ResourceManager #ifdef _WIN32 #include // for GetModuleFileName #endif -#include "ball.h" // for Ball -#include "external/mouse.h" // for Mouse namespace -#include "external/texture.h" // for Texture -#include "shapes/atom_shape.h" // for AtomShape -#include "shapes/cube_shape.h" // for CubeShape -#include "shapes/cylinder_shape.h" // for CylinderShape -#include "shapes/helix_shape.h" // for HelixShape -#include "shapes/icosahedron_shape.h" // for IcosahedronShape -#include "shapes/lissajous_shape.h" // for LissajousShape -#include "shapes/png_shape.h" // for PNGShape -#include "shapes/sphere_shape.h" // for SphereShape -#include "shapes/torus_shape.h" // for TorusShape +#include "ball.hpp" // for Ball +#include "external/mouse.hpp" // for Mouse namespace +#include "external/texture.hpp" // for Texture +#include "shapes/atom_shape.hpp" // for AtomShape +#include "shapes/cube_shape.hpp" // for CubeShape +#include "shapes/cylinder_shape.hpp" // for CylinderShape +#include "shapes/helix_shape.hpp" // for HelixShape +#include "shapes/icosahedron_shape.hpp" // for IcosahedronShape +#include "shapes/lissajous_shape.hpp" // for LissajousShape +#include "shapes/png_shape.hpp" // for PNGShape +#include "shapes/sphere_shape.hpp" // for SphereShape +#include "shapes/torus_shape.hpp" // for TorusShape // getExecutableDirectory() ya está definido en defines.h como inline diff --git a/source/engine.h b/source/engine.hpp similarity index 93% rename from source/engine.h rename to source/engine.hpp index 6ffc418..9c9ea95 100644 --- a/source/engine.h +++ b/source/engine.hpp @@ -10,18 +10,18 @@ #include // for string #include // for vector -#include "app_logo.h" // for AppLogo -#include "ball.h" // for Ball -#include "boids_mgr/boid_manager.h" // for BoidManager -#include "defines.h" // for GravityDirection, ColorTheme, ShapeType -#include "external/texture.h" // for Texture -#include "input/input_handler.h" // for InputHandler -#include "scene/scene_manager.h" // for SceneManager -#include "shapes/shape.h" // for Shape (interfaz polimórfica) -#include "shapes_mgr/shape_manager.h" // for ShapeManager -#include "state/state_manager.h" // for StateManager -#include "theme_manager.h" // for ThemeManager -#include "ui/ui_manager.h" // for UIManager +#include "app_logo.hpp" // for AppLogo +#include "ball.hpp" // for Ball +#include "boids_mgr/boid_manager.hpp" // for BoidManager +#include "defines.hpp" // for GravityDirection, ColorTheme, ShapeType +#include "external/texture.hpp" // for Texture +#include "input/input_handler.hpp" // for InputHandler +#include "scene/scene_manager.hpp" // for SceneManager +#include "shapes/shape.hpp" // for Shape (interfaz polimórfica) +#include "shapes_mgr/shape_manager.hpp" // for ShapeManager +#include "state/state_manager.hpp" // for StateManager +#include "theme_manager.hpp" // for ThemeManager +#include "ui/ui_manager.hpp" // for UIManager class Engine { public: diff --git a/source/external/mouse.cpp b/source/external/mouse.cpp index bf816b8..0ff1376 100644 --- a/source/external/mouse.cpp +++ b/source/external/mouse.cpp @@ -1,4 +1,4 @@ -#include "mouse.h" +#include "mouse.hpp" #include // Para SDL_GetTicks, Uint32, SDL_HideCursor, SDL_ShowCursor diff --git a/source/external/mouse.h b/source/external/mouse.hpp similarity index 100% rename from source/external/mouse.h rename to source/external/mouse.hpp diff --git a/source/external/sprite.cpp b/source/external/sprite.cpp index 9964225..f2ad490 100644 --- a/source/external/sprite.cpp +++ b/source/external/sprite.cpp @@ -1,6 +1,6 @@ -#include "sprite.h" +#include "sprite.hpp" -#include "texture.h" // for Texture +#include "texture.hpp" // for Texture // Constructor Sprite::Sprite(std::shared_ptr texture) diff --git a/source/external/sprite.h b/source/external/sprite.hpp similarity index 100% rename from source/external/sprite.h rename to source/external/sprite.hpp diff --git a/source/external/texture.cpp b/source/external/texture.cpp index bd6ea20..71bd417 100644 --- a/source/external/texture.cpp +++ b/source/external/texture.cpp @@ -1,5 +1,5 @@ #define STB_IMAGE_IMPLEMENTATION -#include "texture.h" +#include "texture.hpp" #include // Para SDL_GetError #include // Para SDL_Log @@ -12,7 +12,7 @@ #include // Para operator<<, string #include "stb_image.h" // Para stbi_failure_reason, stbi_image_free -#include "../resource_manager.h" // Sistema de empaquetado de recursos centralizado +#include "resource_manager.hpp" // Sistema de empaquetado de recursos centralizado Texture::Texture(SDL_Renderer *renderer) : renderer_(renderer), diff --git a/source/external/texture.h b/source/external/texture.hpp similarity index 100% rename from source/external/texture.h rename to source/external/texture.hpp diff --git a/source/input/input_handler.cpp b/source/input/input_handler.cpp index 2230739..a644719 100644 --- a/source/input/input_handler.cpp +++ b/source/input/input_handler.cpp @@ -1,10 +1,10 @@ -#include "input_handler.h" +#include "input_handler.hpp" #include // for SDL_Keycode #include // for std::string, std::to_string -#include "../engine.h" // for Engine -#include "../external/mouse.h" // for Mouse namespace +#include "engine.hpp" // for Engine +#include "external/mouse.hpp" // for Mouse namespace bool InputHandler::processEvents(Engine& engine) { SDL_Event event; diff --git a/source/input/input_handler.h b/source/input/input_handler.hpp similarity index 100% rename from source/input/input_handler.h rename to source/input/input_handler.hpp diff --git a/source/logo_scaler.cpp b/source/logo_scaler.cpp index 4caee9a..91d0465 100644 --- a/source/logo_scaler.cpp +++ b/source/logo_scaler.cpp @@ -1,5 +1,5 @@ #define STB_IMAGE_RESIZE_IMPLEMENTATION -#include "logo_scaler.h" +#include "logo_scaler.hpp" #include // Para SDL_GetError #include // Para SDL_Log @@ -13,7 +13,7 @@ #include "external/stb_image.h" // Para stbi_load, stbi_image_free #include "external/stb_image_resize2.h" // Para stbir_resize_uint8_srgb -#include "resource_manager.h" // Para cargar desde pack +#include "resource_manager.hpp" // Para cargar desde pack // ============================================================================ // Detectar resolución nativa del monitor principal diff --git a/source/logo_scaler.h b/source/logo_scaler.hpp similarity index 100% rename from source/logo_scaler.h rename to source/logo_scaler.hpp diff --git a/source/main.cpp b/source/main.cpp index 9f8bbb8..22f0d39 100644 --- a/source/main.cpp +++ b/source/main.cpp @@ -1,9 +1,9 @@ #include #include #include -#include "engine.h" -#include "defines.h" -#include "resource_manager.h" +#include "engine.hpp" +#include "defines.hpp" +#include "resource_manager.hpp" // getExecutableDirectory() ya está definido en defines.h como inline diff --git a/source/resource_manager.cpp b/source/resource_manager.cpp index b5efd7d..f906546 100644 --- a/source/resource_manager.cpp +++ b/source/resource_manager.cpp @@ -1,5 +1,5 @@ -#include "resource_manager.h" -#include "resource_pack.h" +#include "resource_manager.hpp" +#include "resource_pack.hpp" #include #include diff --git a/source/resource_manager.h b/source/resource_manager.hpp similarity index 96% rename from source/resource_manager.h rename to source/resource_manager.hpp index 4506756..a47faa1 100644 --- a/source/resource_manager.h +++ b/source/resource_manager.hpp @@ -1,5 +1,4 @@ -#ifndef RESOURCE_MANAGER_H -#define RESOURCE_MANAGER_H +#pragma once #include #include @@ -81,5 +80,3 @@ private: // Instancia del pack (nullptr si no está cargado) static ResourcePack* resourcePack_; }; - -#endif // RESOURCE_MANAGER_H diff --git a/source/resource_pack.cpp b/source/resource_pack.cpp index 62f8f5d..8d6d8cd 100644 --- a/source/resource_pack.cpp +++ b/source/resource_pack.cpp @@ -1,4 +1,4 @@ -#include "resource_pack.h" +#include "resource_pack.hpp" #include #include diff --git a/source/resource_pack.h b/source/resource_pack.hpp similarity index 96% rename from source/resource_pack.h rename to source/resource_pack.hpp index 7cf9b3a..30ad978 100644 --- a/source/resource_pack.h +++ b/source/resource_pack.hpp @@ -1,5 +1,4 @@ -#ifndef RESOURCE_PACK_H -#define RESOURCE_PACK_H +#pragma once #include #include @@ -64,5 +63,3 @@ private: uint32_t calculateChecksum(const unsigned char* data, size_t size); std::string normalizePath(const std::string& path); }; - -#endif // RESOURCE_PACK_H diff --git a/source/scene/scene_manager.cpp b/source/scene/scene_manager.cpp index e731fa3..e1f1ecd 100644 --- a/source/scene/scene_manager.cpp +++ b/source/scene/scene_manager.cpp @@ -1,10 +1,10 @@ -#include "scene_manager.h" +#include "scene_manager.hpp" #include // for rand -#include "../defines.h" // for BALL_COUNT_SCENARIOS, GRAVITY_MASS_MIN, etc -#include "../external/texture.h" // for Texture -#include "../theme_manager.h" // for ThemeManager +#include "defines.hpp" // for BALL_COUNT_SCENARIOS, GRAVITY_MASS_MIN, etc +#include "external/texture.hpp" // for Texture +#include "theme_manager.hpp" // for ThemeManager SceneManager::SceneManager(int screen_width, int screen_height) : current_gravity_(GravityDirection::DOWN) diff --git a/source/scene/scene_manager.h b/source/scene/scene_manager.hpp similarity index 98% rename from source/scene/scene_manager.h rename to source/scene/scene_manager.hpp index 01147b6..c0da7be 100644 --- a/source/scene/scene_manager.h +++ b/source/scene/scene_manager.hpp @@ -3,8 +3,8 @@ #include // for unique_ptr, shared_ptr #include // for vector -#include "../ball.h" // for Ball -#include "../defines.h" // for GravityDirection +#include "ball.hpp" // for Ball +#include "defines.hpp" // for GravityDirection // Forward declarations class Texture; diff --git a/source/shapes/atom_shape.cpp b/source/shapes/atom_shape.cpp index 4109a96..ff41616 100644 --- a/source/shapes/atom_shape.cpp +++ b/source/shapes/atom_shape.cpp @@ -1,5 +1,5 @@ -#include "atom_shape.h" -#include "../defines.h" +#include "atom_shape.hpp" +#include "defines.hpp" #include void AtomShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/atom_shape.h b/source/shapes/atom_shape.hpp similarity index 97% rename from source/shapes/atom_shape.h rename to source/shapes/atom_shape.hpp index 2d79bf0..cdcc644 100644 --- a/source/shapes/atom_shape.h +++ b/source/shapes/atom_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Átomo con núcleo central y órbitas electrónicas // Comportamiento: Núcleo estático + electrones orbitando en planos inclinados diff --git a/source/shapes/cube_shape.cpp b/source/shapes/cube_shape.cpp index 0fb84cd..e25c08b 100644 --- a/source/shapes/cube_shape.cpp +++ b/source/shapes/cube_shape.cpp @@ -1,5 +1,5 @@ -#include "cube_shape.h" -#include "../defines.h" +#include "cube_shape.hpp" +#include "defines.hpp" #include void CubeShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/cube_shape.h b/source/shapes/cube_shape.hpp similarity index 98% rename from source/shapes/cube_shape.h rename to source/shapes/cube_shape.hpp index 72a549d..5613b40 100644 --- a/source/shapes/cube_shape.h +++ b/source/shapes/cube_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" #include // Figura: Cubo 3D rotante diff --git a/source/shapes/cylinder_shape.cpp b/source/shapes/cylinder_shape.cpp index b8116c1..18b526a 100644 --- a/source/shapes/cylinder_shape.cpp +++ b/source/shapes/cylinder_shape.cpp @@ -1,5 +1,5 @@ -#include "cylinder_shape.h" -#include "../defines.h" +#include "cylinder_shape.hpp" +#include "defines.hpp" #include #include // Para rand() diff --git a/source/shapes/cylinder_shape.h b/source/shapes/cylinder_shape.hpp similarity index 98% rename from source/shapes/cylinder_shape.h rename to source/shapes/cylinder_shape.hpp index 5e26b5b..d758574 100644 --- a/source/shapes/cylinder_shape.h +++ b/source/shapes/cylinder_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Cilindro 3D rotante // Comportamiento: Superficie cilíndrica con rotación en eje Y + tumbling ocasional en X/Z diff --git a/source/shapes/helix_shape.cpp b/source/shapes/helix_shape.cpp index 2bc9a80..d84f32e 100644 --- a/source/shapes/helix_shape.cpp +++ b/source/shapes/helix_shape.cpp @@ -1,5 +1,5 @@ -#include "helix_shape.h" -#include "../defines.h" +#include "helix_shape.hpp" +#include "defines.hpp" #include void HelixShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/helix_shape.h b/source/shapes/helix_shape.hpp similarity index 98% rename from source/shapes/helix_shape.h rename to source/shapes/helix_shape.hpp index b82f800..6ffabcb 100644 --- a/source/shapes/helix_shape.h +++ b/source/shapes/helix_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Espiral helicoidal 3D con distribución uniforme // Comportamiento: Rotación en eje Y + animación de fase vertical diff --git a/source/shapes/icosahedron_shape.cpp b/source/shapes/icosahedron_shape.cpp index 5fac70f..a94f82c 100644 --- a/source/shapes/icosahedron_shape.cpp +++ b/source/shapes/icosahedron_shape.cpp @@ -1,5 +1,5 @@ -#include "icosahedron_shape.h" -#include "../defines.h" +#include "icosahedron_shape.hpp" +#include "defines.hpp" #include #include diff --git a/source/shapes/icosahedron_shape.h b/source/shapes/icosahedron_shape.hpp similarity index 98% rename from source/shapes/icosahedron_shape.h rename to source/shapes/icosahedron_shape.hpp index e5d7a3c..1a4a3f8 100644 --- a/source/shapes/icosahedron_shape.h +++ b/source/shapes/icosahedron_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Icosaedro 3D (D20, poliedro regular de 20 caras) // Comportamiento: 12 vértices distribuidos uniformemente con rotación triple diff --git a/source/shapes/lissajous_shape.cpp b/source/shapes/lissajous_shape.cpp index b8cfcc1..04d8763 100644 --- a/source/shapes/lissajous_shape.cpp +++ b/source/shapes/lissajous_shape.cpp @@ -1,5 +1,5 @@ -#include "lissajous_shape.h" -#include "../defines.h" +#include "lissajous_shape.hpp" +#include "defines.hpp" #include void LissajousShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/lissajous_shape.h b/source/shapes/lissajous_shape.hpp similarity index 98% rename from source/shapes/lissajous_shape.h rename to source/shapes/lissajous_shape.hpp index e1694ae..53378de 100644 --- a/source/shapes/lissajous_shape.h +++ b/source/shapes/lissajous_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Curva de Lissajous 3D // Comportamiento: Curva paramétrica 3D con rotación global y animación de fase diff --git a/source/shapes/png_shape.cpp b/source/shapes/png_shape.cpp index 99530d4..632ff62 100644 --- a/source/shapes/png_shape.cpp +++ b/source/shapes/png_shape.cpp @@ -1,6 +1,6 @@ -#include "png_shape.h" -#include "../defines.h" -#include "../external/stb_image.h" +#include "png_shape.hpp" +#include "defines.hpp" +#include "external/stb_image.h" #include #include #include diff --git a/source/shapes/png_shape.h b/source/shapes/png_shape.hpp similarity index 98% rename from source/shapes/png_shape.h rename to source/shapes/png_shape.hpp index c431e59..7accb92 100644 --- a/source/shapes/png_shape.h +++ b/source/shapes/png_shape.hpp @@ -1,7 +1,7 @@ #pragma once -#include "shape.h" -#include "../defines.h" // Para PNG_IDLE_TIME_MIN/MAX constantes +#include "shape.hpp" +#include "defines.hpp" // Para PNG_IDLE_TIME_MIN/MAX constantes #include #include // Para rand() diff --git a/source/shapes/shape.h b/source/shapes/shape.hpp similarity index 100% rename from source/shapes/shape.h rename to source/shapes/shape.hpp diff --git a/source/shapes/sphere_shape.cpp b/source/shapes/sphere_shape.cpp index c4b8df3..e2dc6ed 100644 --- a/source/shapes/sphere_shape.cpp +++ b/source/shapes/sphere_shape.cpp @@ -1,5 +1,5 @@ -#include "sphere_shape.h" -#include "../defines.h" +#include "sphere_shape.hpp" +#include "defines.hpp" #include void SphereShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/sphere_shape.h b/source/shapes/sphere_shape.hpp similarity index 97% rename from source/shapes/sphere_shape.h rename to source/shapes/sphere_shape.hpp index ebb1948..64914c5 100644 --- a/source/shapes/sphere_shape.h +++ b/source/shapes/sphere_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Esfera 3D con distribución uniforme (Fibonacci Sphere Algorithm) // Comportamiento: Rotación dual en ejes X e Y diff --git a/source/shapes/torus_shape.cpp b/source/shapes/torus_shape.cpp index 4d4af13..fd91825 100644 --- a/source/shapes/torus_shape.cpp +++ b/source/shapes/torus_shape.cpp @@ -1,5 +1,5 @@ -#include "torus_shape.h" -#include "../defines.h" +#include "torus_shape.hpp" +#include "defines.hpp" #include void TorusShape::generatePoints(int num_points, float screen_width, float screen_height) { diff --git a/source/shapes/torus_shape.h b/source/shapes/torus_shape.hpp similarity index 98% rename from source/shapes/torus_shape.h rename to source/shapes/torus_shape.hpp index 8a1d7e5..3119675 100644 --- a/source/shapes/torus_shape.h +++ b/source/shapes/torus_shape.hpp @@ -1,6 +1,6 @@ #pragma once -#include "shape.h" +#include "shape.hpp" // Figura: Torus/Toroide 3D (donut/rosquilla) // Comportamiento: Superficie toroidal con rotación triple (X, Y, Z) diff --git a/source/shapes_mgr/shape_manager.cpp b/source/shapes_mgr/shape_manager.cpp index 230bd3c..edbb84a 100644 --- a/source/shapes_mgr/shape_manager.cpp +++ b/source/shapes_mgr/shape_manager.cpp @@ -1,25 +1,25 @@ -#include "shape_manager.h" +#include "shape_manager.hpp" #include // for std::min, std::max #include // for rand #include // for std::string -#include "../ball.h" // for Ball -#include "../defines.h" // for constantes -#include "../scene/scene_manager.h" // for SceneManager -#include "../state/state_manager.h" // for StateManager -#include "../ui/ui_manager.h" // for UIManager +#include "ball.hpp" // for Ball +#include "defines.hpp" // for constantes +#include "scene/scene_manager.hpp" // for SceneManager +#include "state/state_manager.hpp" // for StateManager +#include "ui/ui_manager.hpp" // for UIManager // Includes de todas las shapes (necesario para creación polimórfica) -#include "../shapes/atom_shape.h" -#include "../shapes/cube_shape.h" -#include "../shapes/cylinder_shape.h" -#include "../shapes/helix_shape.h" -#include "../shapes/icosahedron_shape.h" -#include "../shapes/lissajous_shape.h" -#include "../shapes/png_shape.h" -#include "../shapes/sphere_shape.h" -#include "../shapes/torus_shape.h" +#include "shapes/atom_shape.hpp" +#include "shapes/cube_shape.hpp" +#include "shapes/cylinder_shape.hpp" +#include "shapes/helix_shape.hpp" +#include "shapes/icosahedron_shape.hpp" +#include "shapes/lissajous_shape.hpp" +#include "shapes/png_shape.hpp" +#include "shapes/sphere_shape.hpp" +#include "shapes/torus_shape.hpp" ShapeManager::ShapeManager() : engine_(nullptr) diff --git a/source/shapes_mgr/shape_manager.h b/source/shapes_mgr/shape_manager.hpp similarity index 97% rename from source/shapes_mgr/shape_manager.h rename to source/shapes_mgr/shape_manager.hpp index 43e41b7..59ccdf2 100644 --- a/source/shapes_mgr/shape_manager.h +++ b/source/shapes_mgr/shape_manager.hpp @@ -2,8 +2,8 @@ #include // for unique_ptr -#include "../defines.h" // for SimulationMode, ShapeType -#include "../shapes/shape.h" // for Shape base class +#include "defines.hpp" // for SimulationMode, ShapeType +#include "shapes/shape.hpp" // for Shape base class // Forward declarations class Engine; diff --git a/source/spatial_grid.cpp b/source/spatial_grid.cpp index bab51b8..0cd3a8a 100644 --- a/source/spatial_grid.cpp +++ b/source/spatial_grid.cpp @@ -1,9 +1,9 @@ -#include "spatial_grid.h" +#include "spatial_grid.hpp" #include // for std::max, std::min #include // for std::floor, std::ceil -#include "ball.h" // for Ball +#include "ball.hpp" // for Ball SpatialGrid::SpatialGrid(int world_width, int world_height, float cell_size) : world_width_(world_width) diff --git a/source/spatial_grid.h b/source/spatial_grid.hpp similarity index 97% rename from source/spatial_grid.h rename to source/spatial_grid.hpp index 75a7caa..c38a418 100644 --- a/source/spatial_grid.h +++ b/source/spatial_grid.hpp @@ -1,5 +1,4 @@ -#ifndef SPATIAL_GRID_H -#define SPATIAL_GRID_H +#pragma once #include #include @@ -70,5 +69,3 @@ private: // Usamos unordered_map para O(1) lookup std::unordered_map> cells_; }; - -#endif // SPATIAL_GRID_H diff --git a/source/state/state_manager.cpp b/source/state/state_manager.cpp index 92c4dd5..1012e4f 100644 --- a/source/state/state_manager.cpp +++ b/source/state/state_manager.cpp @@ -1,10 +1,10 @@ -#include "state_manager.h" +#include "state_manager.hpp" #include // for rand -#include "../defines.h" // for constantes DEMO/LOGO -#include "../engine.h" // for Engine (callbacks) -#include "../shapes/png_shape.h" // for PNGShape flip detection +#include "defines.hpp" // for constantes DEMO/LOGO +#include "engine.hpp" // for Engine (callbacks) +#include "shapes/png_shape.hpp" // for PNGShape flip detection StateManager::StateManager() : engine_(nullptr) diff --git a/source/state/state_manager.h b/source/state/state_manager.hpp similarity index 98% rename from source/state/state_manager.h rename to source/state/state_manager.hpp index 3e8c687..93e747d 100644 --- a/source/state/state_manager.h +++ b/source/state/state_manager.hpp @@ -3,7 +3,7 @@ #include // for Uint64 #include // for size_t -#include "../defines.h" // for AppMode, ShapeType, GravityDirection +#include "defines.hpp" // for AppMode, ShapeType, GravityDirection // Forward declarations class Engine; diff --git a/source/text/textrenderer.cpp b/source/text/textrenderer.cpp index 76a9565..a570dae 100644 --- a/source/text/textrenderer.cpp +++ b/source/text/textrenderer.cpp @@ -1,7 +1,7 @@ -#include "textrenderer.h" +#include "textrenderer.hpp" #include #include -#include "../resource_manager.h" +#include "resource_manager.hpp" TextRenderer::TextRenderer() : renderer_(nullptr), font_(nullptr), font_size_(0), use_antialiasing_(true), font_data_buffer_(nullptr) { } diff --git a/source/text/textrenderer.h b/source/text/textrenderer.hpp similarity index 100% rename from source/text/textrenderer.h rename to source/text/textrenderer.hpp diff --git a/source/theme_manager.cpp b/source/theme_manager.cpp index 9419b46..6b9eb0c 100644 --- a/source/theme_manager.cpp +++ b/source/theme_manager.cpp @@ -1,7 +1,7 @@ -#include "theme_manager.h" +#include "theme_manager.hpp" -#include "themes/static_theme.h" -#include "themes/dynamic_theme.h" +#include "themes/static_theme.hpp" +#include "themes/dynamic_theme.hpp" // ============================================================================ // INICIALIZACIÓN diff --git a/source/theme_manager.h b/source/theme_manager.hpp similarity index 95% rename from source/theme_manager.h rename to source/theme_manager.hpp index 982ad12..fafe4b8 100644 --- a/source/theme_manager.h +++ b/source/theme_manager.hpp @@ -3,10 +3,10 @@ #include // for unique_ptr #include // for vector -#include "ball.h" // for Ball class -#include "defines.h" // for Color, ColorTheme -#include "themes/theme.h" // for Theme interface -#include "themes/theme_snapshot.h" // for ThemeSnapshot +#include "ball.hpp" // for Ball class +#include "defines.hpp" // for Color, ColorTheme +#include "themes/theme.hpp" // for Theme interface +#include "themes/theme_snapshot.hpp" // for ThemeSnapshot /** * ThemeManager: Gestiona el sistema de temas visuales (unificado, estáticos y dinámicos) diff --git a/source/themes/dynamic_theme.cpp b/source/themes/dynamic_theme.cpp index f8fc5a5..4869b6b 100644 --- a/source/themes/dynamic_theme.cpp +++ b/source/themes/dynamic_theme.cpp @@ -1,4 +1,4 @@ -#include "dynamic_theme.h" +#include "dynamic_theme.hpp" #include // for std::min DynamicTheme::DynamicTheme(const char* name_en, const char* name_es, diff --git a/source/themes/dynamic_theme.h b/source/themes/dynamic_theme.hpp similarity index 99% rename from source/themes/dynamic_theme.h rename to source/themes/dynamic_theme.hpp index a4511b9..8b46280 100644 --- a/source/themes/dynamic_theme.h +++ b/source/themes/dynamic_theme.hpp @@ -1,6 +1,6 @@ #pragma once -#include "theme.h" +#include "theme.hpp" #include // Forward declaration (estructura definida en defines.h) diff --git a/source/themes/static_theme.cpp b/source/themes/static_theme.cpp index eabbf49..f0b4663 100644 --- a/source/themes/static_theme.cpp +++ b/source/themes/static_theme.cpp @@ -1,4 +1,4 @@ -#include "static_theme.h" +#include "static_theme.hpp" StaticTheme::StaticTheme(const char* name_en, const char* name_es, int text_r, int text_g, int text_b, diff --git a/source/themes/static_theme.h b/source/themes/static_theme.hpp similarity index 99% rename from source/themes/static_theme.h rename to source/themes/static_theme.hpp index b8d5906..653bde6 100644 --- a/source/themes/static_theme.h +++ b/source/themes/static_theme.hpp @@ -1,6 +1,6 @@ #pragma once -#include "theme.h" +#include "theme.hpp" #include /** diff --git a/source/themes/theme.h b/source/themes/theme.hpp similarity index 98% rename from source/themes/theme.h rename to source/themes/theme.hpp index 7c7b2f6..0c27c7f 100644 --- a/source/themes/theme.h +++ b/source/themes/theme.hpp @@ -1,7 +1,7 @@ #pragma once #include -#include "../defines.h" // for Color, ThemeKeyframe +#include "defines.hpp" // for Color, ThemeKeyframe /** * Theme: Interfaz polimórfica para todos los temas (estáticos y dinámicos) diff --git a/source/themes/theme_snapshot.h b/source/themes/theme_snapshot.hpp similarity index 97% rename from source/themes/theme_snapshot.h rename to source/themes/theme_snapshot.hpp index 8293230..436bb02 100644 --- a/source/themes/theme_snapshot.h +++ b/source/themes/theme_snapshot.hpp @@ -2,7 +2,7 @@ #include #include -#include "../defines.h" // for Color +#include "defines.hpp" // for Color /** * ThemeSnapshot: "Fotografía" del estado de un tema en un momento dado diff --git a/source/ui/help_overlay.cpp b/source/ui/help_overlay.cpp index bb1d454..abba3e1 100644 --- a/source/ui/help_overlay.cpp +++ b/source/ui/help_overlay.cpp @@ -1,9 +1,9 @@ -#include "help_overlay.h" +#include "help_overlay.hpp" #include // for std::min -#include "../text/textrenderer.h" -#include "../theme_manager.h" +#include "text/textrenderer.hpp" +#include "theme_manager.hpp" HelpOverlay::HelpOverlay() : renderer_(nullptr), @@ -28,7 +28,7 @@ HelpOverlay::HelpOverlay() // COLUMNA 1: SIMULACIÓN {"SIMULACIÓN", ""}, {"1-8", "Escenarios (10 a 50,000 pelotas)"}, - {"F", "Toggle Física ↔ Última Figura"}, + {"F", "Toggle Física - Última Figura"}, {"B", "Modo Boids (enjambre)"}, {"ESPACIO", "Impulso contra gravedad"}, {"G", "Toggle Gravedad ON/OFF"}, diff --git a/source/ui/help_overlay.h b/source/ui/help_overlay.hpp similarity index 100% rename from source/ui/help_overlay.h rename to source/ui/help_overlay.hpp diff --git a/source/ui/notifier.cpp b/source/ui/notifier.cpp index 05118e7..6bac32c 100644 --- a/source/ui/notifier.cpp +++ b/source/ui/notifier.cpp @@ -1,8 +1,8 @@ -#include "notifier.h" -#include "../text/textrenderer.h" -#include "../theme_manager.h" -#include "../defines.h" -#include "../utils/easing_functions.h" +#include "notifier.hpp" +#include "text/textrenderer.hpp" +#include "theme_manager.hpp" +#include "defines.hpp" +#include "utils/easing_functions.hpp" #include // ============================================================================ diff --git a/source/ui/notifier.h b/source/ui/notifier.hpp similarity index 100% rename from source/ui/notifier.h rename to source/ui/notifier.hpp diff --git a/source/ui/ui_manager.cpp b/source/ui/ui_manager.cpp index e19ec43..9027bb0 100644 --- a/source/ui/ui_manager.cpp +++ b/source/ui/ui_manager.cpp @@ -1,17 +1,17 @@ -#include "ui_manager.h" +#include "ui_manager.hpp" #include #include -#include "../ball.h" // for Ball -#include "../defines.h" // for TEXT_DURATION, NOTIFICATION_DURATION, AppMode, SimulationMode -#include "../engine.h" // for Engine (info de sistema) -#include "../scene/scene_manager.h" // for SceneManager -#include "../shapes/shape.h" // for Shape -#include "../text/textrenderer.h" // for TextRenderer -#include "../theme_manager.h" // for ThemeManager -#include "notifier.h" // for Notifier -#include "help_overlay.h" // for HelpOverlay +#include "ball.hpp" // for Ball +#include "defines.hpp" // for TEXT_DURATION, NOTIFICATION_DURATION, AppMode, SimulationMode +#include "engine.hpp" // for Engine (info de sistema) +#include "scene/scene_manager.hpp" // for SceneManager +#include "shapes/shape.hpp" // for Shape +#include "text/textrenderer.hpp" // for TextRenderer +#include "theme_manager.hpp" // for ThemeManager +#include "notifier.hpp" // for Notifier +#include "help_overlay.hpp" // for HelpOverlay // ============================================================================ // HELPER: Obtener viewport en coordenadas físicas (no lógicas) diff --git a/source/ui/ui_manager.h b/source/ui/ui_manager.hpp similarity index 100% rename from source/ui/ui_manager.h rename to source/ui/ui_manager.hpp diff --git a/source/utils/easing_functions.h b/source/utils/easing_functions.hpp similarity index 100% rename from source/utils/easing_functions.h rename to source/utils/easing_functions.hpp diff --git a/tools/pack_resources.cpp b/tools/pack_resources.cpp index 6416ce5..b802215 100644 --- a/tools/pack_resources.cpp +++ b/tools/pack_resources.cpp @@ -1,4 +1,4 @@ -#include "../source/resource_pack.h" +#include "../source/resource_pack.hpp" #include #include