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

+8 -8
View File
@@ -1,6 +1,5 @@
#include "game/map/map.hpp"
#include <fstream>
#include <iostream>
#include <stdexcept>
@@ -22,14 +21,15 @@ namespace {
namespace Map {
void loadFrom(const std::string& yaml_path) {
const auto FULL = Resource::Helper::resolve(yaml_path);
std::ifstream file(FULL);
if (!file.is_open()) {
throw std::runtime_error("Map: no s'ha pogut obrir " + FULL);
auto bytes = Resource::Helper::loadFile(yaml_path);
if (bytes.empty()) {
throw std::runtime_error("Map: no s'ha pogut obrir " + yaml_path);
}
auto yaml = fkyaml::node::deserialize(file);
const auto* begin = reinterpret_cast<const char*>(bytes.data());
const auto* end = begin + bytes.size();
auto yaml = fkyaml::node::deserialize(begin, end);
if (!yaml.contains("geometry")) {
throw std::runtime_error("Map: manca bloc `geometry:` a " + FULL);
throw std::runtime_error("Map: manca bloc `geometry:` a " + yaml_path);
}
const auto& g = yaml["geometry"];
@@ -78,7 +78,7 @@ namespace Map {
std::cout << "Map: geometria " << grid_cols << "x" << grid_rows
<< " sarcs " << sarc_w << "x" << sarc_h
<< " pitch " << pitch_x << "x" << pitch_y
<< " des de " << FULL << '\n';
<< " des de " << yaml_path << '\n';
}
auto getSarcRect(int col, int row) -> SDL_FRect {
+7 -8
View File
@@ -2,7 +2,6 @@
#include <algorithm>
#include <cstddef>
#include <fstream>
#include <iostream>
#include <sstream>
#include <stdexcept>
@@ -68,13 +67,13 @@ namespace {
} // namespace
Tilemap::Tilemap(const std::string& yaml_path) {
const auto FULL = Resource::Helper::resolve(yaml_path);
std::ifstream file(FULL);
if (!file.is_open()) {
throw std::runtime_error("Tilemap: no s'ha pogut obrir " + FULL);
auto bytes = Resource::Helper::loadFile(yaml_path);
if (bytes.empty()) {
throw std::runtime_error("Tilemap: no s'ha pogut obrir " + yaml_path);
}
auto yaml = fkyaml::node::deserialize(file);
const auto* begin = reinterpret_cast<const char*>(bytes.data());
const auto* end = begin + bytes.size();
auto yaml = fkyaml::node::deserialize(begin, end);
const auto TILESET_PATH = yaml["tileset"].get_value<std::string>();
const auto TILE_SIZE = yaml["tile_size"].get_value<int>();
@@ -113,7 +112,7 @@ Tilemap::Tilemap(const std::string& yaml_path) {
}
std::cout << "Tilemap: " << COLS << "x" << ROWS << " tiles ("
<< width_px_ << "x" << height_px_ << " px) des de " << FULL << '\n';
<< width_px_ << "x" << height_px_ << " px) des de " << yaml_path << '\n';
}
void Tilemap::render() const {