forked from jaildesigner-jailgames/jaildoctors_dilemma
Trabajando en la cache de animaciones
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "animatedsprite.h"
|
||||
|
||||
// Carga la animación desde un fichero
|
||||
animatedSprite_t loadFromFile(Texture *texture, std::string filePath)
|
||||
animatedSprite_t loadAnimationFromFile(Texture *texture, std::string filePath)
|
||||
{
|
||||
// Inicializa variables
|
||||
animatedSprite_t as;
|
||||
@@ -80,7 +80,6 @@ animatedSprite_t loadFromFile(Texture *texture, std::string filePath)
|
||||
|
||||
// Añade la animación al vector de animaciones
|
||||
as.animations.push_back(buffer);
|
||||
// animation.push_back(buffer);
|
||||
}
|
||||
|
||||
// En caso contrario se parsea el fichero para buscar las variables y los valores
|
||||
@@ -173,19 +172,19 @@ AnimatedSprite::AnimatedSprite(Texture *texture, SDL_Renderer *renderer, std::st
|
||||
}
|
||||
|
||||
// Constructor
|
||||
AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, animatedSprite_t as)
|
||||
AnimatedSprite::AnimatedSprite(SDL_Renderer *renderer, animatedSprite_t *animation)
|
||||
{
|
||||
// Copia los punteros
|
||||
setTexture(as.texture);
|
||||
setTexture(animation->texture);
|
||||
setRenderer(renderer);
|
||||
|
||||
// Inicializa variables
|
||||
currentAnimation = 0;
|
||||
|
||||
// Copia los datos de las animaciones
|
||||
for (auto animation : as.animations)
|
||||
for (auto a : animation->animations)
|
||||
{
|
||||
this->animation.push_back(animation);
|
||||
this->animation.push_back(a);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user