Crea la infraestructura del StateManager para gestionar estados DEMO/LOGO con patrón de callbacks al Engine. Estructura lista para migración de lógica. ## Archivos Nuevos **source/state/state_manager.h:** - Declaración de clase StateManager - Forward declaration de Engine (patrón callback) - Métodos públicos: initialize(), update(), setState() - Métodos toggle: toggleDemoMode(), toggleDemoLiteMode(), toggleLogoMode() - Getters: getCurrentMode(), getPreviousMode(), is*ModeActive() - Métodos privados: performDemoAction(), randomizeOnDemoStart(), etc. - Miembros para timers, convergencia, flip detection, estado previo **source/state/state_manager.cpp:** - Implementación de constructor/destructor - initialize() con callback al Engine - Stubs de todos los métodos (TODO: migrar lógica completa) - Preparado para recibir ~600 líneas de lógica DEMO/LOGO ## Archivos Modificados **CMakeLists.txt:** - Agregado: source/state/*.cpp al glob de archivos fuente **source/engine.h:** - Agregado: #include "state/state_manager.h" - Agregado: std::unique_ptr<StateManager> state_manager_ - NOTA: Miembros de estado aún no removidos (pendiente migración) **source/engine.cpp:** - initialize(): Crea state_manager_ con `this` como callback - NOTA: Métodos DEMO/LOGO aún no migrados (pendiente) ## Estado Actual - ✅ Estructura del StateManager creada y compila - ✅ Patrón de callbacks al Engine configurado - ✅ CMakeLists actualizado - ⏳ Migración de lógica DEMO/LOGO: PENDIENTE (~600 líneas) - ⏳ Remoción de miembros duplicados en Engine: PENDIENTE ## Próximos Pasos (Fase 4b) 1. Migrar updateDemoMode() → StateManager::update() 2. Migrar performDemoAction() → StateManager (privado) 3. Migrar randomizeOnDemoStart() → StateManager (privado) 4. Migrar enterLogoMode() → StateManager (privado) 5. Migrar exitLogoMode() → StateManager (privado) 6. Migrar toggleGravityOnOff() → StateManager (privado) 7. Migrar setState() completo 8. Delegar toggle*Mode() desde Engine a StateManager 9. Remover miembros de estado duplicados en Engine 10. Commit final de Fase 4 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
59 lines
2.0 KiB
CMake
59 lines
2.0 KiB
CMake
cmake_minimum_required(VERSION 3.20)
|
|
project(vibe3_physics)
|
|
|
|
# Establecer el estándar de C++
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
# Opciones comunes de compilación
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Os -ffunction-sections -fdata-sections")
|
|
|
|
# Buscar SDL3 automáticamente
|
|
find_package(SDL3 REQUIRED)
|
|
|
|
# Si no se encuentra SDL3, generar un error
|
|
if (NOT SDL3_FOUND)
|
|
message(FATAL_ERROR "SDL3 no encontrado. Por favor, verifica su instalación.")
|
|
endif()
|
|
|
|
# Buscar SDL3_ttf
|
|
find_package(SDL3_ttf REQUIRED)
|
|
|
|
# Si no se encuentra SDL3_ttf, generar un error
|
|
if (NOT SDL3_ttf_FOUND)
|
|
message(FATAL_ERROR "SDL3_ttf no encontrado. Por favor, verifica su instalación.")
|
|
endif()
|
|
|
|
# Archivos fuente (excluir main_old.cpp)
|
|
file(GLOB SOURCE_FILES source/*.cpp source/external/*.cpp source/input/*.cpp source/scene/*.cpp source/shapes/*.cpp source/state/*.cpp source/themes/*.cpp source/text/*.cpp source/ui/*.cpp)
|
|
list(REMOVE_ITEM SOURCE_FILES "${CMAKE_SOURCE_DIR}/source/main_old.cpp")
|
|
|
|
# Comprobar si se encontraron archivos fuente
|
|
if(NOT SOURCE_FILES)
|
|
message(FATAL_ERROR "No se encontraron archivos fuente en el directorio 'source/'. Verifica la ruta.")
|
|
endif()
|
|
|
|
# Detectar la plataforma y configuraciones específicas
|
|
if(WIN32)
|
|
set(PLATFORM windows)
|
|
set(LINK_LIBS SDL3::SDL3 SDL3_ttf::SDL3_ttf mingw32 ws2_32)
|
|
elseif(UNIX AND NOT APPLE)
|
|
set(PLATFORM linux)
|
|
set(LINK_LIBS SDL3::SDL3 SDL3_ttf::SDL3_ttf)
|
|
elseif(APPLE)
|
|
set(PLATFORM macos)
|
|
set(LINK_LIBS SDL3::SDL3 SDL3_ttf::SDL3_ttf)
|
|
endif()
|
|
|
|
# Incluir directorios de SDL3 y SDL3_ttf
|
|
include_directories(${SDL3_INCLUDE_DIRS} ${SDL3_ttf_INCLUDE_DIRS})
|
|
|
|
# Añadir el ejecutable reutilizando el nombre del proyecto
|
|
add_executable(${PROJECT_NAME} ${SOURCE_FILES})
|
|
|
|
# Especificar la ubicación del ejecutable (en la raíz del proyecto)
|
|
set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR})
|
|
|
|
# Enlazar las bibliotecas necesarias
|
|
target_link_libraries(${PROJECT_NAME} ${LINK_LIBS})
|