Ya carga las imagenes del juego y la demo desde la cache de rescursos

This commit is contained in:
2022-10-26 20:29:07 +02:00
parent c6e8050f95
commit 397e1e89e3
16 changed files with 286 additions and 122 deletions

View File

@@ -3,9 +3,10 @@
#include <sstream>
// Constructor
Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Renderer *renderer, Asset *asset, options_t *options, Input *input, Room *room, Debug *debug)
Player::Player(player_t ini, std::string png, std::string animation, SDL_Renderer *renderer, Resource *resource, Asset *asset, options_t *options, Input *input, Room *room, Debug *debug)
{
// Obten punteros a objetos
this->resource = resource;
this->asset = asset;
this->renderer = renderer;
this->input = input;
@@ -14,7 +15,7 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
this->options = options;
// Crea objetos
texture = new Texture(renderer, asset->get(tileset));
texture = resource->getTexture(png);
sprite = new AnimatedSprite(texture, renderer, animation);
// Inicializa variables
@@ -102,7 +103,6 @@ Player::Player(player_t ini, std::string tileset, std::string animation, SDL_Ren
// Destructor
Player::~Player()
{
delete texture;
delete sprite;
for (auto s : jumpSound)