fix: dos fallos tontos

This commit is contained in:
2025-03-23 23:10:18 +01:00
parent 45b763791a
commit a7c0b7d8c6
2 changed files with 139 additions and 122 deletions
+4 -12
View File
@@ -5,19 +5,11 @@
#include "texture.h"
Texture::Texture(SDL_Renderer *renderer)
{
renderer_ = renderer;
texture_ = nullptr;
width_ = 0;
height_ = 0;
}
: renderer_(renderer), texture_(nullptr), width_(0), height_(0) {}
Texture::Texture(SDL_Renderer *renderer, std::string file_path)
: renderer_(renderer), texture_(nullptr), width_(0), height_(0)
{
renderer_ = renderer;
texture_ = nullptr;
width_ = 0;
height_ = 0;
loadFromFile(file_path);
}
@@ -65,7 +57,7 @@ bool Texture::loadFromFile(std::string file_path)
SDL_Surface *loaded_surface = SDL_CreateSurfaceFrom(width, height, pixel_format, (void *)data, pitch);
if (loaded_surface == nullptr)
{
std::cout << "Unable to load image " << file_path.c_str() << std::endl;
std::cout << "Unable to load image " << file_path << std::endl;
}
else
{
@@ -73,7 +65,7 @@ bool Texture::loadFromFile(std::string file_path)
new_texture = SDL_CreateTextureFromSurface(renderer_, loaded_surface);
if (new_texture == nullptr)
{
std::cout << "Unable to create texture from " << file_path.c_str() << "! SDL Error: " << SDL_GetError() << std::endl;
std::cout << "Unable to create texture from " << file_path << "! SDL Error: " << SDL_GetError() << std::endl;
}
else
{