unificats els resources en un namespace

This commit is contained in:
2025-11-11 10:04:57 +01:00
parent 1821b84e73
commit 54fc6d2902
35 changed files with 356 additions and 341 deletions

View File

@@ -12,7 +12,7 @@
#include "core/rendering/surface_animated_sprite.hpp" // Para SAnimatedSprite
#include "core/rendering/surface_moving_sprite.hpp" // Para SMovingSprite
#include "core/rendering/text.hpp" // Para Text
#include "core/resources/resource.hpp" // Para Resource
#include "core/resources/resource_cache.hpp" // Para Resource
#include "core/system/global_events.hpp" // Para check
#include "game/options.hpp" // Para Options, options, OptionsGame, Sectio...
#include "game/scene_manager.hpp" // Para SceneManager
@@ -34,13 +34,12 @@ Ending2::Ending2()
colors_.push_back(stringToColor(color));
}
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK));// Cambia el color del borde
iniSpriteList();// Inicializa la lista de sprites
loadSprites();// Carga todos los sprites desde una lista
placeSprites();// Coloca los sprites en su sito
createSpriteTexts();// Crea los sprites con las texturas con los textos
createTexts();// Crea los sprites con las texturas con los textos del final
Screen::get()->setBorderColor(static_cast<Uint8>(PaletteColor::BLACK)); // Cambia el color del borde
iniSpriteList(); // Inicializa la lista de sprites
loadSprites(); // Carga todos los sprites desde una lista
placeSprites(); // Coloca los sprites en su sito
createSpriteTexts(); // Crea los sprites con las texturas con los textos
createTexts(); // Crea los sprites con las texturas con los textos del final
}
// Actualiza el objeto
@@ -288,7 +287,7 @@ void Ending2::loadSprites() {
// Carga los sprites
for (const auto& file : sprite_list_) {
sprites_.emplace_back(std::make_shared<SurfaceAnimatedSprite>(Resource::get()->getAnimations(file + ".ani")));
sprites_.emplace_back(std::make_shared<SurfaceAnimatedSprite>(Resource::Cache::get()->getAnimations(file + ".ani")));
sprite_max_width_ = std::max(sprites_.back()->getWidth(), sprite_max_width_);
sprite_max_height_ = std::max(sprites_.back()->getHeight(), sprite_max_height_);
}
@@ -358,7 +357,7 @@ void Ending2::renderTexts() {
void Ending2::placeSprites() {
for (int i = 0; i < static_cast<int>(sprites_.size()); ++i) {
const float X = i % 2 == 0 ? FIRST_COL : SECOND_COL;
const float Y = ((i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT + Resource::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE)) + Options::game.height + INITIAL_Y_OFFSET;
const float Y = ((i / 1) * (sprite_max_height_ + DIST_SPRITE_TEXT + Resource::Cache::get()->getText("smb2")->getCharacterSize() + DIST_SPRITE_SPRITE)) + Options::game.height + INITIAL_Y_OFFSET;
const float W = sprites_.at(i)->getWidth();
const float H = sprites_.at(i)->getHeight();
const float DX = -(W / 2);
@@ -379,7 +378,7 @@ void Ending2::placeSprites() {
void Ending2::createSpriteTexts() {
// Crea los sprites de texto a partir de la lista
for (size_t i = 0; i < sprite_list_.size(); ++i) {
auto text = Resource::get()->getText("smb2");
auto text = Resource::Cache::get()->getText("smb2");
// Procesa y ajusta el texto del sprite actual
std::string txt = sprite_list_[i];
@@ -420,7 +419,7 @@ void Ending2::createTexts() {
std::vector<std::string> list;
list.emplace_back("STARRING");
auto text = Resource::get()->getText("smb2");
auto text = Resource::Cache::get()->getText("smb2");
// Crea los sprites de texto a partir de la lista
for (size_t i = 0; i < list.size(); ++i) {