How to handle resolution on iOS devices?

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
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

How to handle resolution on iOS devices?

Post by ddabrahim »

Hi!

I am currently experimenting with Love2D on iOS using an iOS Simulator. I am trying to understand how resolution and different aspect ratios works and I have noticed the resolution seems to be off.

I have created an iPhone SE 3rd gen Simulator and the resolution of the device is 640 x 1136.
However it seems in Love2D I need to set the resolution to 374 x 664 in order to get a proper render. If I use any other resolution like 640 x 1136, the screen does not look right, it crushed or stretched.

I create a canvas of size 373 x 664 and also setMode(373,664) and this is how I get proper look. But it is not what I would expect considering the resolution of the device is 640 x 1136. I am a little confused about this. Would anyone have any pointers how to handle resolution on iOS devices?

Thank you.
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: How to handle resolution on iOS devices?

Post by pgimeno »

It's probably the same as In Android. A scale is applied to all coordinates; love.graphics.getDimensions() should give you 374x664. The scale is given by love.graphics.getDPIScale(). You can disable this behaviour in love.conf:

Code: Select all

function love.conf(c)
  c.window.usedpiscale = false
end
User avatar
ddabrahim
Party member
Posts: 201
Joined: Mon May 17, 2021 8:05 pm
Contact:

Re: How to handle resolution on iOS devices?

Post by ddabrahim »

Thanks a lot. I forgot completely about DPI scale.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot] and 12 guests