搭建 LightGame 游戏框架

This commit is contained in:
2026-06-09 12:25:01 +08:00
parent 189072ba4e
commit aecd5a46ed
35 changed files with 3164 additions and 0 deletions
+25
View File
@@ -31,6 +31,7 @@ set(CORE_SOURCES
if(USE_FRAMEBUFFER)
list(APPEND CORE_SOURCES
src/Core/Platform/FBDisplay.cpp
src/Core/Platform/LinuxPhotoSensor.cpp
)
else()
list(APPEND CORE_SOURCES
@@ -39,6 +40,7 @@ else()
src/Core/Platform/SdlAudioOutput.cpp
src/Core/Platform/SdlKeyboardButtonInput.cpp
src/Core/Platform/SdlPointerInput.cpp
src/Core/Platform/SdlPhotoSensor.cpp
)
endif()
@@ -135,6 +137,7 @@ endfunction()
add_subdirectory(src/Apps/Game)
add_subdirectory(src/Apps/Demo)
add_subdirectory(src/Apps/LightGame)
if(BUILD_TESTING AND NOT USE_FRAMEBUFFER)
add_executable(render_pipeline_tests
@@ -143,17 +146,37 @@ if(BUILD_TESTING AND NOT USE_FRAMEBUFFER)
target_link_libraries(render_pipeline_tests PRIVATE imx6u_core)
target_include_directories(render_pipeline_tests PRIVATE ${CORE_INCLUDE_DIRS})
add_executable(game_engine_tests
tests/game_engine_tests.cpp
src/Apps/LightGame/src/engine/Level.cpp
src/Apps/LightGame/src/engine/Camera2D.cpp
src/Apps/LightGame/src/engine/Physics2D.cpp
src/Apps/LightGame/src/engine/LevelLoader.cpp
src/Apps/LightGame/src/systems/LightEffectSystem.cpp
)
target_include_directories(game_engine_tests PRIVATE
src/Apps/LightGame/src/engine
src/Apps/LightGame/src/systems
${CORE_INCLUDE_DIRS}
)
if(CMAKE_CONFIGURATION_TYPES)
foreach(config ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER "${config}" config_upper)
set_target_properties(render_pipeline_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${CMAKE_BINARY_DIR}/${config}"
)
set_target_properties(game_engine_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_${config_upper} "${CMAKE_BINARY_DIR}/${config}"
)
endforeach()
else()
set_target_properties(render_pipeline_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
set_target_properties(game_engine_tests PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}"
)
endif()
if(WIN32)
@@ -166,7 +189,9 @@ if(BUILD_TESTING AND NOT USE_FRAMEBUFFER)
if(MSVC)
target_compile_options(render_pipeline_tests PRIVATE /utf-8 /W3)
target_compile_options(game_engine_tests PRIVATE /utf-8 /W3)
endif()
add_test(NAME render_pipeline_tests COMMAND render_pipeline_tests)
add_test(NAME game_engine_tests COMMAND game_engine_tests)
endif()