Multi resolution layout help, DP, DPI, Scale...
Posted: Mon Jul 25, 2016 3:57 pm
Hi
In the process of attempting to support Android and looking into the best way to deal with the different screen resolutions and density. I have came up with the following where the layout translates fine from desktop and onto my Android device (Galaxy S6).
Interested in seeing other approaches and the best way to deal with images as scaling up isn't ideal. I initially thought of creating a large image and scaling down, however this would mean a scaled down image would then be scaled up to fit each device.
New at all this so any pointers appreciated, thanks
In the process of attempting to support Android and looking into the best way to deal with the different screen resolutions and density. I have came up with the following where the layout translates fine from desktop and onto my Android device (Galaxy S6).
Interested in seeing other approaches and the best way to deal with images as scaling up isn't ideal. I initially thought of creating a large image and scaling down, however this would mean a scaled down image would then be scaled up to fit each device.
New at all this so any pointers appreciated, thanks
Code: Select all
love.window.setMode(800, 480)
demo = love.graphics.newImage("demo.png")
screenWidth, screenHeight = love.window.fromPixels(love.graphics.getDimensions())
function love.draw()
love.graphics.push()
love.graphics.scale(love.window.getPixelScale())
love.graphics.setBackgroundColor(255, 255, 255)
love.graphics.setColor(255, 255, 0)
love.graphics.rectangle("fill", 10, 10, screenWidth - 20, screenHeight - 20)
love.graphics.setColor(255, 0, 0)
love.graphics.rectangle("fill", 50, 50, 50, 50)
love.graphics.setColor(255, 0, 255)
love.graphics.circle("fill", 100, 100, 50, 5)
love.graphics.setColor(255, 0, 255)
love.graphics.draw(demo, (screenWidth / 2 - demo:getWidth() / 2), (screenHeight / 2 - demo:getHeight() / 2))
love.graphics.setColor(0, 0, 255)
love.graphics.print("Layout...", screenWidth / 2, 0)