acabat amb resource.pack

This commit is contained in:
2026-04-16 16:21:44 +02:00
parent b2d5f5af61
commit 4244bcaea3
11 changed files with 55 additions and 167 deletions

View File

@@ -8,7 +8,7 @@
#include <sstream>
#include <string>
#include "core/jail/jfile.hpp"
#include "core/resources/resource_helper.hpp"
// Forward declarations de gif.h (inclòs des de jdraw8.cpp, no es pot incloure dos vegades)
struct rgb;
@@ -62,13 +62,13 @@ auto Text::nextCodepoint(const char*& ptr) -> uint32_t {
// --- Càrrega de font ---
void Text::loadFont(const char* fnt_file) {
auto buffer = file_readfile(fnt_file);
auto buffer = ResourceHelper::loadFile(fnt_file);
if (buffer.empty()) {
std::cerr << "Text: unable to load font file: " << fnt_file << '\n';
return;
}
std::istringstream stream(std::string(buffer.data(), buffer.size()));
std::istringstream stream(std::string(reinterpret_cast<const char*>(buffer.data()), buffer.size()));
std::string line;
int glyph_index = 0;
@@ -126,14 +126,14 @@ void Text::loadFont(const char* fnt_file) {
}
void Text::loadBitmap(const char* gif_file) {
auto buffer = file_readfile(gif_file);
auto buffer = ResourceHelper::loadFile(gif_file);
if (buffer.empty()) {
std::cerr << "Text: unable to load bitmap: " << gif_file << '\n';
return;
}
// Extrau dimensions del header GIF (bytes 6-7 = width, 8-9 = height, little-endian)
auto* raw = reinterpret_cast<unsigned char*>(buffer.data());
auto* raw = buffer.data();
int w = raw[6] | (raw[7] << 8);
int h = raw[8] | (raw[9] << 8);