Merge branch 'develop' into develop_nutty_modify_framework_for315

This commit is contained in:
CaiWenzhi 2014-03-06 15:44:18 +08:00
commit dc7abd07c0
6 changed files with 282 additions and 10 deletions

View File

@ -23,13 +23,15 @@ How to start a new game
-----------------------
1. Download the code from [cocos2d download site][4]
2. Enter `tools/project-creator`
3. Run the `create_project.py` script
2. Run `setup.py`
3. Run the `cocos` script
Example:
$ cd cocos2d-x/tools/project-creator
$ ./create_project.py -n mygame -k com.your_company.mygame -l cpp -p /home/mygame
$ cd cocos2d-x
$ ./setup.py
$ source FILE_TO_SAVE_SYSTEM_VARIABLE
$ cocos new mygame -p com.your_company.mygame -l cpp -d /home/mygame
$ cd /home/mygame
### Build new project for android ###

View File

@ -76,7 +76,7 @@
* gcc 4.7 for Linux or Android. For Android ndk-r9 or newer is required.
* Visual Studio 2012 (for Windows)
## Run samples
## How to run TestCpp
### Mac OSX & iOS
@ -94,7 +94,7 @@ Can run sample on Android in two ways:
**By commnad**
$ cd cocos2d-x
$ ./install.py
$ ./setup.py
$ cd build
$ ./android-build.py -p 10
$ adb install cocos2d-x/tests/proj.android/bin/TestDemo-debug.apk
@ -104,7 +104,7 @@ Then click item on Android device to run tests. Available value of `-p` is the A
**Using Eclipse**
$ cd cocos2d-x
$ ./install.py
$ ./setup.py
$ cd build
$ ./android-build.py
@ -139,6 +139,16 @@ Run
$ cd bin/testcpp
$ ./testcpp
## How to start a new game
$ cd cocos2d-x
$ ./setup.py
$ source FILE_TO_RECORD_SYSTEM_VARIABLE
`FILE_TO_RECORD_SYSTEM_VARIABLE` may be `~/.bash_profile`, `~/.bash_login` or `~./.profile`
$ cocos new MyGame -p com.MyCompany.MyGame -l cpp -d directory_to_save
Because `cocos run` command is not ready, so you should do it manually as running `TestCpp`. After `cocos run` command is finished, can just run `cocos run` to run the new game on demand target.
# Highlights of v3.0

View File

@ -1 +1 @@
c95c8696018ed9dbb68d20bb12242bfc8de6c273
b8e377ea1413a393a14914cae394a4d6a414b2c4

View File

@ -0,0 +1,112 @@
#This configure file use .gitingore rules.
#So you can config this file like config .gitingore
#
# Ignore thumbnails created by windows
Thumbs.db
.git
# ignore copy files
/lib
/linux-build
/samples
/templates
/tests
/plugin/samples
/tools
.gitattributes
.gitignore
.gitmodules
.travis.yml
setup.py
# Ignore files build by Visual Studio
win32-msvc-vs201*-x86
*.obj
*.exe
*.pdb
*.aps
*.vcproj.*.user
*.vspscc
*_i.c
*.i
*.icf
*_p.c
*.ncb
*.suo
*.tlb
*.tlh
*.bak
*.cache
*.ilk
*.log
[Bb]in
[Dd]ebug/
[Dd]ebug.win32/
*.sbr
*.sdf
obj/
[Rr]elease/
[Rr]elease.win32/
_ReSharper*/
[Tt]est[Rr]esult*
ipch/
*.opensdf
# Ignore files build by ndk and eclipse
libs/
bin/
obj/
gen/
assets/
local.properties
# Ignore python compiled files
*.pyc
# Ignore files build by airplay and marmalade
build_*_xcode/
build_*_vc10/
# Ignore files build by xcode
*.mode*v*
*.pbxuser
*.xcbkptlist
*.xcscheme
*.xcworkspacedata
*.xcuserstate
*.xccheckout
xcschememanagement.plist
.DS_Store
._.*
xcuserdata/
DerivedData/
# Ignore files built by AppCode
.idea/
# Ignore files built by bada
.Simulator-Debug/
.Target-Debug/
.Target-Release/
# Ignore files built by blackberry
Simulator/
Device-Debug/
Device-Release/
# Ignore vim swaps
*.swp
*.swo
# Ignore files created by create_project.py
/projects
# CTags
tags
#include
!/tools/cocos2d-console/console/bin/
!/plugin-x/plugin-x_ios.xcworkspace/

