Scaling with all true 16:9 resolutions with limited number of asset resolutions?
Posted: Sun Aug 21, 2022 3:54 pm
I start with a resizable window
I then create a drawable area that will fit in the window that is a true (div by 8) 16:9 resolution (but also including 1600x900). This happens everytime window is resized.
I then choose a canvas resolution of the 6 different common resolutions I have that is == or > the drawable area, and scale that to fit in the drawable area.
Since the drawable area allows for all 16:9 resolutions, most of the canvas sizes will need to be scaled. For example, if drawable area is 1152x648, then I will choose a canvas size of 1280x720 and scale it to fit the drawable area.
drawScale = DRAWAREA.w / CANVAS.w
The purpose of this is to create a consistent experience across all devices and resolutions.
Now the problem I am having is translating the X and Y coordinates across all the different canvas resolutions. The drawScale shouldn't be relevant here because all assets from the same resolution are drawn to canvas first, I have that working fine. But when I go to move a sprite with the keyboard, the X and Y dont keep the same position when resizing the window.
I can probably figure this out, just wanted to get some ideas or see if someone has a better way of going about what Im trying to do.
I then create a drawable area that will fit in the window that is a true (div by 8) 16:9 resolution (but also including 1600x900). This happens everytime window is resized.
I then choose a canvas resolution of the 6 different common resolutions I have that is == or > the drawable area, and scale that to fit in the drawable area.
Since the drawable area allows for all 16:9 resolutions, most of the canvas sizes will need to be scaled. For example, if drawable area is 1152x648, then I will choose a canvas size of 1280x720 and scale it to fit the drawable area.
drawScale = DRAWAREA.w / CANVAS.w
The purpose of this is to create a consistent experience across all devices and resolutions.
Now the problem I am having is translating the X and Y coordinates across all the different canvas resolutions. The drawScale shouldn't be relevant here because all assets from the same resolution are drawn to canvas first, I have that working fine. But when I go to move a sprite with the keyboard, the X and Y dont keep the same position when resizing the window.
I can probably figure this out, just wanted to get some ideas or see if someone has a better way of going about what Im trying to do.