zoukankan      html  css  js  c++  java
  • mac下配置cocos2d-x3.0

    今天看到3.0的正式版公布了,就马上荡下来试试3.0,以下记录下环境变量配置过程

    打开用户文件夹下.bash_profile文件,配置环境

    1、首先配置下android sdk,我的是在opt文件夹下

    #sdk
    export ANDROID_SDK_ROOT=/opt/android-sdk-macosx
    export PATH=$PATH:$ANDROID_SDK_ROOT
    export PATH=$PATH:$ANDROID_SDK_ROOT/platform-tools
    

    2、ndk

    #ndk
    export NDK_ROOT=/opt/android-ndk-r9b
    export PATH=$PATH:$NDK_ROOT
    

    3、ant 

    #ant
    export ANT_ROOT=/opt/apache-ant-1.9.3/bin
    export PATH=$PATH:$ANT_ROOT
    

    等一切都配置好之后,我们如今就应该到终端下cocos2d-x3.0的文件夹下运行下面命令:

    ./setup.py
    

    运行过之后终端会显示下面内容

    ???mcbookpro:cocos2d-x-3.0$ ./setup.py 
    
    Setting up cocos2d-x...
    ->Check environment variable COCOS_CONSOLE_ROOT
      ->Find environment variable COCOS_CONSOLE_ROOT...
        ->COCOS_CONSOLE_ROOT is found : /Project/cocos2d-x-3.0/tools/cocos2d-console/bin
    
    ->Configuration for Android platform only, you can also skip and manually edit "/Users/你的username/.bash_profile"
    
    ->Check environment variable NDK_ROOT
      ->Find environment variable NDK_ROOT...
        ->NDK_ROOT is found : /opt/android-ndk-r9b
    
    ->Check environment variable ANDROID_SDK_ROOT
      ->Find environment variable ANDROID_SDK_ROOT...
        ->ANDROID_SDK_ROOT is found : /opt/android-sdk-macosx
    
    ->Check environment variable ANT_ROOT
      ->Find environment variable ANT_ROOT...
        ->ANT_ROOT is found : /opt/apache-ant-1.9.3/bin
    
    
    Please execute command: "source /Users/你的username/.bash_profile" to make added system variables take effect
    

    假设出现以上内容我们的配置就成功了,你到你的 /Users/你的username/.bash_profile文件里看一下,会默觉得我们加入�下面两行代码

    # Add environment variable COCOS_CONSOLE_ROOT for cocos2d-x
    export COCOS_CONSOLE_ROOT=/Project/cocos2d-x-3.0/tools/cocos2d-console/bin
    export PATH=$COCOS_CONSOLE_ROOT:$PATH
    

    这时候你再重新启动或运行下面代码:

    source /Users/你的username/.bash_profile
    

    运行完毕后没有不论什么提示,没关系,linux下没有消息,就是好消息。

    完毕以上之后,你在终端下敲以cocos new 命令,你会惊奇的发现

    mcbookpro:cocos2d-x-3.0$ cocos new
    Runing command: new
    usage: cocos new [-h] [-p PACKAGE_NAME] -l {cpp,lua,js} [-d DIRECTORY]
                     [-t TEMPLATE_NAME] [--no-native]
                     [PROJECT_NAME]
    cocos new: error: argument -l/--language is required
    

    你能够敲下面命令创建自己的helloworldproject

     cocos new helloworld -p com.helloworld -l cpp -d /Project/cocos2dx/
    

    //为第一次搞的小盆友们解释下这几个參数:
    helloworld//project名  
    -p 后跟你的包名 
    -l cpp  这是一个cppproject
    -d 后跟的是你要建的project路径
    

    命令运行完之后终端下出现:

    mcbookpro:cocos2d-x-3.0$ cocos new helloworld -p com.package -l cpp -d /Project/
    
    Runing command: new
    > Copy template into /Project/helloworld
    > Copying cocos2d-x files...
    > Rename project name from 'HelloCpp' to 'helloworld'
    > Replace the project name from 'HelloCpp' to 'helloworld'
    > Replace the project package name from 'org.cocos2dx.hellocpp' to 'com.package'
    

    oh my god!我们的配置到如今就完毕了,这是多么的简单呀!

    那就尽情的享受游戏开发给我们带来的无穷乐趣吧!!!

    欢迎转帖,记得标明出处,谢谢

  • 相关阅读:
    leetcode 309. Best Time to Buy and Sell Stock with Cooldown
    leetcode 714. Best Time to Buy and Sell Stock with Transaction Fee
    leetcode 32. Longest Valid Parentheses
    leetcode 224. Basic Calculator
    leetcode 540. Single Element in a Sorted Array
    leetcode 109. Convert Sorted List to Binary Search Tree
    leetcode 3. Longest Substring Without Repeating Characters
    leetcode 84. Largest Rectangle in Histogram
    leetcode 338. Counting Bits
    git教程之回到过去,版本对比
  • 原文地址:https://www.cnblogs.com/hrhguanli/p/3908037.html
Copyright © 2011-2022 走看看