View File

@ -7,14 +7,13 @@ COMMITTAG="[AUTO][ci skip]: updating cocos2dx_files.json"
PUSH_REPO="https://api.github.com/repos/cocos2d/cocos2d-x/pulls"
OUTPUT_FILE_PATH="${PROJECT_ROOT}/templates/cocos2dx_files.json"
# Exit on error
set -e
generate_cocosfiles_json()
{
echo "Updates cocos_files.json"
./for-each-file-in-dir.sh > "${OUTPUT_FILE_PATH}"
./generate-template-files.py
}
if [ "$GEN_COCOS_FILES"x != "YES"x ]; then

View File

@ -0,0 +1,149 @@
#!/usr/bin/python
#coding=utf-8
"""****************************************************************************
Copyright (c) 2013 cocos2d-x.org
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************"""
import os
import sys
import re
class CocosFileList:
"""
Function:
List cocos engine's files and save to "../module/cocos_file_list.json".
config "config.gitingore" file can set exclude or include files.
"""
def __init__(self):
self.excludeConfig=[]
self.inludeConfig=[]
self.rootDir = ""
self.fileList=[]
def readIngoreFile(self, fileName):
"""
Read configure file which use ".gitingore"'s rules.
"""
pfile = ""
try:
pfile = open(fileName, 'r')
except IOError:
return
for line in pfile:
line = line.strip()
if not line or line[0] == "#":
continue
#convert .gitingore regular expression to python's regular expression
line=line.replace('.', '\\.')
line=line.replace('*', '.*')
line="%s$" %line
if line[0] == "!":
self.inludeConfig.append(line[1:])
else:
self.excludeConfig.append(line)
pfile.close()
def parseFileList(self, rootDir):
self.rootDir = os.path.abspath(rootDir)
self.__parseFileList(rootDir)
def __parseFileList(self, folderdir):
"""
"""
for item in os.listdir(folderdir):
path = os.path.join(folderdir, item)
relativePath = path[len(self.rootDir)+1:len(path)]
relativePath = relativePath.replace('\\', '/')
if os.path.isdir(path):
if (
self.__bInclude("/%s" %relativePath) or
self.__bInclude("/%s/" %relativePath) or
self.__bInclude(item) or
self.__bInclude("%s/" %item)
):
self.fileList.append("%s/" %relativePath)
continue
if (
self.__bExclude("/%s" %relativePath) or
self.__bExclude("/%s/" %relativePath) or
self.__bExclude(item) or
self.__bExclude("%s/" %item)
):
continue
self.__parseFileList(path)
else:
if (
not self.__bInclude("/%s" %relativePath) and
not self.__bInclude(item)
):
if (
self.__bExclude("/%s" %relativePath) or
self.__bExclude(item)
):
continue
# print(relativePath)
self.fileList.append(relativePath)
def __bExclude(self, item):
bexclude = False
for index in range(len(self.excludeConfig)):
if re.match(self.excludeConfig[index], item):
bexclude = True
break
return bexclude
def __bInclude(self, item):
binclude = False
for index in range(len(self.inludeConfig)):
if re.match(self.inludeConfig[index], item):
binclude = True
break
return binclude
def writeFileList(self,fileName):
"""
Save content to file with json format.
"""
f = open(fileName,"w")
self.fileList.sort()
content = "[\n\"%s\"\n]" % ("\",\n\"".join(self.fileList))
f.write(content)
f.close()
return True
# ------------ main --------------
if __name__ == '__main__':
cocos_root =os.path.abspath(os.path.join(os.path.dirname(__file__), "..", ".."))
cocos_file_path =os.path.abspath(os.path.join(cocos_root, "templates", "cocos2dx_files.json"))
cocos_file_ingore =os.path.abspath(os.path.join(os.path.dirname(__file__), "config.gitingore"))
# print ("begin list files")
cocosObj = CocosFileList()
cocosObj.readIngoreFile(cocos_file_ingore)
cocosObj.parseFileList(cocos_root)
cocosObj.writeFileList(cocos_file_path)
# print ("had list files to cocos_file_list.json")