Actualizadas librerias comunes a las ultimas versiones

This commit is contained in:
2022-09-21 17:31:35 +02:00
parent 378f27a01e
commit f647a225f9
15 changed files with 873 additions and 211 deletions

View File

@@ -7,61 +7,55 @@
#ifndef LTEXTURE_H
#define LTEXTURE_H
// Texture wrapper class
// Clase LTexture
class LTexture
{
public:
// Initializes variables
LTexture();
private:
SDL_Texture *texture; // La textura
SDL_Renderer *renderer; // Renderizador donde dibujar la textura
int width; // Ancho de la imagen
int height; // Alto de la imagen
std::string path; // Ruta de la imagen de la textura
// Deallocates memory
public:
// Constructor
LTexture(SDL_Renderer *renderer, std::string path = "");
// Destructor
~LTexture();
// Loads image at specified path
// Carga una imagen desde un fichero
bool loadFromFile(std::string path, SDL_Renderer *renderer);
// Creates blank texture
// Crea una textura en blanco
bool createBlank(SDL_Renderer *renderer, int width, int height, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING);
// Deallocates texture
// Libera la memoria de la textura
void unload();
// Set color modulation
// Establece el color para la modulacion
void setColor(Uint8 red, Uint8 green, Uint8 blue);
// Set blending
// Establece el blending
void setBlendMode(SDL_BlendMode blending);
// Set alpha modulation
// Establece el alpha para la modulación
void setAlpha(Uint8 alpha);
// Renders texture at given point
// Renderiza la textura en un punto específico
void render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip = NULL, float zoomW = 1, float zoomH = 1, double angle = 0.0, SDL_Point *center = NULL, SDL_RendererFlip flip = SDL_FLIP_NONE);
// Set self as render target
// Establece la textura como objetivo de renderizado
void setAsRenderTarget(SDL_Renderer *renderer);
// Gets image dimensions
// Obtiene el ancho de la imagen
int getWidth();
// Obtiene el alto de la imagen
int getHeight();
// Pixel manipulators
bool lockTexture();
bool unlockTexture();
void *getPixels();
void copyPixels(void *pixels);
int getPitch();
Uint32 getPixel32(unsigned int x, unsigned int y);
private:
// The actual hardware texture
SDL_Texture *mTexture;
void *mPixels;
int mPitch;
// Image dimensions
int mWidth;
int mHeight;
// Recarga la textura
bool reLoad();
};
#endif