41 lines
930 B
C++
41 lines
930 B
C++
#pragma once
|
|
|
|
#include <SDL3/SDL_rect.h> // Para SDL_FRect
|
|
#include <SDL3/SDL_render.h> // Para SDL_Renderer, SDL_Texture
|
|
#include <string> // Para std::string
|
|
|
|
class Texture
|
|
{
|
|
private:
|
|
SDL_Renderer *renderer_;
|
|
SDL_Texture *texture_;
|
|
|
|
// Dimensiones de la imagen
|
|
int width_;
|
|
int height_;
|
|
|
|
public:
|
|
// Inicializa las variables
|
|
Texture(SDL_Renderer *renderer);
|
|
Texture(SDL_Renderer *renderer, std::string file_path);
|
|
|
|
// Libera la memoria
|
|
~Texture();
|
|
|
|
// Carga una imagen desde la ruta especificada
|
|
bool loadFromFile(std::string path);
|
|
|
|
// Libera la textura
|
|
void free();
|
|
|
|
// Renderiza la textura en el punto especificado
|
|
void render(SDL_FRect *src = nullptr, SDL_FRect *dst = nullptr);
|
|
|
|
// Obtiene las dimensiones de la imagen
|
|
int getWidth();
|
|
int getHeight();
|
|
|
|
// Modula el color de la textura
|
|
void setColor(int r, int g, int b);
|
|
};
|