function for debugging internal textures

this would have been nice for checking the textures of sf::Fonts
This commit is contained in:
2025-05-17 18:27:22 -05:00
parent 61fe06a66d
commit 0bc13148bf
3 changed files with 14 additions and 1 deletions

View File

@@ -1748,4 +1748,15 @@ void redraw_partial_terrain(rectangle redraw_rect) {
rect_draw_some_item(terrain_screen_gworld().getTexture(),from_rect,mainPtr(),redraw_rect);
}
void debug_show_texture(const sf::Texture& texture, float seconds, std::string label) {
sf::RenderWindow debug_window;
debug_window.create(sf::VideoMode(texture.getSize().x, texture.getSize().y, 32), label);
debug_window.setVisible(true);
makeFrontWindow(debug_window);
rect_draw_some_item(texture, rectangle(texture), debug_window, rectangle(texture));
debug_window.display();
sf::sleep(sf::seconds(seconds));
debug_window.setVisible(false);
}

View File

@@ -63,8 +63,8 @@ void draw_startup_stats();
void draw_trim(short q,short r,short which_trim,ter_num_t ground_ter);
sf::FloatRect compute_viewport(const sf::RenderWindow&, int mode, float ui_scale, float width, float height);
void draw_startup_anim(bool advance);
void debug_show_texture(const sf::Texture& texture, float seconds = 2, std::string label = "");
#endif

View File

@@ -60,6 +60,8 @@ size_t cCustomGraphics::count(bool party) {
}
}
extern void debug_show_texture(const sf::Texture& texture, float seconds = 2, std::string label = "");
void cCustomGraphics::copy_graphic(pic_num_t dest, pic_num_t src, size_t numSlots) {
if(numSlots < 1) return;
// If the party doesn't have an export sheet, create one.