Fullscreen on mobile causing issues with love.graphics.getWidth()

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
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by snibo »

I got this issue when using Fullscreen on mobile.
https://youtu.be/6cadtSdExQw?si=VqwoIVUikqihnlbE
As you can see in the video in some cases the items that are supposed to be on the edge of the screen as displayed properly but sometimes they are pushed this probably because when the game is loaded the action buttons have not been removed yet the I end up with a really bad result.
You can take a look at my conf file:

Code: Select all

function love.conf(t)

t.window.fullscreen = true
t.window.vsync = 1

end
I don't have any idea for how to fix this because I don't really understand how the conf thing works but hopefully I can get some help because I really need it
Last edited by snibo on Sat Aug 24, 2024 4:35 pm, edited 3 times in total.
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Fullscreen on mobile causing issues with lg.getWidth()

Post by BrotSagtMist »

There is no such thing as lg.getWidth()
You need to name the actual function you are using when getting the size if you want to have this debugged.
obey
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Fullscreen on mobile causing issues with lg.getWidth()

Post by snibo »

BrotSagtMist wrote: Sat Aug 24, 2024 2:31 pm There is no such thing as lg.getWidth()
You need to name the actual function you are using when getting the size if you want to have this debugged.
lg is a short form of love.graphics because I didn't want to make the title too long but I can change it if I have to
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by BrotSagtMist »

Yea i knew that, i meant getWidth, i was in the wrong namespace in my head, ups.
There is a bunch of window and screen size functions under the love.window namespace and did not knew they where double in love.graphics.
Anyway, try https://love2d.org/wiki/love.window.get ... Dimensions for example, that would not change on incomming side pannels as it _should_ show the screen size itself.
obey
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by snibo »

BrotSagtMist wrote: Sat Aug 24, 2024 2:59 pm Yea i knew that, i meant getWidth, i was in the wrong namespace in my head, ups.
There is a bunch of window and screen size functions under the love.window namespace and did not knew they where double in love.graphics.
Anyway, try https://love2d.org/wiki/love.window.get ... Dimensions for example, that would not change on incomming side pannels as it _should_ show the screen size itself.
Tried using this but for some reason it think that my screen is bigger than it is and everything is misaligned heavily so wouldn't use it.
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by BrotSagtMist »

Yea thats dpi scale for you.
Thinking out loud here:
If getWidth shows the window size then the side bar phasing out should trigger a resize. So having

Code: Select all

function love.resize(w, h)
 Width=w 
end
Should work.
obey
snibo
Prole
Posts: 23
Joined: Sat May 04, 2024 6:56 am

Re: Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by snibo »

BrotSagtMist wrote: Sat Aug 24, 2024 4:30 pm Yea thats dpi scale for you.
Thinking out loud here:
If getWidth shows the window size then the side bar phasing out should trigger a resize. So having

Code: Select all

function love.resize(w, h)
 Width=w 
end
Should work.
Yeah I think we got the same idea at the same time. I was about to do something similar by calling that function in love.update

Edit: that did not work either updating lg.getHeight/getWidth won't work because by default it's constantly udated the reason why the picture and the controller both got moved but not the "bite" button is because both controller and picture have their variable defined in love.load and never get updated again in order to have the new window size, in the other hand there's the "bite" button who is defined in love.update so it doesn't get off-centerd. So all I have to do is define the variables in love.update ... Man this will cause a lot of bugs :?
User avatar
BrotSagtMist
Party member
Posts: 659
Joined: Fri Aug 06, 2021 10:30 pm

Re: Fullscreen on mobile causing issues with love.graphics.getWidth()

Post by BrotSagtMist »

love.resize Is a callback, it calls itself :D
It only needs to exist somewhere.
obey
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 9 guests