Refactor Fase 7: Crear ShapeManager funcional (código duplicado temporal)
ENFOQUE PRAGMÁTICO: - ShapeManager creado e implementado completamente - Código DUPLICADO entre Engine y ShapeManager temporalmente - Engine mantiene implementación para DEMO/LOGO (hasta Fase 8) - Compilación exitosa, aplicación funcional ARCHIVOS CREADOS/MODIFICADOS: 1. shape_manager.h: - Interfaz completa de ShapeManager - Métodos públicos para control de figuras 3D - Referencias a Scene/UI/StateManager 2. shape_manager.cpp: - Implementación completa de todos los métodos - toggleShapeMode(), activateShape(), update(), generateShape() - Sistema de atracción física con spring forces - Cálculo de convergencia para LOGO MODE - Includes de todas las Shape classes 3. engine.h: - Variables de figuras 3D MANTENIDAS (duplicadas con ShapeManager) - Comentarios documentando duplicación temporal - TODO markers para Fase 8 4. engine.cpp: - Inicialización de ShapeManager con dependencias - Métodos de figuras restaurados (no eliminados) - Código DEMO/LOGO funciona con variables locales - Sistema de rendering usa current_mode_ local DUPLICACIÓN TEMPORAL DOCUMENTADA: ```cpp // Engine mantiene: - current_mode_, current_shape_type_, last_shape_type_ - active_shape_, shape_scale_factor_, depth_zoom_enabled_ - shape_convergence_ - toggleShapeModeInternal(), activateShapeInternal() - updateShape(), generateShape(), clampShapeScale() ``` JUSTIFICACIÓN: - Migrar ShapeManager sin migrar DEMO/LOGO causaba conflictos masivos - Enfoque incremental: Fase 7 (ShapeManager) → Fase 8 (DEMO/LOGO) - Permite compilación y testing entre fases - ShapeManager está listo para uso futuro en controles manuales RESULTADO: ✅ Compilación exitosa (1 warning menor) ✅ Aplicación funciona correctamente ✅ Todas las características operativas ✅ ShapeManager completamente implementado ✅ Listo para Fase 8 (migración DEMO/LOGO a StateManager) PRÓXIMOS PASOS (Fase 8): 1. Migrar lógica DEMO/LOGO de Engine a StateManager 2. Convertir métodos de Engine en wrappers a StateManager/ShapeManager 3. Eliminar código duplicado 4. Limpieza final 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
@@ -7,6 +7,9 @@
|
||||
|
||||
// Forward declarations
|
||||
class Engine;
|
||||
class SceneManager;
|
||||
class UIManager;
|
||||
class StateManager;
|
||||
|
||||
/**
|
||||
* @class ShapeManager
|
||||
@@ -35,10 +38,16 @@ class ShapeManager {
|
||||
~ShapeManager();
|
||||
|
||||
/**
|
||||
* @brief Inicializa el ShapeManager con referencia al Engine
|
||||
* @param engine Puntero al Engine (para callbacks)
|
||||
* @brief Inicializa el ShapeManager con referencias a otros componentes
|
||||
* @param engine Puntero al Engine (para callbacks legacy)
|
||||
* @param scene_mgr Puntero a SceneManager (para acceso a bolas)
|
||||
* @param ui_mgr Puntero a UIManager (para notificaciones)
|
||||
* @param state_mgr Puntero a StateManager (para verificar modo actual)
|
||||
* @param screen_width Ancho lógico de pantalla
|
||||
* @param screen_height Alto lógico de pantalla
|
||||
*/
|
||||
void initialize(Engine* engine);
|
||||
void initialize(Engine* engine, SceneManager* scene_mgr, UIManager* ui_mgr,
|
||||
StateManager* state_mgr, int screen_width, int screen_height);
|
||||
|
||||
/**
|
||||
* @brief Toggle entre modo PHYSICS y SHAPE
|
||||
@@ -112,9 +121,24 @@ class ShapeManager {
|
||||
*/
|
||||
bool isShapeModeActive() const { return current_mode_ == SimulationMode::SHAPE; }
|
||||
|
||||
/**
|
||||
* @brief Actualiza el tamaño de pantalla (para resize/fullscreen)
|
||||
* @param width Nuevo ancho lógico
|
||||
* @param height Nuevo alto lógico
|
||||
*/
|
||||
void updateScreenSize(int width, int height);
|
||||
|
||||
/**
|
||||
* @brief Obtiene convergencia actual (para modo LOGO)
|
||||
*/
|
||||
float getConvergence() const { return shape_convergence_; }
|
||||
|
||||
private:
|
||||
// === Referencia al Engine (callback) ===
|
||||
Engine* engine_;
|
||||
// === Referencias a otros componentes ===
|
||||
Engine* engine_; // Callback al Engine (legacy - temporal)
|
||||
SceneManager* scene_mgr_; // Acceso a bolas y física
|
||||
UIManager* ui_mgr_; // Notificaciones
|
||||
StateManager* state_mgr_; // Verificación de modo actual
|
||||
|
||||
// === Estado de figuras 3D ===
|
||||
SimulationMode current_mode_;
|
||||
@@ -124,6 +148,13 @@ class ShapeManager {
|
||||
float shape_scale_factor_;
|
||||
bool depth_zoom_enabled_;
|
||||
|
||||
// === Dimensiones de pantalla ===
|
||||
int screen_width_;
|
||||
int screen_height_;
|
||||
|
||||
// === Convergencia (para modo LOGO) ===
|
||||
float shape_convergence_;
|
||||
|
||||
// === Métodos privados ===
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user