chore(release): v0.21.0 — empaquetat de recursos (AE26) i neteja de fonts

- Nou format de pack AE26 v1 (XOR + djb2), eina `pack_resources`,
  regeneració automàtica de `build/resources.pack` a cada build.
- `Resource::Helper` amb init/shutdown, fallback a disc només en Debug
  (apunta al source tree); Release exigeix pack present.
- Callers de YAML migrats a `loadFile`+deserialize des de buffer.
- Arrel neta: el pack viu a `build/`, eliminat `sync_data`.
- Placeholder font -> `ari-w9500-condensed-display`; esborrades variants
  bold/condensed no usades a `data/fonts/`.
This commit is contained in:
JailDesigner committed 2026-04-23 08:51:21 +02:00
1 parent aeed0e01c2
commit 4da05b3d76
24 files changed
+574 -625

No files matched your search

+34 -12
View File
@@ -76,6 +76,7 @@ set(APP_SOURCES
source/core/rendering/sdl3gpu/pipelines/crtpi_pipeline.cpp
source/core/resources/resource_helper.cpp
source/core/resources/resource_cache.cpp
source/core/resources/resource_pack.cpp
source/core/resources/palette_loader.cpp
source/utils/easing.cpp
source/utils/utils.cpp
@@ -160,24 +161,43 @@ target_include_directories(${PROJECT_NAME} PRIVATE
target_link_libraries(${PROJECT_NAME} PRIVATE SDL3::SDL3)
# Còpia recursiva de data/ al costat del binari perquè les rutes relatives
# ("data/player/player.gif") funcionin sense desplegament. Es defineix com
# a custom target amb `ALL` — s'executa a cada `cmake --build` encara que
# el binari no hagi canviat, de manera que editar YAML/GIF sense tocar codi
# igualment sincronitza el build. Abans era un POST_BUILD, i si només es
# modificava una dada la còpia no es disparava.
add_custom_target(sync_data ALL
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/data"
"${CMAKE_BINARY_DIR}/data"
COMMENT "Copying data/ next to the binary"
# --- EINA STANDALONE: pack_resources ---
# Executable auxiliar que empaqueta `data/` a `build/resources.pack`.
# EXCLUDE_FROM_ALL: només es compila quan algun target en depèn (ho fa
# `resource_pack`). Build manual: `cmake --build build --target pack_resources`.
add_executable(pack_resources EXCLUDE_FROM_ALL
tools/pack_resources/pack_resources.cpp
source/core/resources/resource_pack.cpp
)
add_dependencies(${PROJECT_NAME} sync_data)
target_include_directories(pack_resources PRIVATE "${CMAKE_SOURCE_DIR}/source")
target_compile_options(pack_resources PRIVATE -Wall -Wextra -Wpedantic)
# --- REGENERACIÓ AUTOMÀTICA DE build/resources.pack ---
# A cada build re-empaquetem data/ si algun fitxer dins ha canviat. Evita
# debugar amb un pack obsolet. CONFIGURE_DEPENDS força CMake a re-globbar
# a la pròxima invocació (recull fitxers nous afegits a data/).
file(GLOB_RECURSE DATA_FILES CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/data/*")
set(RESOURCE_PACK "${CMAKE_BINARY_DIR}/resources.pack")
add_custom_command(
OUTPUT ${RESOURCE_PACK}
COMMAND $<TARGET_FILE:pack_resources>
"${CMAKE_SOURCE_DIR}/data"
"${RESOURCE_PACK}"
DEPENDS pack_resources ${DATA_FILES}
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Empaquetant data/ → build/resources.pack"
VERBATIM
)
add_custom_target(resource_pack ALL DEPENDS ${RESOURCE_PACK})
add_dependencies(${PROJECT_NAME} resource_pack)
target_compile_options(${PROJECT_NAME} PRIVATE -Wall -Wextra -Wpedantic)
target_compile_definitions(${PROJECT_NAME} PRIVATE
$<$<CONFIG:Debug>:_DEBUG>
$<$<CONFIG:Release>:RELEASE_BUILD>
# En Debug el fallback a disc apunta al source tree (sense re-packejar).
AEE_SOURCE_DIR="${CMAKE_SOURCE_DIR}/"
)
# --- STATIC ANALYSIS / FORMAT TARGETS ---
@@ -271,6 +291,7 @@ if(BUILD_TESTS)
add_executable(test_entities_smoke
tests/test_entities_smoke.cpp
source/core/resources/resource_helper.cpp
source/core/resources/resource_pack.cpp
source/game/map/map.cpp
${ENTITY_SOURCES}
)
@@ -295,6 +316,7 @@ if(BUILD_TESTS)
source/game/scenes/placeholder_input.cpp
source/core/input/key_config.cpp
source/core/resources/resource_helper.cpp
source/core/resources/resource_pack.cpp
)
target_include_directories(test_scene_flow PRIVATE
"${CMAKE_SOURCE_DIR}/source"