mirror of
https://github.com/zhenyan121/Cubed.git
synced 2026-08-09 02:07:04 +08:00
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:
@@ -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>();
|
||||||
|
|
||||||
|
|||||||
@@ -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));
|
||||||
|
|||||||
Reference in New Issue
Block a user