Adjusting OIS Input State to Device Orientation

Discussion of issues specific to mobile platforms such as iOS, Android, Symbian and Meego.
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Adjusting OIS Input State to Device Orientation

Post by aleroy »

I recently switched to 1.80 and discovered the Viewport::getOrientationMode is deprecated. This effectively breaks my GUI code because I no longer have a way to find the OIS origin. OIS always measures input state coordinates from the corner opposite+left of the button (device button). Without knowing which corner that is--with respect to the device's current orientation--I can't translate the OIS state info so that (0,0) is always in the upper-left.

In other words, my code only works when the device is oriented with the button on the bottom.
If the button is to the left, the upper-left corner is (0, 1024)
If the button is to the right, the upper-left corner is ( 768, 0)
If the button is on the top, the upper-left corner is (768,1024)

Best I can do now is detect orientation change by comparing viewport width between two frames. But, that doesn't tell me which way the device rotated.

Any ideas?
User avatar
masterfalcon
OGRE Retired Team Member
OGRE Retired Team Member
Posts: 4270
Joined: Sun Feb 25, 2007 4:56 am
Location: Bloomington, MN
x 126

Re: Adjusting OIS Input State to Device Orientation

Post by masterfalcon »

Well, to be honest, the orientation mode code was more of a bandaid than a proper implementation. The best way to do it would be to either provide your own OgreView class or to add a transparent full screen UIView that you can use to track input yourself. It will be easier, more responsive and far more robust.
aleroy
Kobold
Posts: 31
Joined: Thu Feb 02, 2012 9:34 pm
x 6

Re: Adjusting OIS Input State to Device Orientation

Post by aleroy »

Yeah, I was afraid you were going to say that ... I was trying to avoid too much refactoring. But, you're right, it would be better.