Page 1 of 1

Android screen orientation (a bug report?)

Posted: Tue Sep 25, 2018 8:01 pm
by 4aiman
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 7195 times
If I swap params in the conf.lua I'm getting this:
landscape.png
landscape.png (129.78 KiB) Viewed 7194 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.

Re: Android screen orientation (a bug report?)

Posted: Tue Sep 25, 2018 8:04 pm
by 4aiman
Sorry for double posting, but I *can't* change the attachments, since they disappear after each save :(
Please, fix the opening post, someone..

Re: Android screen orientation (a bug report?)

Posted: Sun Nov 04, 2018 1:30 pm
by 4aiman
bump?

Re: Android screen orientation (a bug report?)

Posted: Sun Nov 04, 2018 3:07 pm
by pgimeno
Maybe you can try portland as a workaround?

Re: Android screen orientation (a bug report?)

Posted: Mon Nov 05, 2018 5:23 pm
by 4aiman
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.

Re: Android screen orientation (a bug report?)

Posted: Mon Nov 05, 2018 7:17 pm
by pgimeno
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.

Re: Android screen orientation (a bug report?)

Posted: Wed Nov 07, 2018 5:30 pm
by 4aiman
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( )