美文网首页
cocosbuilder3编译问题

cocosbuilder3编译问题

作者: 保罗柴夫斯基 | 来源:发表于2019-04-16 23:32 被阅读0次

    cocosbuilder编辑器到目前也有7年没有更新过了,问题也比较多。
    我自己的一个老项目还需要使用cocosbuilder编辑器的情况,所以是时隔五年重新又趟了一次坑!
    记录解决方案

    使用cocos2d-objc 替换 cocos2d-iphone

    github cocos2d-obj

    Okay just worked through this.
    Make sure you pull branch v3.5.0.
    Step 1: Follow patrickhoey's Step 1 and modify .gitmodules
    Step 2: Make sure you're in the root directory of the CocosBuilder project and run:
    git submodule update --init --recursive
    This will error on cocos-iphone-classic.
    Step 3: cd CocosBuilder/libs/cocos2d-iphone
    Step 4: git checkout 5e8fdee5cdc4450ad32f5a8579ee6a0fdcbb1cfa
    Step 5: Get a copy of this project in an entirely separate directory. There have been files removed at some point that need to be re-added.
    https://github.com/cocos2d/cocos2d-iphone-classic
    Step 6: Copy the following files from the cocos2d-iphone-classic project:
    cocos-iphone-classic/cocos2d/ccFPSImages.m --> CocosBuilder/libs/cocos2d-iphone/cocos2d/ccFPSImages.m
    cocos-iphone-classic/cocos2d/Support/uthash.h --> CocosBuilder/libs/cocos2d-iphone/cocos2d/Support/uthash.h
    cocos-iphone-classic/cocos2d/Support/utlist.h --> CocosBuilder/libs/cocos2d-iphone/cocos2d/Support/utlist.h
    This worked for me.
    

    修改文件CCGLProgram.m

    #define EXTENSION_STRING "#extension GL_OES_standard_derivatives : enable"
    static NSString * g_extensionStr = @EXTENSION_STRING;
    - (BOOL)compileShader:(GLuint *)shader type:(GLenum)type byteArray:(const GLchar *)source
    {
        GLint status;
        if (!source)
            return NO;
        // BEGIN workaround for Xcode 7 bug
        BOOL hasExtension = NO;
        NSString *sourceStr = [NSString stringWithUTF8String:source];
        if([sourceStr rangeOfString:g_extensionStr].location != NSNotFound) {
            hasExtension = YES;
            NSArray *strs = [sourceStr componentsSeparatedByString:g_extensionStr];
            assert(strs.count == 2);
            sourceStr = [strs componentsJoinedByString:@"\n"];
            source = (GLchar *)[sourceStr UTF8String];
        }
        const GLchar *sources[] = {
            (hasExtension ? EXTENSION_STRING "\n" : ""),
        #ifdef __CC_PLATFORM_IOS
            (type == GL_VERTEX_SHADER ? "precision highp float;\n" : "precision mediump float;\n"),
        #endif
            "uniform mat4 CC_PMatrix;\n"
            "uniform mat4 CC_MVMatrix;\n"
            "uniform mat4 CC_MVPMatrix;\n"
            "uniform vec4 CC_Time;\n"
            "uniform vec4 CC_SinTime;\n"
            "uniform vec4 CC_CosTime;\n"
            "uniform vec4 CC_Random01;\n"
            "//CC INCLUDES END\n\n",
            source,
        };
        // END workaround for Xcode 7 bug
    

    参考地址

    相关文章

      网友评论

          本文标题:cocosbuilder3编译问题

          本文链接:https://www.haomeiwen.com/subject/gfswwqtx.html