jugant amb clang-tidy
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
#include <array> // Para array
|
||||
#include <memory> // Para shared_ptr
|
||||
#include <string> // Para string, basic_string
|
||||
#include <utility>
|
||||
#include <vector> // Para vector
|
||||
|
||||
struct Color;
|
||||
@@ -20,7 +21,7 @@ struct Surface {
|
||||
|
||||
// Constructor
|
||||
Surface(Uint16 width, Uint16 height, std::shared_ptr<Uint8[]> pixels)
|
||||
: data(pixels), w(width), h(height) {}
|
||||
: data(std::move(pixels)), w(width), h(height) {}
|
||||
};
|
||||
|
||||
// Clase Texture: gestiona texturas, paletas y renderizado
|
||||
@@ -31,12 +32,12 @@ class Texture {
|
||||
~Texture();
|
||||
|
||||
// --- Carga y creación ---
|
||||
bool loadFromFile(const std::string &path); // Carga una imagen desde un fichero
|
||||
bool createBlank(int width, int height, SDL_PixelFormat format = SDL_PIXELFORMAT_RGBA8888, SDL_TextureAccess access = SDL_TEXTUREACCESS_STREAMING); // Crea una textura en blanco
|
||||
bool reLoad(); // Recarga la textura
|
||||
auto loadFromFile(const std::string &path) -> bool; // Carga una imagen desde un fichero
|
||||
auto createBlank(int width, int height, SDL_PixelFormat format = SDL_PIXELFORMAT_RGBA8888, SDL_TextureAccess access = SDL_TEXTUREACCESS_STREAMING) -> bool; // Crea una textura en blanco
|
||||
auto reLoad() -> bool; // Recarga la textura
|
||||
|
||||
// --- Renderizado ---
|
||||
void render(int x, int y, SDL_FRect *clip = nullptr, float zoomW = 1, float zoomH = 1, double angle = 0.0, SDL_FPoint *center = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE); // Renderiza la textura en un punto específico
|
||||
void render(int x, int y, SDL_FRect *clip = nullptr, float zoom_w = 1, float zoom_h = 1, double angle = 0.0, SDL_FPoint *center = nullptr, SDL_FlipMode flip = SDL_FLIP_NONE); // Renderiza la textura en un punto específico
|
||||
void setAsRenderTarget(SDL_Renderer *renderer); // Establece la textura como objetivo de renderizado
|
||||
|
||||
// --- Modificadores de color y blending ---
|
||||
@@ -52,12 +53,12 @@ class Texture {
|
||||
void setPalette(size_t palette); // Cambia la paleta de la textura
|
||||
|
||||
// --- Getters ---
|
||||
int getWidth(); // Obtiene el ancho de la imagen
|
||||
int getHeight(); // Obtiene el alto de la imagen
|
||||
SDL_Texture *getSDLTexture(); // Obtiene la textura SDL
|
||||
SDL_Renderer *getRenderer(); // Obtiene el renderizador
|
||||
auto getWidth() -> int; // Obtiene el ancho de la imagen
|
||||
auto getHeight() -> int; // Obtiene el alto de la imagen
|
||||
auto getSDLTexture() -> SDL_Texture *; // Obtiene la textura SDL
|
||||
auto getRenderer() -> SDL_Renderer *; // Obtiene el renderizador
|
||||
|
||||
private:
|
||||
private:
|
||||
// --- Objetos y punteros ---
|
||||
SDL_Renderer *renderer_; // Renderizador donde dibujar la textura
|
||||
SDL_Texture *texture_ = nullptr; // La textura
|
||||
@@ -71,10 +72,10 @@ class Texture {
|
||||
int current_palette_ = 0; // Índice de la paleta en uso
|
||||
|
||||
// --- Métodos internos ---
|
||||
std::shared_ptr<Surface> loadSurface(const std::string &file_name); // Crea una surface desde un fichero .gif
|
||||
auto loadSurface(const std::string &file_name) -> std::shared_ptr<Surface>; // Crea una surface desde un fichero .gif
|
||||
void flipSurface(); // Vuelca la surface en la textura
|
||||
Palette loadPaletteFromFile(const std::string &file_name); // Carga una paleta desde un fichero
|
||||
auto loadPaletteFromFile(const std::string &file_name) -> Palette; // Carga una paleta desde un fichero
|
||||
void unloadTexture(); // Libera la memoria de la textura
|
||||
void unloadSurface(); // Libera la surface actual
|
||||
Palette readPalFile(const std::string &file_path); // Carga una paleta desde un archivo .pal
|
||||
auto readPalFile(const std::string &file_path) -> Palette; // Carga una paleta desde un archivo .pal
|
||||
};
|
||||
Reference in New Issue
Block a user