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
Draw size preserving fill container #1077
Draw size preserving fill container #1077
Conversation
DrawSizePreservingFillContainer allows filling the parent while enforcing a given TargetDrawSize. This is useful, for example, to automatically scale the user interface according to the window resolution, or to provide automatic HiDPI display support.
using osu.Framework.Platform; | ||
using osu.Framework.Testing; | ||
|
||
namespace osu.Framework.Tests | ||
{ | ||
internal class VisualTestGame : TestGame | ||
internal class VisualTestGame : Game |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
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.
No test case for this? Would be pretty neat to have a display of the different modes.
break; | ||
|
||
case DrawSizePreservationStrategy.Maximum: | ||
Scale = new Vector2(Math.Min(drawSizeRatio.X, drawSizeRatio.Y)); |
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
break; | ||
} | ||
|
||
|
This comment was marked as off-topic.
This comment was marked as off-topic.
Sorry, something went wrong.
Introduces
DrawSizePreservingFillContainer
as a generalization ofRatioAdjust
from https://github.com/ppy/osu . Once this is merged in, ppy/osu#1359 removesRatioAdjust
and replaces it with this.Further, this PR uses
DrawSizePreservingFillContainer
withinVisualTestGame
to make the tests usable on HiDPI screens.