- [WIP] Modificaciones a la clase Textura

This commit is contained in:
2022-12-02 12:30:25 +01:00
parent 9bb9d26417
commit a61c2e8d46
2 changed files with 30 additions and 78 deletions

View File

@@ -11,26 +11,28 @@ class Texture
{
private:
// Objetos y punteros
SDL_Texture *texture; // La textura
uint8_t *pixels; // Los pixels de esta textura
SDL_Texture *texture; // La textura SDL sobre la que pintaremos (debe haber sido creada con SDL_TEXTUREACCESS_STREAMING)
SDL_Renderer *renderer; // Renderizador donde dibujar la textura
// Variables
int width; // Ancho de la imagen
int height; // Alto de la imagen
std::string path; // Ruta de la imagen de la textura
uint32_t color; // Color para el pintado de 1 bit (sprites y tal)
public:
// Constructor
Texture(SDL_Renderer *renderer, std::string path = "", bool verbose = false);
Texture(SDL_Renderer *renderer, SDL_Texture *texture, std::string path = "", bool verbose = false);
// Destructor
~Texture();
// Carga una imagen desde un fichero
bool loadFromFile(std::string path, SDL_Renderer *renderer, bool verbose = false);
bool loadFromFile(std::string path, bool verbose = false);
// Crea una textura en blanco
bool createBlank(SDL_Renderer *renderer, int width, int height, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING);
bool createBlank(int width, int height, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING);
// Libera la memoria de la textura
void unload();