forked from jaildesigner-jailgames/jaildoctors_dilemma
45 lines
872 B
C++
45 lines
872 B
C++
#pragma once
|
|
|
|
#include <SDL2/SDL.h>
|
|
#include "asset.h"
|
|
#include "texture.h"
|
|
#include "utils.h"
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#ifndef RESOURCE_H
|
|
#define RESOURCE_H
|
|
|
|
struct texture_t
|
|
{
|
|
std::string name; // Nombre de la textura
|
|
Texture *texture; // La textura
|
|
};
|
|
|
|
class Resource
|
|
{
|
|
private:
|
|
// Objetos y punteros
|
|
SDL_Renderer *renderer; // El renderizador de la ventana
|
|
Asset *asset; // Objeto con la ruta a todos los ficheros de recursos
|
|
options_t *options; // Puntero a las opciones del juego
|
|
|
|
// Variables
|
|
std::vector<texture_t> textures;
|
|
|
|
public:
|
|
// Constructor
|
|
Resource(SDL_Renderer *renderer, Asset *asset, options_t *options);
|
|
|
|
// Carga todos los recursos necesarios
|
|
void loadTextures(std::vector<std::string> textureList);
|
|
|
|
// Libera los recursos
|
|
void freeTextures();
|
|
|
|
// Obtiene una textura
|
|
Texture* getTexture(std::string name);
|
|
};
|
|
|
|
#endif
|