My WIP game requires exactly one orientation.
In Tier 1, I was able to force this in the UntitledViewController.m shouldAutorotateToInterfaceOrientation function by return YES or NO as desired instead of using the agk::CanOrientationChange function.
In Tier 2, if I did the same thing and was forcing to a landscape mode and using SetVirtualResolution, it totally messed up the display resolution. I can repeat this reliably 100%.
So, I added a display to see what the reported orientation was and flipped about to see what was reported for the two landscape modes (Apple calls them Left and Right, depending upon which side the home button is on).
As reported in another post somewhere, the Left and Right do not line up with orientations 3 and 4 as might be expected.
So, I changed this:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//NSLog(@"Checking Orientation");
switch( interfaceOrientation )
{
case UIInterfaceOrientationPortrait: return agk::CanOrientationChange(1) ? YES : NO;
case UIInterfaceOrientationPortraitUpsideDown: return agk::CanOrientationChange(2) ? YES : NO;
case UIInterfaceOrientationLandscapeLeft: return agk::CanOrientationChange(3) ? YES : NO;
case UIInterfaceOrientationLandscapeRight: return agk::CanOrientationChange(4) ? YES : NO;
default: return NO;
}
}
to this:
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
//NSLog(@"Checking Orientation");
switch( interfaceOrientation )
{
case UIInterfaceOrientationPortrait: return agk::CanOrientationChange(1) ? YES : NO;
case UIInterfaceOrientationPortraitUpsideDown: return agk::CanOrientationChange(2) ? YES : NO;
case UIInterfaceOrientationLandscapeLeft: return agk::CanOrientationChange(4) ? YES : NO;
case UIInterfaceOrientationLandscapeRight: return agk::CanOrientationChange(3) ? YES : NO;
default: return NO;
}
}
And, lo and behold, when I used agk::SetOrientationAllowed(0,0,1,0) and specified only Landscape Right in the deployment info in Xcode, it worked exactly as I wished!
It displayed in only Landscape Right and would not flip!
Cheers,
Ancient Lady
AGK Community Tester