mirror of
https://github.com/cocos/cocos4.git
synced 2026-12-04 10:32:39 +08:00
Merge pull request #58 from 2youyouo2/binary-orientation
fixed binary template
This commit is contained in:
+5
-21
@@ -26,7 +26,6 @@
|
||||
#import "RootViewController.h"
|
||||
#import "cocos2d.h"
|
||||
#import "platform/ios/CCEAGLView-ios.h"
|
||||
#include "ide-support/SimpleConfigParser.h"
|
||||
|
||||
@implementation RootViewController
|
||||
|
||||
@@ -56,43 +55,28 @@
|
||||
// Override to allow orientations other than the default portrait orientation.
|
||||
// This method is deprecated on ios6
|
||||
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
||||
|
||||
if (SimpleConfigParser::getInstance()->isLanscape()) {
|
||||
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
|
||||
}else{
|
||||
return UIInterfaceOrientationIsPortrait( interfaceOrientation );
|
||||
}
|
||||
|
||||
return UIInterfaceOrientationIsLandscape( interfaceOrientation );
|
||||
}
|
||||
|
||||
// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead
|
||||
- (NSUInteger) supportedInterfaceOrientations{
|
||||
#ifdef __IPHONE_6_0
|
||||
if (SimpleConfigParser::getInstance()->isLanscape()) {
|
||||
return UIInterfaceOrientationMaskLandscape;
|
||||
}else{
|
||||
return UIInterfaceOrientationMaskPortrait;
|
||||
}
|
||||
return UIInterfaceOrientationMaskAllButUpsideDown;
|
||||
#endif
|
||||
}
|
||||
|
||||
- (BOOL) shouldAutorotate {
|
||||
if (SimpleConfigParser::getInstance()->isLanscape()) {
|
||||
return YES;
|
||||
}else{
|
||||
return NO;
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
|
||||
[super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
|
||||
|
||||
cocos2d::GLView *glview = cocos2d::Director::getInstance()->getOpenGLView();
|
||||
|
||||
if (glview)
|
||||
{
|
||||
CCEAGLView *eaglview = (CCEAGLView*) glview->getEAGLView();
|
||||
|
||||
CCEAGLView *eaglview = (CCEAGLView*)glview->getEAGLView();
|
||||
|
||||
if (eaglview)
|
||||
{
|
||||
CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]);
|
||||
|
||||
Reference in New Issue
Block a user