Android Resolution Problem [SOLVED]
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Android Resolution Problem [SOLVED]
When I open my love file, the screen resolution is not 1920x1080. But my phone's resolution is 1920x1080. When I open with an old version of Love, it works in 1920x1080. I do not use google play version. I use the updated APK verslon which is on the love's website. I used t.window.width and t.window.height in conf.lua but nothing changed. How can I set resolution to my phone's current resolution on Android? Thanks...
Last edited by test on Tue May 07, 2019 7:14 pm, edited 1 time in total.
Re: Android Resolution Problem
So if I use old version of love, dpi is off as default right? Because there is no problem for old versions.
Re: Android Resolution Problem
Yes you could simply use older version if you don't need new version's features. This problem should be fixed in the future versions.
Re: Android Resolution Problem
Note that it's not a problem of resolution. The resolution is the same. It's just that the coordinates don't match pixels.
A quick and dirty workaround is to use this at the beginning of love.draw:
and use love.graphics.getPixelWidth etc instead of love.graphics.getWidth etc.
A quick and dirty workaround is to use this at the beginning of love.draw:
Code: Select all
love.graphics.scale(1/love.window.getDPIScale())
Re: Android Resolution Problem
Thanks pgimeno. But why did you say dirty for the code you writed? It works. If I use this code and build APK, is it bad pratice? What is the correct way?
Re: Android Resolution Problem
It doesn't cover all functions, e.g. canvas creation, and if you use vertex shaders, it may not work properly, but for a simple game it works.
Edit: The "correct" way is to use the coordinates unmodified, and use love.window.toPixels/fromPixels if you really need to convert to/from real pixels. You still have the full resolution if you draw images.
Edit: The "correct" way is to use the coordinates unmodified, and use love.window.toPixels/fromPixels if you really need to convert to/from real pixels. You still have the full resolution if you draw images.
Last edited by pgimeno on Sat May 04, 2019 3:16 pm, edited 1 time in total.
Re: Android Resolution Problem
Thanks. I think I am going to solve this situation (not a problem) by creating a 1920x1080 canvas and setting dpi to 1.
Who is online
Users browsing this forum: Ahrefs [Bot] and 15 guests