Mobile phone display resolution

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
darkfrei
Party member
Posts: 1181
Joined: Sat Feb 08, 2020 11:09 pm

Mobile phone display resolution

Post by darkfrei »

Hi all!
Can you please download the .love file and attach the screen shot.

It will be very helpful to know the typical displays.

Screenshot_20230915_151202.jpg
Screenshot_20230915_151202.jpg (50.88 KiB) Viewed 6555 times
Attachments
mobile-phone-love2D.love
(406 Bytes) Downloaded 59 times
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
marclurr
Party member
Posts: 105
Joined: Fri Apr 22, 2022 9:25 am

Re: Mobile phone display resolution

Post by marclurr »

Can't quite see the top line, think it says 411.
Screenshot_20230915-202124.png
Screenshot_20230915-202124.png (46.58 KiB) Viewed 6525 times
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Mobile phone display resolution

Post by milon »

marclurr wrote: Fri Sep 15, 2023 7:23 pm Can't quite see the top line...
darkfrei, why not just love.window.getSafeArea?
Screenshot_20230915-154119.png
Screenshot_20230915-154119.png (45.79 KiB) Viewed 6518 times
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
User avatar
darkfrei
Party member
Posts: 1181
Joined: Sat Feb 08, 2020 11:09 pm

Re: Mobile phone display resolution

Post by darkfrei »

milon wrote: Fri Sep 15, 2023 7:43 pm
marclurr wrote: Fri Sep 15, 2023 7:23 pm Can't quite see the top line...
darkfrei, why not just love.window.getSafeArea?

Screenshot_20230915-154119.png
It was!

Code: Select all

function love.draw ()
	local x, y, w, h = love.window.getSafeArea( )
	
	love.graphics.print ('graphics.width '.. love.graphics.getWidth (), x, y)
	love.graphics.print ('graphics.gheight '.. love.graphics.getHeight (), x, y+14)
	
	local width, height = love.window.getDesktopDimensions()
	love.graphics.print ('window.width '.. width, x, y+2*14)
	love.graphics.print ('window.gheight '.. height, x, y+3*14)
	
	love.graphics.print ('safe.x '.. x, x, y+4*14)
	love.graphics.print ('safe.y '.. y, x, y+5*14)
	love.graphics.print ('safe.width '.. w, x, y+6*14)
	love.graphics.print ('safe.height '.. h, x, y+7*14)
end
:awesome: in Lua we Löve
:awesome: Platformer Guide
:awesome: freebies
User avatar
GVovkiv
Party member
Posts: 670
Joined: Fri Jan 15, 2021 7:29 am

Re: Mobile phone display resolution

Post by GVovkiv »

Why don't you just google some popular smartphones and pick something with most widely used resolution or something?
User avatar
milon
Party member
Posts: 472
Joined: Thu Jan 18, 2018 9:14 pm

Re: Mobile phone display resolution

Post by milon »

darkfrei wrote: Fri Sep 15, 2023 7:52 pm
milon wrote: Fri Sep 15, 2023 7:43 pm
marclurr wrote: Fri Sep 15, 2023 7:23 pm Can't quite see the top line...
darkfrei, why not just love.window.getSafeArea?

Screenshot_20230915-154119.png
It was!
Wow, my bad! I looked for it but totally missed it anyway. :crazy:
Any code samples/ideas by me should be considered Public Domain (no attribution needed) license unless otherwise stated.
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 57 guests