-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Set minimum sizes for missions menu window #78811
base: master
Are you sure you want to change the base?
Conversation
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
I'm not sure, but I don't think we enforce an actual minimum size in pixels? So with this it might be possible to have the ui be larger than the game window if you use smaller than default font sizes. It might be better to calculate minimum size from minimum terminal size. But that might just be irrelevant fringe cases we can ignore as well. |
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.
Please check that it works in curses build as well (the Notiles
in visual studio).
It definitely should, but I'm very slightly fearful.
Yeah... a cursory search through codebase, I didn't see anything like that lol. I wanted to keep it simple, but i'll fiddle around with it to try get something more proper and standardized. Would like for it to be all good, as there are other places with similar issues I'd like to address. |
use only references to terminal sizes use clamp
Update src/mission_ui.cpp Co-Authored-By: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
d34ed15
to
23aca45
Compare
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.
Thank you!
Co-authored-by: mqrause <[email protected]>
src/mission_ui.cpp
Outdated
size_t window_width = str_width_to_pixels( TERMX ) / 2; | ||
size_t window_height = str_height_to_pixels( TERMY ) / 2; | ||
size_t table_column_width = window_width / 2; | ||
float window_width = std::clamp( float( str_width_to_pixels( 80 ) ), |
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.
This should use EVEN_MINIMUM_TERM_WIDTH
from game_constants.h.
The height should use EVEN_MINIMUM_TERM_HEIGHT
.
We already have these defined as constants, so no additional work is needed besides using the existing constexpr.
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.
Implemented and tested.
Sorry for wasting everyone's time on something that's supposed to be simple..
I've looked at most of the UI code during developing my fork, and the execution of each window is so different, I don't know what's considered standard.
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.
You're not wasting anybody's time.
Summary
SUMMARY: Interface "Set minimum sizes for missions menu UI"
Purpose of change
Set a minimum width and height for the missions window so information does not become unreadable at small terminal sizes
Fixes #78806
Fixes #74766
Describe the solution
Set the window to not go below the minimum terminal sizes of 80 by 24. Otherwise, it'll retain its current behavior.
Update the affected code as per @moxian's comment in linked issue.
Describe alternatives you've considered
Set a static size for the missions window
Testing
Game compiles and loads
Open missions window at maximum terminal size, minimum terminal size, 640x480 pixels size, and a bunch of random sizes
Test again on notiles
Additional context
Max terminal size
Min terminal size
A random size