Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Add SceneResolutionPolicy.BestFitPixelPerfect #722

Open
cgbeutler opened this issue Jun 1, 2022 · 1 comment
Open

Add SceneResolutionPolicy.BestFitPixelPerfect #722

cgbeutler opened this issue Jun 1, 2022 · 1 comment

Comments

@cgbeutler
Copy link

There are nice PixelPerfect options for each policy except for BestFit. It would be nice have best fit in there as well. With the rise of Ultra-wide monitors, settings like NoBorderPixelPerfect can get problematic. BestFitPixelPerfect would allow the targetting of a range of sizes and aspect ratios all at once.

As far as how it should work goes, it would match BestFit, but snap scaling to integer values.

For example, the following settings would be fairly ideal for most 2D games:

Scene.SetDefaultDesignResolution(960, 540, Scene.SceneResolutionPolicy.NoBorderPixelPerfect, 480, 156);

That setting snap up to a 2x zoom when 960 width and 768 height are surpassed, as the minimal area within the bleed padding can now fit in the window.

I could also see doing a padSize instead of a bleedSize, as additive rendering wiggle room may be simpler on the user than the subtractive nature of bleed. That would make it not match BestFit, though, so it'd have to have a different name.

@cgbeutler
Copy link
Author

cgbeutler commented Jun 1, 2022

Got it working on my fork here: fcdb729

If the feature is actually desired by anyone else, then I can make a PR. This is what it looks like in action:

poison

The red rectangle is the minimal area within the bleed size. When a multiple of that area can be displayed, it snaps up a zoom level.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant