commit de acabar la jornada laboral
This commit is contained in:
@@ -61,17 +61,13 @@ bool Texture::loadFromFile(const std::string &path)
|
||||
unsigned char *data = stbi_load(path.c_str(), &width, &height, &orig_format, req_format);
|
||||
if (!data)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Loading image failed: " << stbi_failure_reason() << std::endl;
|
||||
#endif
|
||||
exit(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
const std::string file_name = path.substr(path.find_last_of("\\/") + 1);
|
||||
std::cout << "Image loaded: " << file_name << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
int depth, pitch;
|
||||
@@ -99,9 +95,7 @@ bool Texture::loadFromFile(const std::string &path)
|
||||
auto loadedSurface = SDL_CreateRGBSurfaceWithFormatFrom(static_cast<void *>(data), width, height, depth, pitch, pixel_format);
|
||||
if (loadedSurface == nullptr)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Unable to load image " << path << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -109,9 +103,7 @@ bool Texture::loadFromFile(const std::string &path)
|
||||
newTexture = SDL_CreateTextureFromSurface(renderer_, loadedSurface);
|
||||
if (newTexture == nullptr)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Unable to create texture from " << path << "! SDL Error: " << SDL_GetError() << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -137,9 +129,7 @@ bool Texture::createBlank(int width, int height, SDL_PixelFormatEnum format, SDL
|
||||
texture_ = SDL_CreateTexture(renderer_, format, access, width, height);
|
||||
if (!texture_)
|
||||
{
|
||||
#ifdef VERBOSE
|
||||
std::cout << "Unable to create blank texture! SDL Error: " << SDL_GetError() << std::endl;
|
||||
#endif
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user