Doing so is bad practice in terms of accessibility.
I was thinking to only error out for ridiculously small windows, for example smaller than 60 pixels or so. But I still agree, that's not a great thing to do.
Use the 2d stretch mode and keep_width stretch aspect as described in the multiple resolutions documentation.
That's very useful and seems to take care of most of my requirements, just not the "up-to" size. Bit hard to explain, but let's say my background asset is 1920x1080 px. However, only the center 1280x720 px of that is actually essential to the game. If a user's window is 1280x720, they would see exactly that essential part. If their window is bigger in one or both directions, additional parts of the background asset would be used. At 1920x1080, the entire background asset would be shown. Only if the user's window size exceeds 1920x1080 would I want the entire content to stretch to fit and show black bars where required.
Does that make sense? Is there a way to achieve this? I could whip up code for it, but I don't know how to programmatically mess with the entire scale mode, root window size, container size. It seems whatever I set for rect_size
, for example, will be discarded right away if the container's content is larger.