Reticadas las classes de la carpeta utils

This commit is contained in:
2022-10-18 19:48:13 +02:00
parent 5c68006cb5
commit 07a9ba5b87
15 changed files with 846 additions and 504 deletions
+6 -1
View File
@@ -32,6 +32,7 @@ LTexture::~LTexture()
// Carga una imagen desde un fichero
bool LTexture::loadFromFile(std::string path, SDL_Renderer *renderer)
{
const std::string filename = path.substr(path.find_last_of("\\/") + 1);
int req_format = STBI_rgb_alpha;
int width, height, orig_format;
unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
@@ -40,6 +41,10 @@ bool LTexture::loadFromFile(std::string path, SDL_Renderer *renderer)
SDL_Log("Loading image failed: %s", stbi_failure_reason());
exit(1);
}
else
{
printf("Image loaded: %s\n", filename.c_str());
}
int depth, pitch;
Uint32 pixel_format;
@@ -144,7 +149,7 @@ void LTexture::setAlpha(Uint8 alpha)
// Renderiza la textura en un punto específico
void LTexture::render(SDL_Renderer *renderer, int x, int y, SDL_Rect *clip, float zoomW, float zoomH, double angle, SDL_Point *center, SDL_RendererFlip flip)
{
// Establece el destini de renderizado en la pantalla
// Establece el destino de renderizado en la pantalla
SDL_Rect renderQuad = {x, y, width, height};
// Obtiene las dimesiones del clip de renderizado