iOS Orientation bug

19 replies [Last post]
by: bluescrn
Status: Offline
Joined: 2011-02-26

Hi,

I've got a tilt-controlled game, locked to landscape mode (DispFixRot=2) - and I've noticed that in some cases the screen turns upside down, with a relatively small amount of tilt.

This is a bit of a problem for a tilt-to-steer game...

Repro steps:

- Marmalade 6.0.5
- IwGL app on iOS
- DispFixRot = 2

Hold the device in landscape mode, with the home button on the *left*

Rotate the device slowly, as if turning a steering wheel, either counter-clockwise or clockwise.

At around 45 degrees (iPhone 4) or 70 degrees (iPad 3), the screen flips upside down - much earlier than expected.

(If you hold the device with the home button on the *right*, it doesn't flip until you rotate well beyond 90 degrees)

by: Danny Chapman
Status: Offline
Joined: 2011-11-03
The numerical value for

The numerical value for DispFixRot isn't supported any more - you need to use a string (LandscapeFixed).

by: bluescrn
Status: Offline
Joined: 2011-02-26
The numerical values are

The numerical values are deprecated but still supported.

The problem still occurs with DispFixRot=Landscape

by: bluescrn
Status: Offline
Joined: 2011-02-26
Here's a video to show the

Here's a video to show the problem. Should make it fairly clear what's wrong. (This is after switching to DispFixRot=Landscape, just to rule out those old numeric values causing problems):

www.youtube.com/watch?v=z22DsNEyYqs&feature=youtu.be&hd=1

(It's a tilt-controlled game by default, and players are likely to reach that 45 degree or so angle with a bit of lively tilting)

As I'm using GLES2, I'm rotating the render myself, using the value returned by IwGLGetInt(IW_GL_ROTATE)

It's a relatively recent bug, as it's not present in Little Acorns, which used the same code, but used a 5.x version of Marmalade (can't remember the exact version)

by: bluescrn
Status: Offline
Joined: 2011-02-26
(To make it even clearer, the

(To make it even clearer, the first 15secs show the bad/early flips, and after that, I rotate the device 180 degrees for comparison)

by: DGuy
Status: Offline
Joined: 2011-04-06
Try "DispFixRot

Try "DispFixRot=FixedLandscape" to disable flipping 180 degrees.

Does that make any difference?

-David

by: DGuy
Status: Offline
Joined: 2011-04-06
Oh, and BTW, +1 to your

Oh, and BTW, +1 to your choice of background music! ;)

-David

by: bluescrn
Status: Offline
Joined: 2011-02-26
lol, I did intend to strip

lol, I did intend to strip the audio off but forgot... Been listening to lots of random stuff on Spotify whilst coding!

by: bluescrn
Status: Offline
Joined: 2011-02-26
Problem is still present in 6

Problem is still present in 6.0.6

It only seems to affect iOS. Cannot reproduce it on Android.

by: Rocifier
Status: Offline
Joined: 2011-04-05
This is strange. I don't get

This is strange. I don't get this problem. But I am testing manually for the orientation by using GetInt() from the device (don't recall the actual code)

by: Rocifier
Status: Offline
Joined: 2011-04-05
By the way, bluescrn, want to

By the way, bluescrn, want to ask you out of curiosity, did you get many in-app purchases from your acorns game?

by: Jez Hammond
Status: Offline
Joined: 2010-10-11
Looks like you are not

Looks like you are not checking all four orientation possibilities, and are only checking for a 180? As the 180 is relative to portrait you are in a muddle!

I can make a suggestion but as I allow gameplay in both landscape and portrait, then it is a guess how you might deal with fixed landscape...

Test for rot90 and rot270 only!

by: bluescrn
Status: Offline
Joined: 2011-02-26
There's nothing to test for,

There's nothing to test for, as such.

I'm using IwGLGetInt, and it as I'm locked to landscape using DispFixRot, it only ever returns one of two values.

All I'm doing in my camera code (used for both 2D and 3D rendering) is this:

mRot.SetIdentity();	
float fRot = ( ((float)IwGLGetInt(IW_GL_ROTATE))* PI * 0.5f );
mRot.SetRotationZ( fRot );
mProjRotated = s_xCurrentCamera.GetProjMatrix() * mRot;

This same code was used in Little Acorns (when running in GLES2.0 mode), and it didn't have this problem back then.

by: p.glagol
Status: Offline
Joined: 2012-02-11
Same problem...

Same problem...
We will publish our game soon. Please fix it.

Only with Landscape mode.

by: bluescrn
Status: Offline
Joined: 2011-02-26
Good to know it's not just me

Good to know it's not just me... would be nice to get this acknowledged as a bug. Definitely didn't happen with the 5.x version that we shipped Little Acorns using (don't know the exact version number, though).

The worst-case workaround is, I suppose, to lock the game to a single landscape orientation, instead of allowing either. Not ideal though.

by: p.glagol
Status: Offline
Joined: 2012-02-11
up.

up.

by: bluescrn
Status: Offline
Joined: 2011-02-26
I showed them this one at the

I showed them this one at the developer day last week, and they've got a fix for it - so with any luck it'll be fixed in the next release :)

by: bluescrn
Status: Offline
Joined: 2011-02-26
Confirmed fixed in 6.1,

Confirmed fixed in 6.1, hooray! :)

by: p.glagol
Status: Offline
Joined: 2012-02-11
>> Confirmed fixed in 6.1,

>> Confirmed fixed in 6.1, hooray! :)

Hm. I upgraded the sdk today, but this bug still here. Are you sure about that?

by: bluescrn
Status: Offline
Joined: 2011-02-26
Yes, it's definitely fixed in

Yes, it's definitely fixed in my project, at least when running on an iPhone 4.

(Haven't re-tested on other iDevices yet)

Latest Posts

Latest Comments

Top Contributors

  • amanda
  • riaan
  • alexand3
  • alexand4
  • alexand7
  • alexand889
  • alexand12191
  • remote9991
  • remote9992
  • test