Trabajando en la cache de animaciones
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#include <SDL2/SDL.h>
|
||||
#include "animatedsprite.h"
|
||||
#include "asset.h"
|
||||
#include "texture.h"
|
||||
#include "utils.h"
|
||||
@@ -16,6 +17,12 @@ struct texture_t
|
||||
Texture *texture; // La textura
|
||||
};
|
||||
|
||||
struct animation_t
|
||||
{
|
||||
std::string name; // Nombre de la textura
|
||||
animatedSprite_t *animation; // La animación
|
||||
};
|
||||
|
||||
class Resource
|
||||
{
|
||||
private:
|
||||
@@ -26,13 +33,17 @@ private:
|
||||
|
||||
// Variables
|
||||
std::vector<texture_t> textures;
|
||||
std::vector<animation_t> animations;
|
||||
|
||||
public:
|
||||
// Constructor
|
||||
Resource(SDL_Renderer *renderer, Asset *asset, options_t *options);
|
||||
|
||||
// Carga todos los recursos necesarios
|
||||
void loadTextures(std::vector<std::string> textureList);
|
||||
// Carga las texturas de una lista
|
||||
void loadTextures(std::vector<std::string> list);
|
||||
|
||||
// Carga las animaciones desde una lista
|
||||
void loadAnimations(std::vector<std::string> list);
|
||||
|
||||
// Recarga las texturas
|
||||
void reLoadTextures();
|
||||
@@ -41,7 +52,10 @@ public:
|
||||
void freeTextures();
|
||||
|
||||
// Obtiene una textura
|
||||
Texture* getTexture(std::string name);
|
||||
Texture *getTexture(std::string name);
|
||||
|
||||
// Obtiene una animación
|
||||
animatedSprite_t *getAnimation(std::string name);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user