Display world screenshot previews and progress#2349
Display world screenshot previews and progress#2349provigz wants to merge 47 commits intoSuperTux:masterfrom
Conversation
|
builds failing, cant test |
|
Needs another rebase against master |
Frostwithasideofsalt
left a comment
There was a problem hiding this comment.
All of my issues have been resolved.
|
Only issue I see left with this PR is that the worldmap menu is shown in the world screenshot when using the OpenGL renderer on Windows. Considering the default renderer now is SDL, maybe we should merge this and maybe consider this issue for another time, as it's minor and likely directly related to the OpenGL video code. |
|
I'd say that if it ONLY happens with the OpenGL renderer, I'd let it slip by for now. |
|
From my testing, SDL was fine. I encourage you to test it. |
|
Instead of "perfected", how about "perfect"? |
|
Isn't it shifted in the first screenshot because of Story Mode? |
|
There isn't a preview visible, as shown in the screenshot |
|
And there is no progression or anything from Story Mode that shows up on the right? Then sure. |
|
"Perfected" is the proper english term for perfecting a level, so that should stay @tobbi |
Ah, alright! |
…/empty previews with no data
…d with progress; show "Story mode" progress
How did I let this pass??
… towards level progress
…e total level count in stats
|
This PR should be ready (review if you could), however I am getting a segfault/signal 6 when making a screenshot on the SDL renderer. It might be a bug within |
| #include "util/string_util.hpp" | ||
|
|
||
| static const size_t MAX_TITLE_CHARS = 30; | ||
| static const std::vector<std::string> IMAGE_EXTENSIONS = { ".jpg", ".png", ".surface" }; |
There was a problem hiding this comment.
std array or just a C style array. Try std stringview
| } | ||
|
|
||
| bool | ||
| FileSystemMenu::is_image(const std::string& file) const |
There was a problem hiding this comment.
smells like unsound logic anyway. sdl image might have something to check this? try running it through and seeing if a valid surface is returned if it doesnt.
There was a problem hiding this comment.
granted, thats kinda rare. plus, what about .jpeg and whatever? maybe im looking at this wrong
| void | ||
| MenuItem::set_preview(const std::string& preview_file) | ||
| { | ||
| m_preview = Surface::from_file(preview_file); |
| .set_help(_("Enable screen transitions and smooth menu animation")); | ||
|
|
||
| add_toggle(MNID_WORLD_PREVIEWS, _("Show world previews"), &g_config->show_world_previews) | ||
| .set_help(_("Show screenshot previews of the last worldmap state, when hovering over a world.")); |
| @@ -1,5 +1,6 @@ | |||
| // SuperTux | |||
| // Copyright (C) 2021 mrkubax10 <mrkubax10@onet.pl> | |||
| // 2022-2023 Vankata453 | |||
| WorldPreviewMenu::menu_action(MenuItem& item) | ||
| { | ||
| const int index = item.get_id(); | ||
| if (index >= 0 && index < static_cast<int>(m_world_entries.size())) // Valid world index. |
| } | ||
|
|
||
| uint32_t | ||
| Savegame::Progress::get_percentage() const |
There was a problem hiding this comment.
why not int? also its a percentage, why not double?
| {} | ||
| uint32_t solved; | ||
| uint32_t perfect; | ||
| uint32_t total; |
|
|
||
|
|
||
| void | ||
| WorldMap::take_preview_screenshot() |
There was a problem hiding this comment.
show a dialog and also log SDL_GetError (if applicable(
|
We could probably use getpixel api instead of sdl screenshot. dunno how thatd work on the gl backend |



WorldSetMenuandSortedContribMenunow inherit the newWorldPreviewMenuclass, which allows displaying profile-specific world previews and progress. A preview for a world is generated each time the user leaves its worldmap. Only worldmap levelsets support this feature.Supported also are optional placeholder world previews, which have to be named
preview.png, and stored in the relative tolevelsdirectory for the world.FileSystemMenualso now shows previews of images, when hovering over an image file.fixes #2286