Posted: 13th Sep 2011 3:15
i'm trying to make my game landscape only in tier 2 using xcode. in the UntitledViewController at function shouldAutoRotateToInterfaceOrientation if i change this to be

+ Code Snippet
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight) {
   return YES;
}

return NO;



this will prevent the game from going into portrait mode. however when you launch the game the background image is no rotated 90 degrees and is squished. if you leave the above function the way it is, it is fine, however it goes in portrait mode and there are letterbox strips on top and bottom. so as to prevent this i thought id just disallow it to go in portrait mode, then saw thsi bug.

code example

+ Code Snippet
SetVirtualResolution(1024, 768)
SetDisplayAspect(4.0 / 3.0)

//load assets
loadAssets()



function loadAssets()

    // display a background
    CreateSprite(1, LoadImage("gameboard.png"))
    SetSpriteSize(1, 1024, 768)

endfunction



//Main Game Loop
do

Sync()

loop



see attached images KeepLandscape is what happens if i try to keep it landscape only, and AllowPortrait is what i want it to look like, but i dont want to allow portrait to get this.
Posted: 13th Sep 2011 9:32
use:

agk::SetOrientationAllowed (0, 0, 1, 0);

and you are all set!
Posted: 15th Sep 2011 21:49
well this works if i still allow the xcode code to allow any rotation, however if in the controller i allow only landscape , same thing happens, but i guess this is good enough does the same exact thing.

thanks