Thursday, January 7, 2016

How to save your cocos2d-x project in Git repository

Hello this post is about how do you save your cocos2d-x project in any Git repository like github or bitbcuket.

Theory: When you save your project in a git repository you need to save the necessary code there and not include files generated by your computer, but that's very simple you only need the right git ignore file, I have my own gitIgnore file to use this

You can download or copy from here:
https://gist.github.com/OscarLeif/7a4ea339963bf8c75ddd

When you update your cocos2d-x project to the git repository it must look something like this.
Why ?

The root folder in the repository actually have the files to compile cocos2d-x. Here you can find this folders.

Classes: In this folder you here have you main code of the cocos2d-x game. So this is important here is where your main game start working, the main clases to make your project work are here. If you find this files AppDelegate.h & AppDelegate.cpp. There is where the game begins !!!.
Of course that is not when your game actually starts if you run this code on android, ios, windows, linux or mac. You need to start from that platform, basically it's the universal code.

cocos2d: That's cocos2d-x itself this one is necessary to compile but please this folder or anything inside it's not necesarry to upload to the repository. when you start to compile it it will generate big files and not important to save your work. In this screen shoot it show how big is this folder when you start to compile cocos2d-x
My code with resources it's just 10mb here is 5.25Gb that's a lot of information, but most of them is generated by the computer.

The folders that start with proj.platform

proj.android: It's the project of the android platform this one is for eclipse
proj.android-studio: It's the project of the android platform this one is for android studio
proj.win8.1-universal: It's the project of the windows universal platforms, and for windows universal platforms are windows 8.1 apps from the windows store not .exe file and windows phone. Short words: Windows desktop and windows phone
proj.win32: It's the project of the windows 32 bit platform. It's not like win8.1 this generate an exe file. I think this is the most portable in windows machines. you only need to install the c++ files and it must work on the computer with windows 7 or newer I never test it on Xp maybe should work.
proj.ios_mac It's the project of the mac and ios platform.
proj.linux: It's the project of the linux platform, of course cocos2d-x works on linux machines I never thest it maybe my git ignore file it's incomplete for linux,
Resources: this is like the classes folder it's shared for all the projects where you can find here.There is where you have your assets for the game like images, tilemaps, sounds.

But what happens here in the gitignore it saves all the necessary files to save your game.
It will not upload cocos2d folder. When you copy this project in any computer copy and paste cocos2d folder from any helloworld project and it will work.

Questions ?
Something you didn't understand just write.

No comments:

Post a Comment