cleaning code
This commit is contained in:
@ -121,58 +121,4 @@ target_include_directories(tetris PRIVATE
|
|||||||
${CMAKE_SOURCE_DIR}/src/persistence
|
${CMAKE_SOURCE_DIR}/src/persistence
|
||||||
${CMAKE_SOURCE_DIR}/src/core
|
${CMAKE_SOURCE_DIR}/src/core
|
||||||
${CMAKE_SOURCE_DIR}/src/states
|
${CMAKE_SOURCE_DIR}/src/states
|
||||||
)
|
|
||||||
|
|
||||||
# Experimental refactored version (for testing new architecture)
|
|
||||||
add_executable(tetris_refactored
|
|
||||||
src/main_new.cpp
|
|
||||||
src/gameplay/core/Game.cpp
|
|
||||||
src/core/GravityManager.cpp
|
|
||||||
src/core/state/StateManager.cpp
|
|
||||||
# New core architecture classes
|
|
||||||
src/core/application/ApplicationManager.cpp
|
|
||||||
src/core/input/InputManager.cpp
|
|
||||||
src/core/assets/AssetManager.cpp
|
|
||||||
src/core/GlobalState.cpp
|
|
||||||
src/graphics/renderers/RenderManager.cpp
|
|
||||||
src/persistence/Scores.cpp
|
|
||||||
src/graphics/effects/Starfield.cpp
|
|
||||||
src/graphics/effects/Starfield3D.cpp
|
|
||||||
src/graphics/ui/Font.cpp
|
|
||||||
src/graphics/renderers/GameRenderer.cpp
|
|
||||||
src/audio/Audio.cpp
|
|
||||||
src/gameplay/effects/LineEffect.cpp
|
|
||||||
src/audio/SoundEffect.cpp
|
|
||||||
# State implementations
|
|
||||||
src/states/LoadingState.cpp
|
|
||||||
src/states/MenuState.cpp
|
|
||||||
src/states/OptionsState.cpp
|
|
||||||
src/states/LevelSelectorState.cpp
|
|
||||||
src/states/PlayingState.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
# Embed the application icon into the refactored executable too
|
|
||||||
target_sources(tetris_refactored PRIVATE src/app_icon.rc)
|
|
||||||
add_dependencies(tetris_refactored copy_favicon)
|
|
||||||
add_custom_command(TARGET tetris_refactored POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FAVICON_SRC} $<TARGET_FILE_DIR:tetris_refactored>/favicon.ico
|
|
||||||
COMMENT "Copy favicon.ico next to refactored executable"
|
|
||||||
)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_link_libraries(tetris_refactored PRIVATE SDL3::SDL3 SDL3_ttf::SDL3_ttf SDL3_image::SDL3_image cpr::cpr nlohmann_json::nlohmann_json)
|
|
||||||
|
|
||||||
if (WIN32)
|
|
||||||
target_link_libraries(tetris_refactored PRIVATE mfplat mfreadwrite mfuuid)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
target_include_directories(tetris_refactored PRIVATE
|
|
||||||
${CMAKE_SOURCE_DIR}/src
|
|
||||||
${CMAKE_SOURCE_DIR}/src/audio
|
|
||||||
${CMAKE_SOURCE_DIR}/src/gameplay
|
|
||||||
${CMAKE_SOURCE_DIR}/src/graphics
|
|
||||||
${CMAKE_SOURCE_DIR}/src/persistence
|
|
||||||
${CMAKE_SOURCE_DIR}/src/core
|
|
||||||
${CMAKE_SOURCE_DIR}/src/states
|
|
||||||
)
|
)
|
||||||
1732
src/main_dist.cpp
1732
src/main_dist.cpp
File diff suppressed because it is too large
Load Diff
@ -1,35 +0,0 @@
|
|||||||
// main_new.cpp - Simplified application entry point for the refactored build
|
|
||||||
// Sets critical SDL hints (DPI awareness, scaling) before initializing subsystems
|
|
||||||
|
|
||||||
#include <SDL3/SDL.h>
|
|
||||||
#include <SDL3/SDL_main.h>
|
|
||||||
#include "core/application/ApplicationManager.h"
|
|
||||||
#include <iostream>
|
|
||||||
|
|
||||||
int main(int argc, char* argv[]) {
|
|
||||||
// Ensure per-monitor DPI awareness so fullscreen/input mapping is correct on high-DPI displays
|
|
||||||
SDL_SetHint("SDL_WINDOWS_DPI_AWARENESS", "permonitorv2");
|
|
||||||
// Keep pixel art crisp when scaling logical content
|
|
||||||
SDL_SetHint("SDL_RENDER_SCALE_QUALITY", "nearest");
|
|
||||||
|
|
||||||
ApplicationManager app;
|
|
||||||
if (!app.initialize(argc, argv)) {
|
|
||||||
std::cerr << "Failed to initialize application" << std::endl;
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
app.run();
|
|
||||||
// Ensure orderly teardown before C++ static destruction
|
|
||||||
app.shutdown();
|
|
||||||
} catch (const std::exception& ex) {
|
|
||||||
std::cerr << "Fatal error: " << ex.what() << std::endl;
|
|
||||||
app.shutdown();
|
|
||||||
return 2;
|
|
||||||
} catch (...) {
|
|
||||||
std::cerr << "Unknown fatal error" << std::endl;
|
|
||||||
app.shutdown();
|
|
||||||
return 3;
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user