Add platform layer: lifecycle, data dirs, safe area (mobile step 2)
Move the macOS/Android data and config directory code out of main.cpp into src/app/platform. Handle background/foreground: save config and interface status, pause audio, cancel touch input and skip rendering while keeping the network pumped. Map the window safe area through the letterboxed presentation into TouchLayout and expose touch.GetSafeArea() so the mobile HUD stays clear of notches and gesture bars. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
260d421bde
commit
b79fbce0b0
+9
-1
@@ -345,6 +345,14 @@ if(BUILD_TESTING AND NOT ANDROID)
|
||||
endif()
|
||||
if(AVA2_BUILD_HOST)
|
||||
find_package(SDL3 CONFIG REQUIRED)
|
||||
add_library(ava2_platform src/app/platform/platform.cpp)
|
||||
target_include_directories(ava2_platform PUBLIC src)
|
||||
target_link_libraries(ava2_platform PUBLIC SDL3::SDL3)
|
||||
if(BUILD_TESTING)
|
||||
add_executable(platform_test tests/platform_test.cpp)
|
||||
target_link_libraries(platform_test PRIVATE ava2_platform ava2_input)
|
||||
add_test(NAME ava2.platform COMMAND platform_test)
|
||||
endif()
|
||||
if(ANDROID)
|
||||
add_library(main SHARED src/app/main.cpp)
|
||||
set(AVA2_HOST main)
|
||||
@@ -353,7 +361,7 @@ if(AVA2_BUILD_HOST)
|
||||
set(AVA2_HOST ava2_client)
|
||||
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)
|
||||
target_link_libraries(${AVA2_HOST} PRIVATE SDL3::SDL3 ava2_protocol ava2_render ava2_platform)
|
||||
if(AVA2_EMBED_PYTHON)
|
||||
target_link_libraries(${AVA2_HOST} PRIVATE ava2_python)
|
||||
target_compile_definitions(${AVA2_HOST} PRIVATE AVA2_HAS_PYTHON)
|
||||
|
||||
Reference in New Issue
Block a user