Scaling with all true 16:9 resolutions with limited number of asset resolutions?

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Scaling with all true 16:9 resolutions with limited number of asset resolutions?

Post by knuxyl »

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.
knuxyl
Citizen
Posts: 52
Joined: Sat Aug 13, 2016 4:40 am

Re: Scaling with all true 16:9 resolutions with limited number of asset resolutions?

Post by knuxyl »

I found the problem, I was trying to set the coordinate scale factor by divding the wrong values. The problem only came up when implementing offset in the draw function to make the character flip, so I was focused on that.

CANVAS.coordScale = CANVAS.resolution.h / RESOLUTIONS[1] (2160)
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 49 guests