Skip to content

Commit 15f76a8

Browse files
committed
Added android orientation support that's configured via cconfig.
1 parent 3ada189 commit 15f76a8

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

cocos2d/Platforms/Android/CCActivity.m

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,19 @@ - (void)run
106106
screenMode = CCScreenScaledAspectFitEmulationMode;
107107
}
108108

109+
if([_cocos2dSetupConfig[CCSetupScreenOrientation] isEqual:CCScreenOrientationPortrait])
110+
{
111+
self.requestedOrientation = AndroidActivityInfoScreenOrientationSensorPortrait;
112+
}
113+
else if([_cocos2dSetupConfig[CCSetupScreenOrientation] isEqual:CCScreenOrientationLandscape])
114+
{
115+
self.requestedOrientation = AndroidActivityInfoScreenOrientationSensorLandscape;
116+
}
117+
else
118+
{
119+
self.requestedOrientation = AndroidActivityInfoScreenOrientationUnspecified;
120+
}
121+
109122
_glView = [[CCGLView alloc] initWithContext:self screenMode:screenMode scaleFactor:metrics.density];
110123
[metrics release];
111124
[_glView.holder addCallback:self];

0 commit comments

Comments
 (0)