Page 1 of 1

Screen resolution across multiple Android device

Posted: Fri Jan 26, 2018 4:25 pm
by Trafitto
Hi!

I'm developing a simple game with Love the target platform is Android with the screen orientation to portrait but I can't imagine how to manage the scale of the screen.

Currently when I try the apk all the images are drawn in the lower left corner.

Re: Screen resolution across multiple Android device

Posted: Fri Jan 26, 2018 9:21 pm
by pgimeno
I think this should work:

Code: Select all

function love.draw()
  do
    local scale = love.graphics.getWidth() / myGameScreenWidth
    local scaleY = love.graphics.getHeight() / myGameScreenHeight
    if scaleY < scale then scale = scaleY end
    love.graphics.scale(scale)
  end
  -- the rest of your love.draw goes here
end
You may need to translate too, to centre the game screen.

However, if you use quads, see this caveat:

https://love2d.org/wiki/Quad

You may also want to use portland (a portrait/landscape handling library): https://love2d.org/forums/viewtopic.php?f=5&t=84810

Re: Screen resolution across multiple Android device

Posted: Sat Jan 27, 2018 11:59 am
by PGUp
Use libraries like CScreen if you are working with touch position