Split the frame loop out of main.cpp (app_loop) for SDL main callbacks
main.cpp moves to app_loop.cpp; its body becomes RunClient, a C++20 coroutine suspended at the top of each frame, driven by ava2::app::AppLoop (Start/Iterate/QueueEvent/Finish/Run). The new main.cpp uses SDL main callbacks (AVA2_MAIN_CALLBACKS, default on except Android) or the classic loop. Screenshots are byte-identical through both drivers; 54/54 tests. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
64d25e3571
commit
f973b24abc
+13
-2
@@ -357,13 +357,24 @@ if(AVA2_BUILD_HOST)
|
||||
target_link_libraries(platform_test PRIVATE ava2_platform ava2_input)
|
||||
add_test(NAME ava2.platform COMMAND platform_test)
|
||||
endif()
|
||||
# SDL main callbacks drive src/app/app_loop.cpp (required on iOS); Android keeps the classic loop.
|
||||
if(ANDROID)
|
||||
add_library(main SHARED src/app/main.cpp)
|
||||
set(AVA2_MAIN_CALLBACKS_DEFAULT OFF)
|
||||
else()
|
||||
set(AVA2_MAIN_CALLBACKS_DEFAULT ON)
|
||||
endif()
|
||||
option(AVA2_MAIN_CALLBACKS "Drive the client through SDL_AppInit/SDL_AppIterate" ${AVA2_MAIN_CALLBACKS_DEFAULT})
|
||||
set(AVA2_HOST_SOURCES src/app/main.cpp src/app/app_loop.cpp)
|
||||
if(ANDROID)
|
||||
add_library(main SHARED ${AVA2_HOST_SOURCES})
|
||||
set(AVA2_HOST main)
|
||||
else()
|
||||
add_executable(ava2_client src/app/main.cpp)
|
||||
add_executable(ava2_client ${AVA2_HOST_SOURCES})
|
||||
set(AVA2_HOST ava2_client)
|
||||
endif()
|
||||
if(AVA2_MAIN_CALLBACKS)
|
||||
target_compile_definitions(${AVA2_HOST} PRIVATE AVA2_MAIN_CALLBACKS)
|
||||
endif()
|
||||
target_include_directories(${AVA2_HOST} PRIVATE src src/app src/game src/network src/scripting)
|
||||
target_link_libraries(${AVA2_HOST} PRIVATE SDL3::SDL3 ava2_protocol ava2_render ava2_platform)
|
||||
if(AVA2_EMBED_PYTHON)
|
||||
|
||||
Reference in New Issue
Block a user