Afegint smart pointers
Actualitzat Resources Actualitzades les classes Sprite i derivades Afegida nova tipografia Actualitzat Asset Actualitzat Text
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
#include <SDL2/SDL_timer.h> // Para SDL_GetTicks
|
||||
#include <algorithm> // Para min
|
||||
#include <iostream> // Para char_traits, basic_ostream, operator<<
|
||||
#include "animatedsprite.h" // Para AnimatedSprite
|
||||
#include "animated_sprite.h" // Para AnimatedSprite
|
||||
#include "const.h" // Para GAMECANVAS_HEIGHT, GAMECANVAS_WIDTH
|
||||
#include "input.h" // Para Input, REPEAT_FALSE, inputs_e
|
||||
#include "resource.h" // Para Resource
|
||||
@@ -27,13 +27,13 @@ Credits::Credits()
|
||||
input_(Input::get())
|
||||
{
|
||||
// Reserva memoria para los punteros
|
||||
text_ = new Text(resource_->getOffset("smb2.txt"), resource_->getTexture("smb2.png"), renderer_);
|
||||
sprite_ = new AnimatedSprite(renderer_, resource_->getAnimation("shine.ani"));
|
||||
text_ = resource_->getText("smb2.txt");
|
||||
sprite_ = std::make_shared<AnimatedSprite>(resource_->getTexture("shine.png"), resource_->getAnimation("shine.ani"));
|
||||
|
||||
// Inicializa variables
|
||||
options.section.section = Section::CREDITS;
|
||||
options.section.subsection = Subsection::NONE;
|
||||
sprite_->setRect({194, 174, 8, 8});
|
||||
sprite_->setPosition({194, 174, 8, 8});
|
||||
|
||||
// Cambia el color del borde
|
||||
screen_->setBorderColor(stringToColor(options.video.palette, "black"));
|
||||
@@ -67,8 +67,6 @@ Credits::Credits()
|
||||
// Destructor
|
||||
Credits::~Credits()
|
||||
{
|
||||
delete text_;
|
||||
delete sprite_;
|
||||
SDL_DestroyTexture(text_texture_);
|
||||
SDL_DestroyTexture(cover_texture_);
|
||||
}
|
||||
@@ -185,7 +183,7 @@ void Credits::fillTexture()
|
||||
|
||||
for (auto t : texts_)
|
||||
{
|
||||
text_->writeDX(TXT_CENTER | TXT_COLOR, PLAY_AREA_CENTER_X, i * size, t.label, 1, t.color);
|
||||
text_->writeDX(TEXT_CENTER | TEXT_COLOR, PLAY_AREA_CENTER_X, i * size, t.label, 1, t.color);
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user