feat(ui): add screenshot button to pause menu

Add a button to open the screenshot scene from the pause menu.
Also enable linear filtering on screenshot textures for smoother scaling.
This commit is contained in:
2026-08-07 18:21:26 +08:00
parent 5f60910aeb
commit 4fef8e195a
2 changed files with 11 additions and 1 deletions

View File

@@ -41,7 +41,16 @@ void PauseMenuUIManager::init() {
}); });
m_pending_enable.emplace_back(&button); m_pending_enable.emplace_back(&button);
} }
{
auto& button = layout.add_child<Button>();
button.set_default_image(texture_manager);
button.set_text(tr("menu.screenshot"));
button.set_clicked([this, &button]() {
button.set_enable(false);
m_scene.scene_manager().request_push(SceneType::SCREENSHOT);
});
m_pending_enable.emplace_back(&button);
}
{ {
auto& back_main = layout.add_child<Button>(); auto& back_main = layout.add_child<Button>();

View File

@@ -56,6 +56,7 @@ void ScreenshotUI::update_layout(int width, int height) {
ImageInfo info; ImageInfo info;
info.texture = info.texture =
texture_manager.get_image_texture(entry.path().string(), true); texture_manager.get_image_texture(entry.path().string(), true);
info.texture->set_linear();
info.height = info.texture->height() * IMAGE_SCALE; info.height = info.texture->height() * IMAGE_SCALE;
info.width = info.texture->width() * IMAGE_SCALE; info.width = info.texture->width() * IMAGE_SCALE;
m_image_infos.emplace_back(std::move(info)); m_image_infos.emplace_back(std::move(info));