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:
1 parent
aeed0e01c2
commit
4da05b3d76
24 files changed
+574
-625
No files matched your search
@@ -4,7 +4,6 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <fstream>
|
||||
#include <stdexcept>
|
||||
#include <utility>
|
||||
|
||||
@@ -47,18 +46,19 @@ namespace {
|
||||
} // namespace
|
||||
|
||||
void Player::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("Player: no s'ha pogut obrir " + FULL);
|
||||
auto bytes = Resource::Helper::loadFile(yaml_path);
|
||||
if (bytes.empty()) {
|
||||
throw std::runtime_error("Player: 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);
|
||||
|
||||
sprite_w = yaml["frameWidth"].get_value<int>();
|
||||
sprite_h = yaml["frameHeight"].get_value<int>();
|
||||
|
||||
if (!yaml.contains("collision")) {
|
||||
throw std::runtime_error("Player: manca bloc `collision:` a " + FULL);
|
||||
throw std::runtime_error("Player: manca bloc `collision:` a " + yaml_path);
|
||||
}
|
||||
const auto& c = yaml["collision"];
|
||||
collision_size = c["size"].get_value<int>();
|
||||
|
||||
Reference in new issue
Block a user