converted from bmp to jpg

This commit is contained in:
2025-11-22 21:46:00 +01:00
parent 28dd513619
commit 77a9237e25
47 changed files with 187 additions and 112 deletions

View File

@ -3,8 +3,10 @@
#include "../../audio/Audio.h"
#include "../../audio/SoundEffect.h"
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_ttf/SDL_ttf.h>
#include <filesystem>
#include "../../utils/ImagePathResolver.h"
AssetManager::AssetManager()
: m_renderer(nullptr)
@ -379,19 +381,25 @@ SDL_Texture* AssetManager::loadTextureFromFile(const std::string& filepath) {
return nullptr;
}
// Load using SDL_LoadBMP (matching main.cpp pattern)
SDL_Surface* surface = SDL_LoadBMP(filepath.c_str());
if (!surface) {
setError("Failed to load surface from: " + filepath + " - " + SDL_GetError());
const std::string resolvedPath = AssetPath::resolveImagePath(filepath);
SDL_Texture* texture = IMG_LoadTexture(m_renderer, resolvedPath.c_str());
if (!texture) {
std::string message = "Failed to load texture from: ";
message += filepath;
message += " (resolved: ";
message += resolvedPath;
message += ") - ";
message += SDL_GetError();
setError(message);
return nullptr;
}
SDL_Texture* texture = SDL_CreateTextureFromSurface(m_renderer, surface);
SDL_DestroySurface(surface);
if (!texture) {
setError("Failed to create texture from surface: " + filepath + " - " + SDL_GetError());
return nullptr;
if (resolvedPath != filepath) {
std::string message = "Loaded alternative image path for ";
message += filepath;
message += ": ";
message += resolvedPath;
logInfo(message);
}
return texture;