converted from bmp to jpg
This commit is contained in:
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user