-
-
Notifications
You must be signed in to change notification settings - Fork 476
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display world screenshot previews and progress #2349
base: master
Are you sure you want to change the base?
Conversation
solved(solved_), | ||
total(total_) | ||
{} | ||
uint32_t solved; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
m_solved
m_total
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I didn't think an m_
prefix is needed here, since this struct is only used to store 2 variables together and has just one simple function to calculate percentage using them.
/home/runner/work/supertux/supertux/src/worldmap/worldmap_state.cpp:139:30: error: empty expression statement has no effect; remove unnecessary ';' to silence this warning [-Werror,-Wextra-semi-stmt] |
537410d
to
41bed28
Compare
This PR is now ready for review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is completing all levels normally supposed to count as 100%? What about getting all collectibles?
On small screens, the help text is not fully readable because it's not aligned to the screen but rather to the menu.
I don't see any animations when navigating a Filesystem menu.
Aside from that, nice work!
src/gui/menu.cpp
Outdated
#include "video/video_system.hpp" | ||
#include "video/viewport.hpp" | ||
|
||
#include "supertux/error_handler.hpp" | ||
const Sizef Menu::s_preview_size(426.f, 240.f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hardcoding the preview size squishes pictures that are too big. Any reason as to why you're doing this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the image and the menu could both fit on the screen. Maybe I should check the resolution before determining this though.
That is only supposed to indicate the progress through levels on the map. If the percentage isn't perceived well, I can remove it.
True, it should stay centered regardless.
Do you have transitions enabled? |
Yes, but now that I think about it, this might be because the loading time overrides the animation. That can be something for another pr. Will do some further investigation later. The preview still gets squished. I cloned this PR and am currently trying to write a fix for this |
Yes, if you go to the next item too quickly, there will be no time for animations.
It does, but only if you change your resolution to be different from the one when the screenshot was taken. |
Rectf preview_rect(Vector(static_cast<float>(context.get_width()) * 0.73f - preview_size.width / 2 + (width_diff > 0 ? width_diff / 2 : 0), | ||
static_cast<float>(context.get_height()) / 2 - preview_size.height / 2 + (height_diff > 0 ? height_diff / 2 : 0)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use std::max
Rectf preview_rect(Vector(static_cast<float>(context.get_width()) * 0.73f - preview_size.width / 2 + (width_diff > 0 ? width_diff / 2 : 0), | |
static_cast<float>(context.get_height()) / 2 - preview_size.height / 2 + (height_diff > 0 ? height_diff / 2 : 0)), | |
Rectf preview_rect(Vector(static_cast<float>(context.get_width()) * 0.73f - preview_size.width / 2 + std::max(width_diff / 2, 0), | |
static_cast<float>(context.get_height()) / 2 - preview_size.height / 2 + std::max(height_diff / 2, 0)), |
if (valid_last_index) | ||
{ | ||
// Draw progress preview of current item. | ||
const Sizef preview_size(static_cast<float>(SCREEN_WIDTH) / 2.5f, static_cast<float>(SCREEN_HEIGHT) / 2.5f); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the context functions.
const Sizef preview_size(static_cast<float>(SCREEN_WIDTH) / 2.5f, static_cast<float>(SCREEN_HEIGHT) / 2.5f); | |
const Sizef preview_size(static_cast<float>(context.get_width()) / 2.5f, static_cast<float>(context.get_height()) / 2.5f); |
WorldSetMenu
andSortedContribMenu
now inherit the newWorldPreviewMenu
class, 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 tolevels
directory for the world.FileSystemMenu
also now shows previews of images, when hovering over an image file.