• <ins id="pjuwb"></ins>
    <blockquote id="pjuwb"><pre id="pjuwb"></pre></blockquote>
    <noscript id="pjuwb"></noscript>
          <sup id="pjuwb"><pre id="pjuwb"></pre></sup>
            <dd id="pjuwb"></dd>
            <abbr id="pjuwb"></abbr>

            l

            成都手游碼農一枚
            隨筆 - 32, 文章 - 0, 評論 - 117, 引用 - 0
            數據加載中……

            [cocos2d-x] iphone5 填充黑邊適配方案。

            看不慣黑邊又不想拉伸的解決方案,很多游戲也這么處理,直接用邊框填充黑邊。


                // Set RootViewController to window
                if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0)
                {
                    EAGLView *__glView = [EAGLView viewWithFrame: [window bounds]
                                                     pixelFormat: kEAGLColorFormatRGBA8
                                                     depthFormat: GL_DEPTH_COMPONENT16
                                              preserveBackbuffer: NO
                                                      sharegroup:nil
                                                   multiSampling:NO
                                                 numberOfSamples:0];
                    
                    UIView* view = [[UIView alloc] initWithFrame:[window bounds]];
                    [view setBackgroundColor:[UIColor blueColor]];
                    
                    // Use RootViewController manage EAGLView
                    viewController = [[[RootViewController alloc] initWithNibName:nil bundle:nil] autorelease];
                    viewController.wantsFullScreenLayout = YES;
                    viewController.view = __glView;
                    
                    // warning: addSubView doesn't work on iOS6
                    [window addSubview: viewController.view];
                    
                    s_rootView = __glView;
                    s_rootViewController = viewController;
                    
                    // Set RootViewController to window
                    [window makeKeyAndVisible];
                    [[UIApplication sharedApplication] setStatusBarHidden: YES];
                    
                    [window setRootViewController:viewController];
                }
                else
                {
                    bool i5 = false;
                    
                    CGRect r = [window bounds];
                    float f = 1.0f * r.size.height / r.size.width - 960.0f / 640;
                    //printf("---- %f,%f,%f", r.size.height, r.size.width, f);
                    if (!(f < 0.001 && f > -0.001))
                    {
                        i5 = true;
                    }
                    
                    EAGLView *__glView = [EAGLView viewWithFrame: CGRectMake(0, i5 ? 44 : 0, 320, 480)//[window bounds]
                                                     pixelFormat: kEAGLColorFormatRGBA8
                                                     depthFormat: GL_DEPTH_COMPONENT16
                                              preserveBackbuffer: NO
                                                      sharegroup:nil
                                                   multiSampling:NO
                                                 numberOfSamples:0];
                    
                    UIView* rootView = [[[UIView alloc] initWithFrame:[window bounds]] autorelease];
                    [rootView addSubview:__glView];
                    
                    if (i5)
                    {
                        // top
                        UIImageView* topView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"top.png"]] autorelease];
                        [rootView addSubview:topView];
                        [topView setFrame:CGRectMake(0, 0, 320, 44)];
                    
                        // bottom
                        UIImageView* bottomView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"bottom.png"]] autorelease];
                        [rootView addSubview:bottomView];
                        [bottomView setFrame:CGRectMake(0, 524, 320, 44)];
                    
                        s_sharedApplication.setKeyboardOffsetY(44 * 2);
                    }
                    
                    // Use RootViewController manage EAGLView
                    viewController = [[[RootViewController alloc] initWithNibName:nil bundle:nil] autorelease];
                    viewController.wantsFullScreenLayout = YES;
                    viewController.view = rootView;

                    // use this method on ios6
                    [window setRootViewController:viewController];
                    
                    s_rootView = rootView;
                    s_rootViewController = viewController;
                    
                    // Set RootViewController to window
                    [window makeKeyAndVisible];
                    [[UIApplication sharedApplication] setStatusBarHidden: YES];
                }

            posted on 2013-07-02 10:56 l1989 閱讀(2024) 評論(0)  編輯 收藏 引用 所屬分類: 游戲

            亚洲精品tv久久久久久久久| 久久电影网一区| 久久久久久A亚洲欧洲AV冫| 国产无套内射久久久国产| 久久精品二区| 日产精品99久久久久久| 99久久国产免费福利| 久久亚洲日韩看片无码| 久久精品国产91久久麻豆自制| 欧美麻豆久久久久久中文| 久久99国产综合精品免费| 国产91久久综合| 久久精品无码专区免费青青| 国产国产成人久久精品| 久久精品人人做人人爽97| 色8激情欧美成人久久综合电| 久久久久亚洲精品无码蜜桃| 久久久久综合国产欧美一区二区| 久久精品亚洲一区二区三区浴池| 最新久久免费视频| 久久久精品人妻无码专区不卡 | 久久综合色老色| 91精品日韩人妻无码久久不卡| 亚洲精品无码久久久影院相关影片| 国产精品久久久天天影视香蕉| 久久综合给合久久狠狠狠97色69| 亚洲欧美日韩精品久久亚洲区 | 精品久久久久久亚洲| 2019久久久高清456| 久久乐国产精品亚洲综合 | 2020久久精品亚洲热综合一本| 久久AⅤ人妻少妇嫩草影院| 77777亚洲午夜久久多喷| 精品久久久久香蕉网| 亚洲精品tv久久久久久久久 | 久久综合给合久久国产免费| 久久久久亚洲AV无码观看| 亚洲人成无码久久电影网站| 亚洲Av无码国产情品久久| 色综合久久天天综线观看| 99久久香蕉国产线看观香|