Skip to content

Commit db855b7

Browse files
author
James Chen
committed
Merge pull request #7 from dumganhar/master
Adds travis-ci support and some fixes.
2 parents 60c9a7a + d151974 commit db855b7

16 files changed

+1206
-3
lines changed

.travis.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
language: cpp
2+
script:
3+
- export PYTHON_BIN=/usr/bin/python
4+
- ./tools/travis-scripts/run-script.sh
5+
before_install:
6+
- ./tools/travis-scripts/before-install.sh
7+
env:
8+
matrix:
9+
- GEN_BINDINGS=YES
10+
- PLATFORM=android
11+
global:
12+
- secure: FlC71LfwoBQ0mvJnxLdScFunhWKTvpQhbheLneWBbEFYpRFiMBwBbkZ9CIgYwzVQA7Zf7smhPXJMWuch0R9332uc7H7WDx6l7iOW0tVxwCHP2BSkfIFXU433AQeS4/5OgZU8bJDUOoJKqNC0EpkQ+6elhuAnR4MP/KGx6mKtGU0=
13+
- secure: jZyWJln6/IQ0p0iSSsZOpifEZaW+M4tdaYiJt6Q+CL6GanJd9F2nP0tJdEGBOx2KKGWcyY0KKibO2xg6CBZnsmGxjU4G2QDIcQBtUFq+iKwkLIQ31jMqEGV6zPJVLMMNUfoOAKMppCgukyoPy7ugThuReHMAbjyy4AkKKjx4o9Q=
14+
- secure: gdYnnweKE19bzSrd728t21tIWeNIVhChd58WtIuA6SbJg5WsGScyFXtaA3NxmcGaAjIU9GC3zGfxH1upWMinypO3W+XUsZtRmOvIkPMDQjdPA9wNu4ekKNsytUjIcuG2T5+m0dZbHCtLcMELekZ5aazNgsk1F20xpbSSnVr2u5E=
15+
branches:
16+
only:
17+
- master
18+
- develop

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
1+
<img src="http://www.cocos2d-x.org/attachments/801/cocos2dx_portrait.png" width=200>
2+
13
cocos2d-js
2-
==========
4+
===========
35

