Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose device orientation methods to the AppDelegate #930

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions cocos2d/CCProtocols.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
-(GLKMatrix4) updateProjection;

#ifdef __CC_PLATFORM_IOS
-(NSUInteger)supportedInterfaceOrientations;
/** Returns a Boolean value indicating whether the CCDirector supports the specified orientation. Default value is YES (supports all possible orientations) */
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation;

Expand Down
6 changes: 6 additions & 0 deletions cocos2d/Platforms/iOS/CCAppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,9 @@ @implementation CCNavigationController
// Only valid for iOS 6+. NOT VALID for iOS 4 / 5.
-(NSUInteger)supportedInterfaceOrientations
{
if ([_appDelegate respondsToSelector:_cmd])
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

tabs/spaces. :-)

return (NSUInteger)[_appDelegate supportedInterfaceOrientations];

if ([_screenOrientation isEqual:CCScreenOrientationAll])
{
return UIInterfaceOrientationMaskAll;
Expand All @@ -94,6 +97,9 @@ -(NSUInteger)supportedInterfaceOrientations
// Only valid on iOS 4 / 5. NOT VALID for iOS 6.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if ([_appDelegate respondsToSelector:_cmd])
return (BOOL)[_appDelegate shouldAutorotateToInterfaceOrientation:interfaceOrientation];

if ([_screenOrientation isEqual:CCScreenOrientationAll])
{
return YES;
Expand Down