fox fonts on macc

This commit is contained in:
2025-12-10 19:40:43 +01:00
parent 3c6466e2a0
commit 108caf7ffd

View File

@ -131,14 +131,15 @@ bool AssetManager::loadFont(const std::string& id, const std::string& filepath,
}
// Create new font
std::string resolvedPath = AssetPath::resolveWithBase(filepath);
auto font = std::make_unique<FontAtlas>();
if (!font->init(filepath, baseSize)) {
setError("Failed to initialize font: " + filepath);
if (!font->init(resolvedPath, baseSize)) {
setError("Failed to initialize font: " + resolvedPath);
return false;
}
m_fonts[id] = std::move(font);
logInfo("Loaded font: " + id + " from " + filepath + " (size: " + std::to_string(baseSize) + ")");
logInfo("Loaded font: " + id + " from " + resolvedPath + " (size: " + std::to_string(baseSize) + ")");
return true;
}
@ -167,14 +168,16 @@ bool AssetManager::loadMusicTrack(const std::string& filepath) {
return false;
}
if (!fileExists(filepath)) {
setError("Music file not found: " + filepath);
std::string resolvedPath = AssetPath::resolveWithBase(filepath);
if (!fileExists(resolvedPath)) {
setError("Music file not found: " + resolvedPath);
return false;
}
try {
m_audioSystem->addTrackAsync(filepath);
logInfo("Added music track for loading: " + filepath);
m_audioSystem->addTrackAsync(resolvedPath);
logInfo("Added music track for loading: " + resolvedPath);
return true;
} catch (const std::exception& e) {
setError("Failed to add music track: " + std::string(e.what()));
@ -188,16 +191,18 @@ bool AssetManager::loadSoundEffect(const std::string& id, const std::string& fil
return false;
}
if (!fileExists(filepath)) {
setError("Sound effect file not found: " + filepath);
std::string resolvedPath = AssetPath::resolveWithBase(filepath);
if (!fileExists(resolvedPath)) {
setError("Sound effect file not found: " + resolvedPath);
return false;
}
if (m_soundSystem->loadSound(id, filepath)) {
logInfo("Loaded sound effect: " + id + " from " + filepath);
if (m_soundSystem->loadSound(id, resolvedPath)) {
logInfo("Loaded sound effect: " + id + " from " + resolvedPath);
return true;
} else {
setError("Failed to load sound effect: " + id + " from " + filepath);
setError("Failed to load sound effect: " + id + " from " + resolvedPath);
return false;
}
}
@ -354,8 +359,9 @@ std::string AssetManager::getAssetPath(const std::string& relativePath) {
}
bool AssetManager::fileExists(const std::string& filepath) {
std::string resolved = AssetPath::resolveWithBase(filepath);
// Use SDL file I/O for consistency with main.cpp pattern
SDL_IOStream* file = SDL_IOFromFile(filepath.c_str(), "rb");
SDL_IOStream* file = SDL_IOFromFile(resolved.c_str(), "rb");
if (file) {
SDL_CloseIO(file);
return true;