G'day, folks!
I'd really appreciate it if someone could try this for me and report back on the observed behaviour. I have a problem with button touches being vertically offset when the device orientation changes. It may well be touches in general, but buttons are easy to test on.
If you have the Sparrow demo, you'll need to make these changes to run my test. All of these changes are in Game.m:
// Add this to the end of initWithWidth: height: (inside the curly braces and definitely before return self) [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:@"UIDeviceOrientationDidChangeNotification" object:nil]; // Add this function below initWithWidth: height: - (void)orientationChanged:(UIEvent *)event { UIDeviceOrientation orientation = [UIDevice currentDevice].orientation; if (orientation == UIDeviceOrientationPortrait) { mMainMenu.rotation = 0; mMainMenu.x = mMainMenu.y = 0; } else if (orientation == UIDeviceOrientationPortraitUpsideDown) { mMainMenu.rotation = SP_D2R(180); mMainMenu.x = self.width; mMainMenu.y = self.height; } NSLog(@"Device Orientation: %i", orientation); }
Note that this needs to be tested on a device. I have only tested it on an iPhone 4 and a 3GS. Now load the demo up and hold it in Portrait orientation. Try to press the "RenderTexture" button on the main menu, but focus on pressing towards the lower half of the button. It should be easy to press and respond as expected. Press the "back" button to return to the main menu.
Now turn the device to PortraitUpsideDown orientation. Again, try to press the "RenderTexture" button focusing on its lower half. If you're like me, it doesn't register the touch until you move your finger upwards towards the top half of the button.
I'd love to solve this little problem because it's important that my game can be played from multiple orientations. It's interesting to note that it doesn't seem to occur in the simulator. Thanks to any and all who spend the time to experiment for me