Android screen orientation (a bug report?)

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
4aiman
Party member
Posts: 248
Joined: Sat Jan 16, 2016 10:30 am

Android screen orientation (a bug report?)

Post by 4aiman » Tue Sep 25, 2018 8:01 pm

Hello there!

I have a simple config file

Code: Select all

function love.conf(t)
  local major, minor, revision, codename = love.getVersion()
  t.title = "TJournal 2018 ("..major ..'.'.. minor ..'.'.. revision ..'-'.. codename ..")"  
  t.window.width = 480
  t.window.height = 800
  t.modules.mouse = true
  t.modules.window = true
  t.window.minwidth = 270
  t.window.minheight = 480
  t.externalstorage = true
end
I'm getting strange results when I launch any *.love file with that config and the latest apk from the home page.
It seems like the orientation has changed to portrait but the actual "window" size are wrong: height is being used as width and vice versa.
Moreover, the actual size of a "window" in full-HD.

Code: Select all

love.window.getMode( )
returns 1080x1920, but...
portrait.png
portrait.png (125.06 KiB) Viewed 2824 times
If I swap params in the conf.lua I'm getting this:
landscape.png
landscape.png (129.78 KiB) Viewed 2823 times
I've tried to set an 1:1 resolution but I'm still getting the portrait outcome.

If I launch the same *.love using a 10.2 love2d and use the original version of the config (portrait, h>w), then the screen stays in lanscape displaying whatever fits it's size and cutting everything else.


Note, that a simple love.graphics.rotate won't suffice, since there will be issues with the GUI.
Attachments
portrait.png
portrait.png (125.06 KiB) Viewed 2825 times

User avatar
4aiman
Party member
Posts: 248
Joined: Sat Jan 16, 2016 10:30 am

Re: Android screen orientation (a bug report?)

Post by 4aiman » Tue Sep 25, 2018 8:04 pm

Sorry for double posting, but I *can't* change the attachments, since they disappear after each save :(
Please, fix the opening post, someone..

User avatar
4aiman
Party member
Posts: 248
Joined: Sat Jan 16, 2016 10:30 am

Re: Android screen orientation (a bug report?)

Post by 4aiman » Sun Nov 04, 2018 1:30 pm

bump?

User avatar
pgimeno
Party member
Posts: 2132
Joined: Sun Oct 18, 2015 2:58 pm

Re: Android screen orientation (a bug report?)

Post by pgimeno » Sun Nov 04, 2018 3:07 pm

Maybe you can try portland as a workaround?

User avatar
4aiman
Party member
Posts: 248
Joined: Sat Jan 16, 2016 10:30 am

Re: Android screen orientation (a bug report?)

Post by 4aiman » Mon Nov 05, 2018 5:23 pm

Actually, I've tried :)
Portland does indeed work, but love2 seems to have internal issues...
For example, window/screen dimensions are wrong (my phone has full-hd display):

I've tinkered with my code long enough to realize, that if I swap width/height in the gui library on a Desktop, I will get the same results.
But swapping those for Android only doesn't have any effect :(

Is there a way to control this "rotation" (as in "disable completely")?

I've attached a *.love file, but I doubt it will work properly without the proper setup. However, one should be able to test the orientation, since it becomes apparent whether it's faulty or not right away.
Attachments
plus_plus.love
(88.26 KiB) Downloaded 48 times

User avatar
pgimeno
Party member
Posts: 2132
Joined: Sun Oct 18, 2015 2:58 pm

Re: Android screen orientation (a bug report?)

Post by pgimeno » Mon Nov 05, 2018 7:17 pm

4aiman wrote:
Mon Nov 05, 2018 5:23 pm
For example, window/screen dimensions are wrong (my phone has full-hd display):
Hmm, maybe that's the internal pixel conversion thingy that has annoyed me in past. Try displaying love.window.toPixels(love.graphics.getWidth()) (and getHeight).
4aiman wrote:
Mon Nov 05, 2018 5:23 pm
Is there a way to control this "rotation" (as in "disable completely")?
If you mean with portland, yes.
portland docs wrote:
  • portland.forceOrient(n): Forces a specific orientation regardless of the accelerometer values. 0 is landscape, 90 is portrait, 180 is landscape inverted, 270 is portrait inverted, false means stop forcing an orientation.

User avatar
4aiman
Party member
Posts: 248
Joined: Sat Jan 16, 2016 10:30 am

Re: Android screen orientation (a bug report?)

Post by 4aiman » Wed Nov 07, 2018 5:30 pm

Thank you, pgimeno!

I've inspected portland a bit closer and have found *the place* where it all went wrong in my source code. The reason is that I used a wrong function to determine screen size.

This reports *actual* dimensions:

Code: Select all

love.window.getMode( )
While this is really tied to the internal pixel conversion and yields strange results:

Code: Select all

love.graphics.getDimensions( )

Post Reply

Who is online

Users browsing this forum: No registered users and 18 guests