4-
cocos2d-x JS
6+
[![Build Status](https://travis-ci.org/cocos2d/cocos2d-js.png?branch=master)](https://travis-ci.org/cocos2d/cocos2d-js)

jsb/tests-project/proj.win32/TestJavascript.vcxproj

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,30 @@ xcopy "$(ProjectDir)..\..\..\tests" "$(OutDir)\TestJavascriptRes\" /e /Y</Comman
188188
<ResourceCompile Include="testjs.rc" />
189189
</ItemGroup>
190190
<ItemGroup>
191+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForBuilder.vcxproj">
192+
<Project>{f9da0fc1-651b-457b-962e-a4d61cebf5fd}</Project>
193+
</ProjectReference>
194+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForChipmunk.vcxproj">
195+
<Project>{21070e58-eec6-4e16-8b4f-6d083df55790}</Project>
196+
</ProjectReference>
197+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForExtension.vcxproj">
198+
<Project>{625f7391-9a91-48a1-8cfc-79508c822637}</Project>
199+
</ProjectReference>
200+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForGui.vcxproj">
201+
<Project>{9a844c88-97e8-4e2d-b09a-e138c67d338b}</Project>
202+
</ProjectReference>
203+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForLocalStorage.vcxproj">
204+
<Project>{68f5f371-bd7b-4c30-ae5b-0b08f22e0cde}</Project>
205+
</ProjectReference>
206+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForNetwork.vcxproj">
207+
<Project>{3bec13f5-e227-4d80-bc77-1c857f83bcfc}</Project>
208+
</ProjectReference>
209+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForSpine.vcxproj">
210+
<Project>{e78cdc6b-f37d-48d2-ad91-1db549497e32}</Project>
211+
</ProjectReference>
212+
<ProjectReference Include="..\..\bindings\proj.win32\libJSBindingForStudio.vcxproj">
213+
<Project>{79d34511-e54e-410a-8bba-ef175ad6c695}</Project>
214+
</ProjectReference>
191215
<ProjectReference Include="..\..\cocos2d-x\cocos\2d\cocos2d.vcxproj">
192216
<Project>{98a51ba8-fc3a-415b-ac8f-8c7bd464e93e}</Project>
193217
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>

tools/bindings-generator

Submodule bindings-generator updated 64 files

tools/tojs/README.mdown

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
How to Use bindings-generator
2+
==================
3+
4+
On Windows:
5+
------------
6+
7+
* Make sure that you have installed `android-ndk-r9b`.
8+
* Download python2.7.3 (32bit) from (http://www.python.org/ftp/python/2.7.3/python-2.7.3.msi).
9+
* Add the installed path of python (e.g. C:\Python27) to windows environment variable named 'PATH'.
10+
* Download pyyaml from http://pyyaml.org/download/pyyaml/PyYAML-3.10.win32-py2.7.exe and install it.
11+
* Download pyCheetah from https://raw.github.com/dumganhar/cocos2d-x/download/downloads/Cheetah.zip, unzip it to "C:\Python27\Lib\site-packages"
12+
* Set environment variables (`NDK_ROOT`)
13+
* Go to "cocos2d-x/tools/tojs" folder, and run "genbindings.py". The generated codes will be under "cocos\scripting\auto-generated\js-bindings".
14+
15+
16+
On MAC:
17+
----------
18+
19+
* The OSX 10.9 has a built-in python2.7 and if your os don't have python2.7 then use [Homebrew](http://brew.sh/) to install the python and use pip install the python dependencies.
20+
<pre>
21+
brew install python
22+
</pre>
23+
24+
* Install python dependices by pip.
25+
<pre>
26+
sudo easy_install pip
27+
sudo pip install PyYAML
28+
sudo pip install Cheetah
29+
</pre>
30+
31+
* Download [64bit ndk-r9b-x86_64](http://dl.google.com/android/ndk/android-ndk-r9b-darwin-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
32+
* Run
33+
<pre>
34+
export NDK_ROOT=/path/to/android-ndk-r9b
35+
./genbindings.py
36+
</pre>
37+
38+
39+
On Ubuntu Linux 12.04 64bit
40+
------------
41+
42+
* Install python
43+
<pre>
44+
sudo apt-get install python2.7
45+
</pre>
46+
* Install python dependices by pip.
47+
<pre>
48+
sudo apt-get install python-pip
49+
sudo pip install PyYAML
50+
sudo pip install Cheetah
51+
</pre>
52+
* Download [64bit ndk-r9b-x86_64]( https://dl.google.com/android/ndk/android-ndk-r9b-linux-x86_64.tar.bz2) from [google](http://developer.android.com/tools/sdk/ndk/index.html)
53+
* Go to "cocos2d-x/tools/tojs", Run
54+
<pre>
55+
export NDK_ROOT=/path/to/android-ndk-r9b
56+
./genbindings.py
57+
</pre>

tools/tojs/cocos2dx.ini

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
[cocos2d-x]
2+
# the prefix to be added to the generated functions. You might or might not use this in your own
3+
# templates
4+
prefix = cocos2dx
5+
6+
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
7+
# all classes will be embedded in that namespace
8+
target_namespace = cc
9+
10+
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
11+
android_flags = -D_SIZE_T_DEFINED_
12+
13+
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
14+
clang_flags = -nostdinc -x c++ -std=c++11
15+
16+
cocos_headers = -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath/include
17+
cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT
18+
19+
cxxgenerator_headers =
20+
21+
# extra arguments for clang
22+
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
23+
24+
# what headers to parse
25+
headers = %(cocosdir)s/cocos/2d/cocos2d.h %(cocosdir)s/cocos/audio/include/SimpleAudioEngine.h
26+
27+
# what classes to produce code for. You can use regular expressions here. When testing the regular
28+
# expression, it will be enclosed in "^$", like this: "^Menu*$".
29+
classes = New.* Sprite.* Scene Node.* Director Layer.* Menu.* Touch .*Action.* Move.* Rotate.* Blink.* Tint.* Sequence Repeat.* Fade.* Ease.* Scale.* Transition.* Spawn Animat.* Flip.* Delay.* Skew.* Jump.* Place.* Show.* Progress.* PointArray ToggleVisibility.* RemoveSelf Hide Particle.* Label.* Atlas.* TextureCache.* Texture2D Cardinal.* CatmullRom.* ParallaxNode TileMap.* TMX.* CallFunc RenderTexture GridAction Grid3DAction GridBase$ .+Grid Shaky3D Waves3D FlipX3D FlipY3D Speed ActionManager Set SimpleAudioEngine Scheduler Orbit.* Follow.* Bezier.* CardinalSpline.* Camera.* DrawNode .*3D$ Liquid$ Waves$ ShuffleTiles$ TurnOffTiles$ Split.* Twirl$ FileUtils$ GLProgram ShaderCache Application ClippingNode MotionStreak TextFieldTTF GLViewProtocol GLView Component __NodeRGBA __LayerRGBA SAXParser
30+
31+
32+
classes_need_extend = Node Layer.* Sprite MenuItemFont Scene DrawNode
33+
34+
# what should we skip? in the format ClassName::[function function]
35+
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
36+
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
37+
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
38+
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
39+
# functions from all classes.
40+
41+
skip = Node::[^setPosition$ setGLServerState description getUserObject .*UserData getGLServerState .*schedule setContentSize setAnchorPoint],
42+
Sprite::[getQuad getBlendFunc ^setPosition$ setBlendFunc],
43+
NodeGrid::[setGrid],
44+
SpriteBatchNode::[getBlendFunc setBlendFunc getDescendants],
45+
MotionStreak::[getBlendFunc setBlendFunc draw update],
46+
AtlasNode::[getBlendFunc setBlendFunc],
47+
ParticleBatchNode::[getBlendFunc setBlendFunc],
48+
LayerColor::[getBlendFunc setBlendFunc],
49+
ParticleSystem::[getBlendFunc setBlendFunc],
50+
DrawNode::[getBlendFunc setBlendFunc drawPolygon listenBackToForeground],
51+
Director::[getAccelerometer (g|s)et.*Dispatcher getOpenGLView getProjection getFrustum getRenderer getConsole],
52+
Layer.*::[didAccelerate (g|s)etBlendFunc keyPressed keyReleased],
53+
Menu.*::[.*Target getSubItems create initWithItems alignItemsInRows alignItemsInColumns],
54+
MenuItem.*::[create setCallback initWithCallback],
55+
Copying::[*],
56+
LabelProtocol::[*],
57+
LabelTextFormatProtocol::[*],
58+
Label::[getLettersInfo createWithTTF setTTFConfig getFontAtlas],
59+
.*Delegate::[*],
60+
PoolManager::[*],
61+
Texture2D::[initWithPVRTCData addPVRTCImage releaseData setTexParameters initWithData keepData getPixelFormatInfoMap],
62+
Set::[begin end acceptVisitor],
63+
IMEDispatcher::[*],
64+
Thread::[*],
65+
Profiler::[*],
66+
ProfilingTimer::[*],
67+
CallFunc::[create initWithFunction (g|s)etTargetCallback],
68+
SAXParser::[(?!(init))],
69+
SAXDelegator::[*],
70+
Color3bObject::[*],
71+
TouchDispatcher::[*],
72+
EGLTouchDelegate::[*],
73+
ScriptEngineManager::[*],
74+
KeypadHandler::[*],
75+
Invocation::[*],
76+
GLView::[end swapBuffers],
77+
GLViewProtocol::[(?!setDesignResolutionSize|getVisibleSize|getVisibleOrigin)],
78+
SchedulerScriptHandlerEntry::[*],
79+
Size::[*],
80+
Point::[*],
81+
PointArray::[*],
82+
Rect::[*],
83+
String::[*],
84+
Data::[*],
85+
Dictionary::[*],
86+
Array::[*],
87+
Range::[*],
88+
NotificationObserver::[*],
89+
Image::[initWithString initWithImageData],
90+
Sequence::[create],
91+
Spawn::[create],
92+
Animation::[create],
93+
GLProgram::[getProgram setUniformLocationWith2f.* setUniformLocationWith1f.* setUniformLocationWith3f.* setUniformLocationWith4f.*],
94+
Grid3DAction::[create actionWith.* vertex originalVertex (g|s)etVertex getOriginalVertex],
95+
Grid3D::[vertex originalVertex (g|s)etVertex getOriginalVertex],
96+
TiledGrid3DAction::[create actionWith.* tile originalTile getOriginalTile (g|s)etTile],
97+
TiledGrid3D::[tile originalTile getOriginalTile (g|s)etTile],
98+
TMXLayer::[getTiles],
99+
TMXMapInfo::[startElement endElement textHandler],
100+
ParticleSystemQuad::[postStep setBatchNode draw setTexture$ setTotalParticles updateQuadWithParticle setupIndices listenBackToForeground initWithTotalParticles particleWithFile node],
101+
LayerMultiplex::[create layerWith.* initWithLayers],
102+
CatmullRom.*::[create actionWithDuration],
103+
Bezier.*::[create actionWithDuration],
104+
CardinalSpline.*::[create actionWithDuration setPoints],
105+
Scheduler::[pause resume unschedule schedule update isTargetPaused],
106+
TextureCache::[addPVRTCImage addImageAsync],
107+
*::[copyWith.* onEnter.* onExit.* ^description$ getObjectType onTouch.* onAcc.* onKey.* onRegisterTouchListener],
108+
FileUtils::[(g|s)etSearchResolutionsOrder$ (g|s)etSearchPaths$ getFileData getDataFromFile getWritablePath setPopupNotify destroyInstance getFullPathCache],
109+
Application::[^application.* ^run$],
110+
Camera::[getEyeXYZ getCenterXYZ getUpXYZ],
111+
ccFontDefinition::[*],
112+
NewTextureAtlas::[*],
113+
RenderTexture::[listenToBackground listenToForeground],
114+
TextFieldTTF::[(g|s)etDelegate]
115+
116+
rename_functions = SpriteFrameCache::[addSpriteFramesWithFile=addSpriteFrames getSpriteFrameByName=getSpriteFrame],
117+
MenuItemFont::[setFontNameObj=setFontName setFontSizeObj=setFontSize getFontSizeObj=getFontSize getFontNameObj=getFontName],
118+
ProgressTimer::[setReverseProgress=setReverseDirection],
119+
AnimationCache::[addAnimationsWithFile=addAnimations],
120+
LayerGradient::[initWithColor=init],
121+
LayerColor::[initWithColor=init],
122+
GLProgram::[initWithVertexShaderByteArray=initWithString initWithVertexShaderFilename=init programLog=getProgramLog setUniformLocationWith1i=setUniformLocationI32],
123+
Node::[removeFromParentAndCleanup=removeFromParent removeAllChildrenWithCleanup=removeAllChildren getLocalZOrder=getZOrder setLocalZOrder=setZOrder],
124+
LabelAtlas::[create=_create],
125+
Sprite::[initWithFile=init],
126+
SpriteBatchNode::[initWithFile=init removeAllChildrenWithCleanup=removeAllChildren],
127+
Touch::[getID=getId],
128+
SimpleAudioEngine::[preloadBackgroundMusic=preloadMusic setBackgroundMusicVolume=setMusicVolume getBackgroundMusicVolume=getMusicVolume playBackgroundMusic=playMusic stopBackgroundMusic=stopMusic pauseBackgroundMusic=pauseMusic resumeBackgroundMusic=resumeMusic rewindBackgroundMusic=rewindMusic isBackgroundMusicPlaying=isMusicPlaying willPlayBackgroundMusic=willPlayMusic],
129+
FileUtils::[loadFilenameLookupDictionaryFromFile=loadFilenameLookup]
130+
131+
rename_classes = ParticleSystemQuad::ParticleSystem,
132+
SimpleAudioEngine::AudioEngine,
133+
__NodeRGBA::NodeRGBA,
134+
__LayerRGBA::LayerRGBA
135+
136+
# for all class names, should we remove something when registering in the target VM?
137+
remove_prefix =
138+
139+
# classes for which there will be no "parent" lookup
140+
classes_have_no_parents = Node Director SimpleAudioEngine FileUtils TMXMapInfo Application GLViewProtocol SAXParser
141+
142+
# base classes which will be skipped when their sub-classes found them.
143+
base_classes_to_skip = Ref Clonable
144+
145+
# classes that create no constructor
146+
# Set is special and we will use a hand-written constructor
147+
abstract_classes = Action FiniteTimeAction ActionInterval ActionEase EaseRateAction EaseElastic EaseBounce ActionInstant GridAction Grid3DAction TiledGrid3DAction Director SpriteFrameCache TransitionEaseScene Set SimpleAudioEngine FileUtils Application ClippingNode Label GLViewProtocol GLView Component SAXParser
148+
149+
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
150+
script_control_cpp = no
151+

tools/tojs/cocos2dx_builder.ini

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
[cocos2dx_builder]
2+
# the prefix to be added to the generated functions. You might or might not use this in your own
3+
# templates
4+
prefix = cocos2dx_builder
5+
6+
# create a target namespace (in javascript, this would create some code like the equiv. to `ns = ns || {}`)
7+
# all classes will be embedded in that namespace
8+
target_namespace = cc
9+
10+
android_headers = -I%(androidndkdir)s/platforms/android-14/arch-arm/usr/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/libs/armeabi-v7a/include -I%(androidndkdir)s/sources/cxx-stl/gnu-libstdc++/4.7/include
11+
android_flags = -D_SIZE_T_DEFINED_
12+
13+
clang_headers = -I%(clangllvmdir)s/lib/clang/3.3/include
14+
clang_flags = -nostdinc -x c++ -std=c++11
15+
16+
cocos_headers = -I%(cocosdir)s/cocos/2d -I%(cocosdir)s/cocos/base -I%(cocosdir)s/cocos/gui -I%(cocosdir)s/cocos/physics -I%(cocosdir)s/cocos/2d/platform -I%(cocosdir)s/cocos/2d/platform/android -I%(cocosdir)s/cocos/math/kazmath/include -I%(cocosdir)s/extensions -I%(cocosdir)s/external -I%(cocosdir)s/cocos/editor-support -I%(cocosdir)s
17+
18+
cocos_flags = -DANDROID -DCOCOS2D_JAVASCRIPT
19+
20+
cxxgenerator_headers =
21+
22+
# extra arguments for clang
23+
extra_arguments = %(android_headers)s %(clang_headers)s %(cxxgenerator_headers)s %(cocos_headers)s %(android_flags)s %(clang_flags)s %(cocos_flags)s %(extra_flags)s
24+
25+
# what headers to parse
26+
headers = %(cocosdir)s/cocos/editor-support/cocosbuilder/CocosBuilder.h
27+
28+
# what classes to produce code for. You can use regular expressions here. When testing the regular
29+
# expression, it will be enclosed in "^$", like this: "^Menu*$".
30+
classes = CCBReader.* CCBAnimationManager.*
31+
32+
# what should we skip? in the format ClassName::[function function]
33+
# ClassName is a regular expression, but will be used like this: "^ClassName$" functions are also
34+
# regular expressions, they will not be surrounded by "^$". If you want to skip a whole class, just
35+
# add a single "*" as functions. See bellow for several examples. A special class name is "*", which
36+
# will apply to all class names. This is a convenience wildcard to be able to skip similar named
37+
# functions from all classes.
38+
39+
skip = CCBReader::[^CCBReader$ addOwnerCallbackName isJSControlled readByte getCCBMemberVariableAssigner readFloat getCCBSelectorResolver toLowerCase lastPathComponent deletePathExtension endsWith concat getResolutionScale getAnimatedProperties readBool readInt addOwnerCallbackNode addDocumentCallbackName readCachedString readNodeGraphFromData addDocumentCallbackNode getLoadedSpriteSheet initWithData readFileWithCleanUp getOwner$ readNodeGraphFromFile createSceneWithNodeGraphFromFile getAnimationManagers$ setAnimationManagers],
40+
CCBAnimationManager::[setAnimationCompletedCallback addNode getSequences getDelegate],
41+
.*Delegate::[*],
42+
.*Loader.*::[*],
43+
*::[^visit$ copyWith.* onEnter.* onExit.* ^description$ getObjectType .*HSV onTouch.* onAcc.* onKey.* onRegisterTouchListener]
44+
45+
rename_functions =
46+
47+
rename_classes = CCBReader::_Reader,
48+
CCBAnimationManager::BuilderAnimationManager
49+
50+
# for all class names, should we remove something when registering in the target VM?
51+
remove_prefix =
52+
53+
# classes for which there will be no "parent" lookup
54+
classes_have_no_parents =
55+
56+
# base classes which will be skipped when their sub-classes found them.
57+
base_classes_to_skip = Ref
58+
59+
# classes that create no constructor
60+
# Set is special and we will use a hand-written constructor
61+
abstract_classes =
62+
63+
# Determining whether to use script object(js object) to control the lifecycle of native(cpp) object or the other way around. Supported values are 'yes' or 'no'.
64+
script_control_cpp = no
65+

0 commit comments

Comments
 (0)