Afegint smart pointers

Actualitzat Resources
Actualitzades les classes Sprite i derivades
Afegida nova tipografia
Actualitzat Asset
Actualitzat Text
This commit is contained in:
2025-02-24 14:09:29 +01:00
parent 48971cd5d1
commit e6f101ece6
42 changed files with 2669 additions and 3158 deletions

View File

@@ -33,11 +33,11 @@ LoadingScreen::LoadingScreen()
mono_loading_screen_texture_ = resource_->getTexture("loading_screen_bn_zxarne.png");
color_loading_screen_texture_ = resource_->getTexture("loading_screen_color_zxarne.png");
}
mono_loading_screen_sprite_ = new Sprite(0, 0, mono_loading_screen_texture_->getWidth(), mono_loading_screen_texture_->getHeight(), mono_loading_screen_texture_, renderer_);
color_loading_screen_sprite_ = new Sprite(0, 0, color_loading_screen_texture_->getWidth(), color_loading_screen_texture_->getHeight(), color_loading_screen_texture_, renderer_);
loading_sound1_ = JA_LoadMusic(asset_->get("loading_sound1.ogg").c_str());
loading_sound2_ = JA_LoadMusic(asset_->get("loading_sound2.ogg").c_str());
loading_sound3_ = JA_LoadMusic(asset_->get("loading_sound3.ogg").c_str());
mono_loading_screen_sprite_ = std::make_shared<Sprite>(0, 0, mono_loading_screen_texture_->getWidth(), mono_loading_screen_texture_->getHeight(), mono_loading_screen_texture_, renderer_);
color_loading_screen_sprite_ = std::make_shared<Sprite>(0, 0, color_loading_screen_texture_->getWidth(), color_loading_screen_texture_->getHeight(), color_loading_screen_texture_, renderer_);
loading_sound1_ = resource_->getMusic("loading_sound1.ogg");
loading_sound2_ = resource_->getMusic("loading_sound2.ogg");
loading_sound3_ = resource_->getMusic("loading_sound3.ogg");
// Inicializa variables
options.section.section = Section::LOADING_SCREEN;
@@ -66,16 +66,6 @@ LoadingScreen::LoadingScreen()
screen_->setBorderColor(stringToColor(options.video.palette, "black"));
}
// Destructor
LoadingScreen::~LoadingScreen()
{
delete mono_loading_screen_sprite_;
delete color_loading_screen_sprite_;
JA_DeleteMusic(loading_sound1_);
JA_DeleteMusic(loading_sound2_);
JA_DeleteMusic(loading_sound3_);
}
// Comprueba el manejador de eventos
void LoadingScreen::checkEvents()
{
@@ -108,7 +98,7 @@ void LoadingScreen::updateLoad()
load_rect_.x = step * (counter_ % numSteps);
load_rect_.y = line_index_[load_counter_];
mono_loading_screen_sprite_->setClip(load_rect_);
mono_loading_screen_sprite_->setRect(load_rect_);
mono_loading_screen_sprite_->setPosition(load_rect_);
}
// Una vez actualizadas las 192 lineas, pasa a la segunda fase de la carga
else if (load_counter_ == 192)
@@ -116,8 +106,8 @@ void LoadingScreen::updateLoad()
loading_first_part_ = false;
load_counter_ = 0;
load_rect_ = {0, 0, 16, 8};
color_loading_screen_sprite_->setRect(load_rect_);
color_loading_screen_sprite_->setClip(load_rect_);
color_loading_screen_sprite_->setPosition(load_rect_);
JA_PlayMusic(loading_sound3_);
}
}
@@ -128,7 +118,7 @@ void LoadingScreen::updateLoad()
load_rect_.x = (load_counter_ * 8) % 256;
load_rect_.y = (load_counter_ / 32) * 8;
color_loading_screen_sprite_->setClip(load_rect_);
color_loading_screen_sprite_->setRect(load_rect_);
color_loading_screen_sprite_->setPosition(load_rect_);
// Comprueba si ha terminado la intro
if (load_counter_ >= 768)
@@ -270,7 +260,7 @@ void LoadingScreen::recreateLoadingScreen()
load_rect_.x = step * (i % numSteps);
load_rect_.y = line_index_[load_counter_];
mono_loading_screen_sprite_->setClip(load_rect_);
mono_loading_screen_sprite_->setRect(load_rect_);
mono_loading_screen_sprite_->setPosition(load_rect_);
mono_loading_screen_sprite_->render();
}
}
@@ -282,7 +272,7 @@ void LoadingScreen::recreateLoadingScreen()
load_rect_.x = (i * 8) % 256;
load_rect_.y = (i / 32) * 8;
color_loading_screen_sprite_->setClip(load_rect_);
color_loading_screen_sprite_->setRect(load_rect_);
color_loading_screen_sprite_->setPosition(load_rect_);
color_loading_screen_sprite_->render();
}
}