Android Scaling Issues

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
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Android Scaling Issues

Post by xNick1 »

Code: Select all

wWidth, wHeight = lg.getDimensions()
sx = wWidth / imgwidth
sy = wHeight / imgheight
lg.draw(img[r], quad, x, y, 0, sx, sy)
I'm not using scale(), I calculate sx and sy for every object by dividing screen dimension and the objects dimensions
It works fine on my pc, but it doesn't fill the whole screen on Android

what if I try with getPixelDimensions()?
I'm using the latest version 0.11.x on the repo to compile the game for Android
I didn't have this problem with 0.10.x but it seems like I need 0.11.x to publish the game to the playstore

That's my conf.lua, I don't know if it can help

Code: Select all

function love.conf(t)
    t.identity = "game"
    t.appendidentity = false
    t.version = "11.2"
    t.console = true
    t.accelerometerjoystick = false
    t.externalstorage = false
    t.gammacorrect = false

    t.audio.mixwithsystem = false
    
    t.window.title = "game"
    t.window.icon = nil
    t.window.width = 1280
    t.window.height = 720
    t.window.borderless = false
    t.window.resizable = false
    t.window.minwidth = 1
    t.window.minheight = 1
    t.window.fullscreen = false
    t.window.fullscreentype = "desktop"
    t.window.vsync = 1
    t.window.msaa = 0
    t.window.depth = nil
    t.window.stencil = nil
    t.window.display = 1
    t.window.highdpi = true
    t.window.x = nil
    t.window.y = nil

    t.modules.audio = true
    t.modules.data = true
    t.modules.event = true
    t.modules.font = true
    t.modules.graphics = true
    t.modules.image = true
    t.modules.joystick = false
    t.modules.keyboard = true
    t.modules.math = true
    t.modules.mouse = true
    t.modules.physics = false
    t.modules.sound = true
    t.modules.system = true
    t.modules.thread = true
    t.modules.timer = true
    t.modules.touch = true
    t.modules.video = true
    t.modules.window = true    
end
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Android Scaling Issues

Post by pgimeno »

Does this work?

Code: Select all

wWidth, wHeight = lg.fromPixels(lg.getPixelDimensions())
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Android Scaling Issues

Post by xNick1 »

pgimeno wrote: Sun Mar 17, 2019 8:10 pm Does this work?

Code: Select all

wWidth, wHeight = lg.fromPixels(lg.getPixelDimensions())
I was trying to solve a problem. I couldn't compile apks anymore after I lost my old laptop lol.
No, this doesn't work either.
It seems to work only the first time, as before.
It's pretty random, sometimes the game is full screen, other times it's like that:
photo_2019-04-13_12-01-59.jpg
photo_2019-04-13_12-01-59.jpg (79.88 KiB) Viewed 11412 times
I think it's cause of the new DPI thing hmm

Edit:

Code: Select all

local frame = lg.newImage("assets/images/menu/frame.png")
local fWidth = frame:getWidth()
local fHeight = frame:getHeight()
local fsx = wWidth / fWidth * 1
local fsy = wHeight / fHeight * 1
local fx = 0
local fy = 0

function BackgroundMenu:draw()
    lg.draw(frame, fx, fy, 0, fsx, fsy)
end
As you can see from the previous picture the frame doesn't get drawn correctly.
wWidth and wHeight are calculated like that: wWidth, wHeight = lg.fromPixels(lg.getPixelDimensions())
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Android Scaling Issues

Post by pgimeno »

Could your problem be related to the space reserved for the system buttons? I don't know how that's handled in LÖVE, if at all.
User avatar
xNick1
Party member
Posts: 267
Joined: Wed Jun 15, 2016 8:27 am
Location: Rome, Italy

Re: Android Scaling Issues

Post by xNick1 »

pgimeno wrote: Sun Apr 14, 2019 11:35 am Could your problem be related to the space reserved for the system buttons? I don't know how that's handled in LÖVE, if at all.
That could be the reason.
I have software buttons.
Any ideas?

Btw, it works the first time I launch the apk, but only the first time ever

photo_2019-04-14_12-47-54.jpg
photo_2019-04-14_12-47-54.jpg (82.34 KiB) Viewed 11331 times
photo_2019-04-14_12-47-56.jpg
photo_2019-04-14_12-47-56.jpg (86.47 KiB) Viewed 11331 times
photo_2019-04-14_13-50-14.jpg
photo_2019-04-14_13-50-14.jpg (79.49 KiB) Viewed 11331 times
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Android Scaling Issues

Post by pgimeno »

My only idea is to check for any notification in love.resize.

Maybe someone else can shed more light on the issue.
Post Reply

Who is online

Users browsing this forum: No registered users and 12 guests