Bug Issue: Can't prevent autorotate on Android


Pages: 1

Ogiul

  • Level 3 Stencyler
September 27, 2015, 02:32:13 pm
I have not ticked the autorotate in Stencyl game setting, but on Android the game rotates anyway; this is a problem because my game uses the Accelerometer and that make a mess with accelerometer orientation and characters coordinates.

I read this post on stackoverflow http://stackoverflow.com/questions/2730855/prevent-screen-rotation-android

In my Android Manifest is written:
android:screenOrientation="sensorPortrait"
and NOT  android:screenOrientation="portrait"

I tried to correct it by myself: I wrote "portrait" instead of "sensorPortrait" in the Manifest in my game generated folder, but when I export the game Stencyl overwrites the Manifest and it writes "sensorPortrait" again...

My game does open on portrait and does not rotate if I rotate +90 or -90 the problem is, if I rotate the device 180°, the game also rotates180°, while I would like the characters remain with feet up and head down.

I reported this problem here: http://community.stencyl.com/index.php/topic,43909.0.html
« Last Edit: September 27, 2015, 02:33:07 pm by Ogiul »


Issue updated by Ogiul - September 27, 2015, 02:33:07 pm
  • Issue renamed from "Cen't prevent autorotate on Android" to "Can't prevent autorotate on Android"


Issue updated by captaincomic - September 30, 2015, 05:48:11 pm
  • Tags added: android


Jon

  • Chief Stencyler
  • *
October 02, 2015, 11:08:46 am
As far as I can tell, OpenFL hard wires in the orientations to either sensorPortrait or sensorLandscape.

While you can edit the manifest template to stop this, we'd have to modify the system to hook this up to our UI.

1) Edit in text editor:
stencyl ▸ plaf ▸ haxe ▸ lib ▸ lime ▸ lime ▸ legacy ▸ templates ▸ android ▸ template ▸ AndroidManifest.xml

2) Look for sensorPortrait/sensorLandscape and switch to just portrait/landscape.
  • Status changed from New to Confirmed
« Last Edit: October 02, 2015, 11:09:03 am by Jon »


Ogiul

  • Level 3 Stencyler
October 03, 2015, 02:21:16 pm
Thank you, Jon!

I modified the AndroidManifest.xml as described here above and it works as expected: now, if I rotate my device, the app does not rotate at all. Great!

I'm sorry, I did not understand everything in your message (because English is not my first language)... Can I expect to see this fix implemented in the next (private or public) Stencyl build?

Thanks!


Jon

  • Chief Stencyler
  • *
October 03, 2015, 04:39:05 pm
It will arrive in the future but not in the near future. Since we have to make this option more configurable than it currently is, it isn't as easy as editing a file and will take some digging to make it work.

(Of course, if nobody wants auto-rotate, we could make the switch instantly.)


Ogiul

  • Level 3 Stencyler
October 05, 2015, 02:13:49 pm
I do not know if nobody wants the auto-rotate... But I think the most of the users does not expect that the app can rotate when the autorotate box is not ticked.

As for now, on Android, if you tick the autorotate box, the app rotates if you rotate the device 0, 90, 180 or 270...
If you does not tick it, the app rotates anyway... but only if you move the phone + or - 180.
So you have no way to prevent problems when using accelerometer.

On iOS it works as expected: when the box is not ticked the app can not rotate at all, when it is ticked it can rotate.



Pages: 1

Details

  • Reported
    September 27, 2015, 02:32:13 pm
  • Updated
    October 05, 2015, 02:13:49 pm

  • View Status
    Public
  • Type
    Bug
  • Status
    Confirmed
  • Priority
    Normal
  • Version
    Stencyl 3.3, 3.3.2
  • Fixed in
    (none)
  • Assigned to
    (none)
  • Category
    Game Settings

Tags