Best practices for handling dynamic aspect ratios and resizing? #2269
Replies: 1 comment 7 replies
-
Thanks for the kind words! This is definitely a desirable feature to allow a safe area without black bars. I'll add an issue to look into this being rolled into Excalibur. I'm away from my computer for a while but I'll document it as soon as I can. Would you want something that would preserve the aspect ratio, but "scale" and center the viewport to hide the black bars? It looks like unity will return a read-only safe area bounding box based on the current screen over scan, does something like that sound like it meets your expectations? Do you have an example of what the most desirable resizing experience might look like to you in your use case? In the current state I think your solutions are the best that can be done without changing Excalibur. Very cool stuff you've got! |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi All,
I have just stumbled upon Excalibur and it looks incredibly promising and interesting. I am in the process of trying to build a small scale game with the framework to get a feel for it. My end goal would be to have a game that could run on mobile, and any web browser. Looking at the docs here I see a few different scaling methods. Ideal I would have like a 16:9 "safe area"(This is how i have generally seen it talked about in other engines) like DisplayMode.FitScreen, but I would still like to be able to display content outside of this safe area, to give a cohesive look on all aspect ratios, with no black bars.
Currently my solution is to use DisplayMode.FillScreen and manually calculate a 16 by 9 safe area, but this gets more complicated quickly when resizing happens and all elements need to be re positions. This alone is not a deal breaker, but I want to make sure I am going about this the best way possible, and that I am not missing any easy fixes for this from the documentation.
Edit:
Another Idea I have is to something along these lines:
Where the aspect ratio is dynamic upon the initial load but then uses
FitScreen
for that ratio. This gives a good experiences on browsers and mobile devices, and if resized it still acts mostly okay.Edit 2:
Another idea I have:
So you always have a 1280*720 logical pixels in the center, that you can position all elements absolutely around, but still has the same downside as before of when it is resizes, but it is significantly easier to position the different elements.
Beta Was this translation helpful? Give feedback.
All reactions