zoukankan      html  css  js  c++  java
  • cocos2dx 2.x mac proj 开启模板

    为一个cocos2dx 2.x游戏配了下mac工程,运行后发现clippingNode没起作用,运行TestCpp中的clippingNode示例是起作用的,对比AppController.mm,发现是applicationDidFinishLaunching中少了一段代码,补充后如下(黄色部分为补充代码):

    -(void) applicationDidFinishLaunching:(NSNotification *)aNotification
    {
    // create the window
    // note that using NSResizableWindowMask causes the window to be a little
    // smaller and therefore ipad graphics are not loaded
    NSRect rect = NSMakeRect(0, 0, 2048, 1536);
    window = [[NSWindow alloc] initWithContentRect:rect
    styleMask:( NSClosableWindowMask | NSTitledWindowMask )
    backing:NSBackingStoreBuffered
    defer:YES];

    //fix begin
    //fix clippingNode issue
    //the below code is copy from TestCpp mac proj
    NSOpenGLPixelFormatAttribute attributes[] = {
    NSOpenGLPFADoubleBuffer,
    NSOpenGLPFADepthSize, 24,
    NSOpenGLPFAStencilSize, 8,
    0
    };

    NSOpenGLPixelFormat *pixelFormat = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attributes] autorelease];
    // allocate our GL view
    // (isn't there already a shared EAGLView?)
    glView = [[EAGLView alloc] initWithFrame:rect pixelFormat:pixelFormat];
    //fix end

    /* // allocate our GL view
    // (isn't there already a shared EAGLView?)
    glView = [[EAGLView alloc] initWithFrame:rect];
    */
    // set window parameters
    [window becomeFirstResponder];
    [window setContentView:glView];
    [window setTitle:@"HelloCpp"];
    [window makeKeyAndOrderFront:self];
    [window setAcceptsMouseMovedEvents:NO];

    [glView setFrameZoomFactor:0.4];

    cocos2d::CCApplication::sharedApplication()->run();
    }

  • 相关阅读:
    TOJ 2710: 过河 路径压缩
    树状数组模板
    TOJ 2017: N-Credible Mazes
    TOJ 4804: 树网的核
    Codeforces Round #440 (Div. 2, based on Technocup 2018 Elimination Round 2)
    Codeforces Round #441 (Div. 2, by Moscow Team Olympiad)
    TOJ 2541: Paper Cutting
    CODE FESTIVAL 2017 qual B
    hiho[Offer收割]编程练习赛30
    Codeforces Round #437 (Div. 2, based on MemSQL Start[c]UP 3.0
  • 原文地址:https://www.cnblogs.com/wantnon/p/4073025.html
Copyright © 2011-2022 走看看