zoukankan      html  css  js  c++  java
  • cocos2dx 3.1从零学习(六)——CocosStudio(VS2013project导入及环境设置)

    导入libCocosStudio、libExtensions、libGUI

    新建的project例如以下图:


    加入现有项目

    右键解决方式。例如以下操作:


    分别加入下面三个项目:

    (project路径)cocos2dcocosuiproj.win32libGUI.vcxproj

    (project路径)cocos2dcocoseditor-supportcocostudioproj.win32libCocosStudio.vcxproj

    (project路径)cocos2dextensionsproj.win32libExtensions.vcxproj

    完毕后如图:



    加入引用:





    加入 附加包括文件夹。防止引入不了头文件:


    须要有:

    $(EngineRoot)cocoseditor-support
    $(EngineRoot)cocos
    $(EngineRoot)cocosaudioinclude
    $(EngineRoot)external
    $(EngineRoot)externalchipmunkincludechipmunk
    $(EngineRoot)extensions
    $(EngineRoot)
    ..Classes


    编译代码!

    编译错误及解决方式:

    1. 编辑器未更新

    C:Program Files (x86)MSBuildMicrosoft.Cppv4.0V120Microsoft.Cpp.Platform.targets(64,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v100 build tools, please install Visual Studio 2010 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Upgrade Solution...".
    在新加入的项目 右键更新VC++编译器。注意报这样的错的项目名称右边会有(VS2010***)的提示,就更新吧!


    使用cocosstudio导出的project。

    #include "cocos2d.h"
    #include "cocostudio/CocoStudio.h"
    #include "ui/CocosGUI.h"
    using namespace cocos2d;
    using namespace cocostudio;
    using namespace ui;


    新手通过json文件读取控件的时候,注意它们的父子关系。不然会崩溃。

        //载入CocosStudio导出的资源
        auto uiLayer = GUIReader::getInstance()->widgetFromJsonFile("StartUI/StartUI.ExportJson");
        this->addChild(uiLayer);
    
        auto bg = uiLayer->getChildByName("bg");
        auto button =(Button *) bg->getChildByName("button");
        button->runAction(MoveBy::create(1, Point(-111, 0)));
        button->addTouchEventListener(this, toucheventselector(CocosStudio::onButton) );

    编译错误及解决方式:

    using namespace ui; 报错的话。在前面加上using namespace cocos2d ;就能够了。


  • 相关阅读:
    前端开发者也可以酷酷地开发桌面程序
    手把手教你怎么搭建angular+gulp的项目(一)
    在Angular中,如果权限值是异步请求所得,如何将其设置为HTTP请求头的Authorization?
    AngularJs ng-repeat指令中怎么实现含有自定义指令的动态html
    第一篇随笔,练练手
    我参与 Seata 开源项目的一些感悟
    一次 kafka 消息堆积问题排查
    图解 Kafka 水印备份机制
    Seata 动态配置订阅与降级实现原理
    记一次 Kafka 集群线上扩容
  • 原文地址:https://www.cnblogs.com/mfrbuaa/p/5074274.html
Copyright © 2011-2022 走看看