LoginSignup
0
2

More than 5 years have passed since last update.

cocos2d-xをやってみた導入編(ios)

Posted at

はじめに

iOS開発が2年目に差し掛かるにあたって、
個人的に興味があったcocos2d-xに挑戦してみようと思い至りました。
webに投稿すること自体も初めてです。

環境

  • macOS sierra バージョン10.12.5
  • xcode 8.3.3

用意するもの

環境構築

1. Command Line Toolsをインストール

ターミナルを起動して以下のコマンドを入力

USER $ xcode-select --install

以下のようなダイアログが出るのでinstallを選択
Qiita

2. cocos2d-xをインストール

ダウンロードしたcocos2d-x-3.16のディレクトリへ移動
(ダウンロード先:http://www.cocos2d-x.org/download)

$ cd ~/cocos2d-x-3.15.1/

セットアップ用のコマンドを入力

$ ./setup.py

androidのSDK,NDK,ANTの確認が求められると思うが、
今回はandroidは使用しないのでenterでスキップ

これでcococsコマンドが利用できるようになる

$ cocos
を実行すると以下のような内容が出力される

/Users/user/cocos2d-x-3.15.1/tools/cocos2d-console/bin/cocos.py 2.3 - cocos >console: A command line tool for Cocos2d-x.

Available commands:
  run              Compiles, deploy and run project on the target.
  gen-libs         Generate prebuilt libs of engine. The libs will be placed >in 'prebuilt' folder of the engine root path.
  luacompile       Encrypt and/or compile lua files.
  deploy           Compile and deploy a project to a device/simulator.
  package          Manage package for cocos.
  compile          Compile projects to binary.
  gen-simulator    Generate Cocos Simulator.
  new              Creates a new project.
  jscompile        Compile and/or compress js files.

Available arguments:
  -h, --help          Show this help information.
  -v, --version           Show the version of this command tool.
  --ol ['en', 'zh', 'zh_tr']  Specify the language of output messages.
  --agreement ['y', 'n']      Skip the agreement with specified value.

Example:
  cocos new --help
  cocos run --help

3. cocos2d-xのプロジェクト作成

cocos newでプロジェクト作成
コマンドの解説と使用法の出力を参考

usage: cocos new [-h] [-p PACKAGE_NAME] [-d DIRECTORY] [-t TEMPLATE_NAME]
                [--ios-bundleid IOS_BUNDLEID] [--mac-bundleid MAC_BUNDLEID]
                [-e ENGINE_PATH] [--portrait] -l {cpp,lua,js}
                [PROJECT_NAME]

サンプルコマンド

$ cocos new SampleCocos -p com.mycompany.SampleCocos -l cpp -d ~/Desktop/myProdacts

おわり

とりあえず今回はここまで。
次回から手を動かしてみて、
色々と書いていこうと思います。

参考書

cocos2d-xではじめるスマートフォンゲーム開発 :
(http://gihyo.jp/book/2015/978-4-7741-7055-8)

0
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
2