123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116 |
- #import "RootViewController.h"
- #import "cocos2d.h"
- #import "platform/ios/CCEAGLView-ios.h"
- @implementation RootViewController
- - (void)loadView {
-
- CCEAGLView *eaglView = [CCEAGLView viewWithFrame: [UIScreen mainScreen].bounds
- pixelFormat: (__bridge NSString *)cocos2d::GLViewImpl::_pixelFormat
- depthFormat: cocos2d::GLViewImpl::_depthFormat
- preserveBackbuffer: NO
- sharegroup: nil
- multiSampling: NO
- numberOfSamples: 0 ];
-
-
- [eaglView setMultipleTouchEnabled:NO];
-
-
- self.view = eaglView;
- }
- - (void)viewDidLoad {
- [super viewDidLoad];
- }
- - (void)viewWillAppear:(BOOL)animated {
- [super viewWillAppear:animated];
- }
- - (void)viewDidDisappear:(BOOL)animated {
- [super viewDidDisappear:animated];
- }
- #ifdef __IPHONE_6_0
- - (NSUInteger) supportedInterfaceOrientations{
- return UIInterfaceOrientationMaskAllButUpsideDown;
- }
- #endif
- - (BOOL) shouldAutorotate {
- return YES;
- }
- - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
- [super didRotateFromInterfaceOrientation:fromInterfaceOrientation];
- auto glview = cocos2d::Director::getInstance()->getOpenGLView();
- if (glview)
- {
- CCEAGLView *eaglview = (__bridge CCEAGLView *)glview->getEAGLView();
- if (eaglview)
- {
- CGSize s = CGSizeMake([eaglview getWidth], [eaglview getHeight]);
- cocos2d::Application::getInstance()->applicationScreenSizeChanged((int) s.width, (int) s.height);
- }
- }
- }
- - (BOOL)prefersStatusBarHidden {
- return YES;
- }
- - (void)didReceiveMemoryWarning {
-
- [super didReceiveMemoryWarning];
-
- }
- @end
|