【cococos 2 d-x IOSゲーム開発-シティクール2】python create_project
3568 ワード
開発者の労働成果を尊重し、転載する際は必ず出典を明記してください.http://blog.csdn.net/haomengzhu/article/details/17187011
<漁の達人>振り返る
【cococos 2 d-x IOSゲーム開発-漁の達人1】内容紹介
前節の回顧
【cococos 2 d-x IOSゲーム開発-都市クール1】クールゲーム紹介
1、準備作業【VS 2012】
一、cococos 2 d-xをダウンロードする
http://cocos2d-x.org/projects/cocos2d-x/wiki/Download
安定したバージョンは2.2.1で、pythonコマンドで各プラットフォームを構築するプロジェクトを提供し、非常に便利です.ダウンロード、解凍
二、pythonをダウンロードする
http://www.python.org/getit/
ダウンロード、インストール、端末にpythonを直接入力し、バージョン情報が表示されたらインストールに成功します.
ActivePython 2.7.5.6 (ActiveState Software Inc.) based on Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits"or "license"for more information. >>>
三、cococos 2 d-xプロジェクトの設立
cmdに入り、以下のコマンドを実行します.
create_project.pyは3つのパラメータ(エンジニアリング名:fishjoy、パッケージ名:com.haomengzhu.game、言語:cpp|js|lua)を提供することを要求します.
実行に成功すると、次の情報が表示されます.
Victorianディレクトリに入ると、これらの項目が表示されます.
どのようにして、全プラットフォームはすべてあなたに組み立てて、その上1つのClassesフォルダを共用して、つまりあなたは1つのプラットフォームでコードを更新して、全プラットフォームはすべて更新されました.
四、VS 2012プロジェクトを開く
に進みます..\cocos2d-x-2.2.1\projects\Victorian\proj.win 32ディレクトリの下で、プロジェクトVictorianを開きます.sln.
ファイルを追加cpp、GameLayer.h
ゲーム層の実現はすべてここにある.
監督が来ました.
シーンレイヤの実装:
<漁の達人>振り返る
【cococos 2 d-x IOSゲーム開発-漁の達人1】内容紹介
前節の回顧
【cococos 2 d-x IOSゲーム開発-都市クール1】クールゲーム紹介
1、準備作業【VS 2012】
一、cococos 2 d-xをダウンロードする
http://cocos2d-x.org/projects/cocos2d-x/wiki/Download
安定したバージョンは2.2.1で、pythonコマンドで各プラットフォームを構築するプロジェクトを提供し、非常に便利です.ダウンロード、解凍
二、pythonをダウンロードする
http://www.python.org/getit/
ダウンロード、インストール、端末にpythonを直接入力し、バージョン情報が表示されたらインストールに成功します.
ActivePython 2.7.5.6 (ActiveState Software Inc.) based on Python 2.7.5 (default, Sep 16 2013, 23:11:01) [MSC v.1500 64 bit (AMD64)] on win32 Type "help", "copyright", "credits"or "license"for more information. >>>
三、cococos 2 d-xプロジェクトの設立
cmdに入り、以下のコマンドを実行します.
cd ~/cocos2d-x-2.2.1/tools/project-creator/
python create_project.py -project Victorian -package com.haomengzhu.game -language cpp
create_project.pyは3つのパラメータ(エンジニアリング名:fishjoy、パッケージ名:com.haomengzhu.game、言語:cpp|js|lua)を提供することを要求します.
実行に成功すると、次の情報が表示されます.
proj.ios : Done!
proj.android : Done!
proj.win32 : Done!
proj.mac : Done!
proj.blackberry : Done!
proj.linux : Done!
proj.marmalade : Done!
New project has been created in this path: ../cocos2d-x-2.2.1/projects/Victorian
Have Fun!
Victorianディレクトリに入ると、これらの項目が表示されます.
Classes
Resources
proj.android
proj.ios
proj.mac
proj.win32
proj.blackberry
proj.linux
proj.marmalade
どのようにして、全プラットフォームはすべてあなたに組み立てて、その上1つのClassesフォルダを共用して、つまりあなたは1つのプラットフォームでコードを更新して、全プラットフォームはすべて更新されました.
四、VS 2012プロジェクトを開く
に進みます..\cocos2d-x-2.2.1\projects\Victorian\proj.win 32ディレクトリの下で、プロジェクトVictorianを開きます.sln.
ファイルを追加cpp、GameLayer.h
ゲーム層の実現はすべてここにある.
監督が来ました.
bool AppDelegate::applicationDidFinishLaunching()
{
// initialize director
CCDirector *pDirector = CCDirector::sharedDirector();
pDirector->setOpenGLView(CCEGLView::sharedOpenGLView());
// turn on display FPS
pDirector->setDisplayStats(true);
// set FPS. the default value is 1.0/60 if you don't call this
pDirector->setAnimationInterval(1.0 / 60);
// create a scene. it's an autorelease object
CCScene *pScene = GameLayer::scene();
// run
pDirector->runWithScene(pScene);
return true;
}
シーンレイヤの実装:
// on "init" you need to initialize your instance
bool GameLayer::init()
{
bool bRet = false;
do
{
//////////////////////////////////////////////////////////////////////////
// super init first
//////////////////////////////////////////////////////////////////////////
CC_BREAK_IF(! CCLayer::init());
//
_screenSize = CCDirector::sharedDirector()->getWinSize();
//
createGameScreen();
//
resetGame();
//listen for touches
this->setTouchEnabled(true);
//create main loop
this->schedule(schedule_selector(GameLayer::update));
bRet = true;
} while (0);
return bRet;
}
はインタフェースを予約し、次の節で実現する.