mirror of
https://git.shylie.info/shylie/glerminal.git
synced 2024-11-23 09:10:11 +00:00
print stbi failure reason
This commit is contained in:
parent
1e0be8eca0
commit
7cd81b31eb
@ -825,16 +825,16 @@ int glerminal_load_sprites_file(const char* filename)
|
|||||||
stbi_uc* const buffer = stbi_load(filename, &w, &h, nullptr, 4);
|
stbi_uc* const buffer = stbi_load(filename, &w, &h, nullptr, 4);
|
||||||
|
|
||||||
// verify atlas size is a multiple of CELL_SIZE in each dimension
|
// verify atlas size is a multiple of CELL_SIZE in each dimension
|
||||||
if (buffer && w % glerminal::CELL_SIZE == 0 && h % glerminal::CELL_SIZE == 0)
|
if (!buffer)
|
||||||
|
{
|
||||||
|
std::cout << stbi_failure_reason() << std::endl;
|
||||||
|
}
|
||||||
|
else if (w % glerminal::CELL_SIZE == 0 && h % glerminal::CELL_SIZE == 0)
|
||||||
{
|
{
|
||||||
GLERMINAL_G->load_atlas(w / glerminal::CELL_SIZE, h / glerminal::CELL_SIZE, reinterpret_cast<unsigned int*>(buffer));
|
GLERMINAL_G->load_atlas(w / glerminal::CELL_SIZE, h / glerminal::CELL_SIZE, reinterpret_cast<unsigned int*>(buffer));
|
||||||
|
|
||||||
success = true;
|
success = true;
|
||||||
}
|
}
|
||||||
else if (buffer)
|
|
||||||
{
|
|
||||||
std::cout << "Invalid image width/height" << std::endl;
|
|
||||||
}
|
|
||||||
|
|
||||||
stbi_image_free(buffer);
|
stbi_image_free(buffer);
|
||||||
|
|
||||||
|
@ -4,21 +4,12 @@
|
|||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
#ifndef _WIN32
|
|
||||||
#include <unistd.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace
|
namespace
|
||||||
{
|
{
|
||||||
void init()
|
void init()
|
||||||
{
|
{
|
||||||
if (!glerminal_load_sprites_file("resources/image.png"))
|
if (!glerminal_load_sprites_file("resources/image.png"))
|
||||||
{
|
{
|
||||||
#ifndef _WIN32
|
|
||||||
char buffer[257] = {};
|
|
||||||
getcwd(buffer, 256);
|
|
||||||
std::cout << buffer << std::endl;
|
|
||||||
#endif
|
|
||||||
std::cout << "Failed to load texture" << std::endl;
|
std::cout << "Failed to load texture" << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user