mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-27 22:45:28 +00:00
Fix spritesheet generator
This commit is contained in:
parent
c9ed3711b4
commit
367c6c8aa3
@ -41,10 +41,10 @@ namespace
|
|||||||
struct sheet_element
|
struct sheet_element
|
||||||
{
|
{
|
||||||
explicit sheet_element(const std::filesystem::path& p)
|
explicit sheet_element(const std::filesystem::path& p)
|
||||||
: surf{IMG_Load_RW(filesystem::make_read_RWops(p.string()).release(), true)}
|
: surf(IMG_Load_RW(filesystem::make_read_RWops(p.string()).release(), true))
|
||||||
, filename{p.filename().string()}
|
, filename(p.filename().string())
|
||||||
, src{get_non_transparent_portion(surf)}
|
, src(get_non_transparent_portion(surf))
|
||||||
, dst{}
|
, dst()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,17 +202,21 @@ void handle_dir_contents(const std::filesystem::path& path)
|
|||||||
}
|
}
|
||||||
|
|
||||||
} // end anon namespace
|
} // end anon namespace
|
||||||
#define DEBUG_SPRITESHEET_OUTPUT
|
|
||||||
void build_spritesheet_from(const std::string& entry_point)
|
void build_spritesheet_from(const std::string& entry_point)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG_SPRITESHEET_OUTPUT
|
#ifdef DEBUG_SPRITESHEET_OUTPUT
|
||||||
const std::size_t start = SDL_GetTicks();
|
const std::size_t start = SDL_GetTicks();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
try {
|
if(auto path = filesystem::get_binary_file_location("images", entry_point)) {
|
||||||
handle_dir_contents(filesystem::get_binary_file_location("images", entry_point));
|
try {
|
||||||
} catch(const std::filesystem::filesystem_error& e) {
|
handle_dir_contents(*path);
|
||||||
PLAIN_LOG << "Error generating spritesheet: " << e.what();
|
} catch(const std::filesystem::filesystem_error& e) {
|
||||||
|
PLAIN_LOG << "Filesystem Error generating spritesheet: " << e.what();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
PLAIN_LOG << "Cannot find entry point to build spritesheet: " << entry_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG_SPRITESHEET_OUTPUT
|
#ifdef DEBUG_SPRITESHEET_OUTPUT
|
||||||
|
Loading…
x
Reference in New Issue
Block a user