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

@ -26,7 +26,9 @@
#include "../../gameplay/core/Game.h"
#include "../../gameplay/effects/LineEffect.h"
#include <SDL3/SDL.h>
#include <SDL3_image/SDL_image.h>
#include <SDL3_ttf/SDL_ttf.h>
#include "../../utils/ImagePathResolver.h"
#include <iostream>
#include <cmath>
#include <fstream>
@ -1044,17 +1046,20 @@ void ApplicationManager::setupStateHandlers() {
if (m_cachedBgLevel != bgLevel) {
if (m_nextLevelBackgroundTex) { SDL_DestroyTexture(m_nextLevelBackgroundTex); m_nextLevelBackgroundTex = nullptr; }
char bgPath[256];
std::snprintf(bgPath, sizeof(bgPath), "assets/images/tetris_main_back_level%d.bmp", bgLevel);
SDL_Surface* s = SDL_LoadBMP(bgPath);
std::snprintf(bgPath, sizeof(bgPath), "assets/images/tetris_main_back_level%d.jpg", bgLevel);
const std::string resolvedBgPath = AssetPath::resolveImagePath(bgPath);
SDL_Surface* s = IMG_Load(resolvedBgPath.c_str());
if (s && renderer.getSDLRenderer()) {
m_nextLevelBackgroundTex = SDL_CreateTextureFromSurface(renderer.getSDLRenderer(), s);
SDL_DestroySurface(s);
m_levelFadeAlpha = 0.0f;
m_levelFadeElapsed = 0.0f;
m_cachedBgLevel = bgLevel;
if (resolvedBgPath != bgPath) {
SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "Loaded level %d background via %s", bgLevel, resolvedBgPath.c_str());
}
} else {
m_cachedBgLevel = -1; // dont change if missing
m_cachedBgLevel = -1; // don't change if missing
m_cachedBgLevel = -1; // don't change if missing
if (s) SDL_DestroySurface(s);
}
}