美文网首页
cocos2d-x 初学者的困惑

cocos2d-x 初学者的困惑

作者: 我是吸血鬼 | 来源:发表于2018-03-10 16:05 被阅读39次

    1、如何设置cocos2d-x 背景透明
    参考了此博客点击访问

    在以下代码块添加 glClearColor

    void Director::setGLDefaultValues()
    {
        // This method SHOULD be called only after openGLView_ was initialized
        CCASSERT(_openGLView, "opengl view should not be null");
    
        setAlphaBlending(true);
        setDepthTest(false);
        setProjection(_projection);
    
        //here to clear color
        glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
    
    }
    
        glClearColor(0.0f,0.0f,0.0f,0.0f); // add it to make 3D transparent  
      
        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
    
        //add code bofore here 
        /* to avoid flickr, nextScene MUST be here: after tick and before draw.
         * FIXME: Which bug is this one. It seems that it can't be reproduced with v0.9
         */
        if (_nextScene)
        {
            setNextScene();
        }
    

    2、如何编译一个cocos2d工程针对android-studio

    cocos compile -p android android-studio
    
    

    在命令行里直接输入 cocos --help可以查看相关命令的使用帮助

    1. 如何命令行建立一个工程
    cocos new -p(package name) com.cocos.demo -l(language) cpp
    

    相关文章

      网友评论

          本文标题:cocos2d-x 初学者的困惑

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