Quitadas todas las variables globales y transformadas en punteros

This commit is contained in:
2022-10-20 18:24:12 +02:00
parent 596bf2c4a5
commit b4e76a4c7d
25 changed files with 848 additions and 781 deletions

View File

@@ -8,61 +8,64 @@
#ifndef LTEXTURE_H
#define LTEXTURE_H
//Texture wrapper class
// Texture wrapper class
class LTexture
{
public:
//Initializes variables
LTexture();
public:
// Initializes variables
LTexture(SDL_Renderer *gRenderer);
//Deallocates memory
~LTexture();
// Deallocates memory
~LTexture();
//Loads image at specified path
bool loadFromFile( std::string path );
// Loads image at specified path
bool loadFromFile(std::string path);
//Creates blank texture
bool createBlank( int width, int height, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING );
// Creates blank texture
bool createBlank(int width, int height, SDL_TextureAccess = SDL_TEXTUREACCESS_STREAMING);
//Deallocates texture
void free();
// Deallocates texture
void free();
//Set color modulation
void setColor( Uint8 red, Uint8 green, Uint8 blue );
// Set color modulation
void setColor(Uint8 red, Uint8 green, Uint8 blue);
//Set blending
void setBlendMode( SDL_BlendMode blending );
// Set blending
void setBlendMode(SDL_BlendMode blending);
//Set alpha modulation
void setAlpha( Uint8 alpha );
//Renders texture at given point
void render( int x, int y, SDL_Rect* clip = NULL, double angle = 0.0, SDL_Point* center = NULL, SDL_RendererFlip flip = SDL_FLIP_NONE );
// Set alpha modulation
void setAlpha(Uint8 alpha);
//Set self as render target
void setAsRenderTarget();
// Renders texture at given point
void render(int x, int y, SDL_Rect *clip = NULL, double angle = 0.0, SDL_Point *center = NULL, SDL_RendererFlip flip = SDL_FLIP_NONE);
//Gets image dimensions
int getWidth();
int getHeight();
// Set self as render target
void setAsRenderTarget();
//Pixel manipulators
bool lockTexture();
bool unlockTexture();
void* getPixels();
void copyPixels( void* pixels );
int getPitch();
Uint32 getPixel32( unsigned int x, unsigned int y );
// Gets image dimensions
int getWidth();
int getHeight();
private:
//The actual hardware texture
SDL_Texture* mTexture;
void* mPixels;
int mPitch;
// Pixel manipulators
bool lockTexture();
bool unlockTexture();
void *getPixels();
void copyPixels(void *pixels);
int getPitch();
Uint32 getPixel32(unsigned int x, unsigned int y);
//Image dimensions
int mWidth;
int mHeight;
private:
// El renderizador de la ventana
SDL_Renderer *gRenderer = NULL;
// The actual hardware texture
SDL_Texture *mTexture;
void *mPixels;
int mPitch;
// Image dimensions
int mWidth;
int mHeight;
};
#endif