Skip to content

Commit b6a35b9

Browse files
author
WanderWang
committed
Merge pull request #1 from cocos2d/develop
Merge from trunk
2 parents ab9e45d + 19b986b commit b6a35b9

File tree

96 files changed

+4905
-8342
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

96 files changed

+4905
-8342
lines changed

AUTHORS.txt

+18-5
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ Chris @hannon235 added node.js api for box2d
2525

2626
Jason Aeschliman @jaeschliman fixed cc.Node setposition
2727

28-
Sun Zhuoshi(Intel) @sunzhuoshi engine loader fixed
28+
Zhuoshi Sun(Intel) @sunzhuoshi engine loader fixed
2929

3030
Alejandro Reyero @KaTXi fixed error message
3131

@@ -50,15 +50,14 @@ Ivo Wetzel(Zynga Germany) @BonsaiDen Fixes for Audio Support Detection,
5050
Texture Support in Particle System,
5151
and Performance improvements
5252

53-
5453
Mario Adrian @many20 Code review, multi touch improvements,
5554
ccbi bugs fixed
5655

5756
keisuke hata(Square) @Seasons7 Code review, bug fix
5857

5958
Marat Yakupov @moadib Various bug fixes
6059

61-
Wu Liang @akira-cn Touch location fix for designResolution
60+
Liang Wu @akira-cn Touch location fix for designResolution
6261

6362
Jimmy Sambuo @jsambuo AudioEngine improvements
6463

@@ -74,14 +73,28 @@ Szymon Piłkowski @ardcore CCTexture Bug fix
7473

7574
Tomasz Tunik @tomasztunik CCNode Memory leak fix
7675

77-
Lin Xuankang(Intel) @AndriyLin cc.WebAudioEngine implements
76+
Xuankang Lin(Intel) @AndriyLin cc.WebAudioEngine implements
7877

7978
Kang-Hao Lu(Opera/Oupeng) @kennyluck Optimize John Resig's inheritance pattern
8079
cc.clone improvements
8180

8281
Mark Henderson @MarkEHenderson Code review, LabelTTF and Scale9Sprite bug fix
8382

84-
06wj @06wj CCScheduler improvements
83+
Jing Wang @06wj CCScheduler improvements
84+
Js file loading image add
85+
cc.RectApplyAffineTransform improvements
86+
87+
Ze Wang @WanderWang Fix crash when BrowserTypes match nothing from navigator.userAgent
88+
LabelTTF improvements
89+
90+
Christian Schwartz @cschwartz SpriteFrame.initWithTextureFilename converted fix
91+
92+
XiaoJun Zheng @SmallAiTT _getResType error fix
93+
cc.ScrollView bug fix
94+
95+
Guozhu Cheng @bengol cc.SimpleAudioEngine bug fix
96+
97+
Jing Xiao @xbruce cc.SAXParser bug fix
8598

8699
Cocos2d-x and cocos2d-html5 can not grow so fast without the active community.
87100

CHANGELOG.txt

+32-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,33 @@
1+
Cocos2d-html5-v2.1.6 @ Sep.19, 2013
2+
* Improved Sprite, Node, LabelTTF class define from separated code to combined code for maintainability, now it is clean and clear
3+
* cc.Sprite and its subClasses's texture has been replaced from DOM element to cc.Texture2D on Canvas mode
4+
* Improved cc.Texture2d for direct using without pre-loading image resources, you don't need to wait resources loading when create a new scene or layers
5+
* Migrated CCBReader and GUI to Cocos2d-x 2.1.4
6+
* Improved update function of Action, and avoid using temporary object, it is good for GC and performance
7+
* Modified LabelTTF's rendering from direct drawing to pre-rendering for performance, 100% faster than before on mobile browser
8+
* Fixed APIs of HTML5 according to JSB for compatibility, e.g. cc.ParticleSystemQuad has merged into cc.ParticleSystem, please check it on upgrade guide v2.1.5 to v2.1.6(http://www.cocos2d-x.org/wiki/Upgrade_Guide_from_Cocos2d-html5_v215_to_v216)
9+
* Added Hiding url address bar for mobile browser, please check the template and hello world
10+
* Re-writed Canvas Mode of RenderTexture to adapt WebGL interface
11+
* Added frame event, collider and blend type supporting for Armature. Now Armature supports two tools:1.CocoStudio(windows,http://www.cocostudio.org),2.DragonBones v2.3(flash,http://dragonbones.github.io)
12+
* Set auto render mode default value to canvas in mobile browsers and WebGL in desktop browsers
13+
14+
* Bug fix:
15+
1. Fixed cc.Sprite's displayFrame returns wrong value on Canvas mode.
16+
2. Fixed cc.LabelBMFont is very slow when calling setString
17+
3. Fixed a bug of CCBReader that cc.ControlButton doesn't work when its controller is _jsControlled
18+
4. Fixed a bug of cc.TextureCache that the status of texture is wrong in callback
19+
5. Fixed a bug of cc.Scale9Sprite that its contentSize is wrong when call setCapInsets
20+
6. Fixed a bug of cc.TableView's that contentSize is wrong when change datasource
21+
7. Fixed a bug of cc.Sprite that its children also follow fliped when it was fliped
22+
8. Fixed cc.Node's nodeToWorldTransform returns wrong value on Canvas Mode
23+
9. Fixed a bug of cc.LayerColor that represent incorrect opacity passed into init method
24+
10. Stop listening and remove the event for HtmlImageElement object onload
25+
11. Fixed cc.ProgressTimer display wrong when its sprite was flipped
26+
27+
* Known Issues:
28+
1. Effect Advanced Lens3D doesn't work
29+
2. ClipNodeTest effects varies in different browsers
30+
131
Cocos2d-html5-v2.1.5 @ July.24, 2013
232
* Ported engine API to keep the same as Cocos2d-x v2.1.4 API
333
* Optimized John Resig's inheritance pattern (cc.Class.extend) with advanced property initialization.
@@ -8,7 +38,7 @@ Cocos2d-html5-v2.1.5 @ July.24, 2013
838
* Optimized performance for MoonWarriors and CocosDragonJS
939

1040
* Bug fix:
11-
1. Fixed cc.EditBox Dom Element position issue when EGLView is setted
41+
1. Fixed cc.EditBox Dom Element position issue when EGLView is set
1242
2. Fixed cc.EGLView adjustSize bug
1343
3. Fixed the bug of cc.ParticleBatchNode that it doesn't hide particles after particle life has expired when calling stopSystem()
1444
4. Fixed a bug that LabelTTF dimension behavior doesn't support height=0
@@ -17,6 +47,7 @@ Cocos2d-html5-v2.1.5 @ July.24, 2013
1747
* Known Issues:
1848
1. Effect Advanced Lens3D doesn't work
1949
2. ClipNodeTest effects varies in different browsers
50+
3. nodeToParentTransform in cc.Node returns wrong value on Canvas mode
2051

2152
Cocos2d-html5-v2.1.4 @ Jun.12, 2013
2253
* Added support for multiple resources loading. This mechanic is the same as cocos2d-x now

CocosDenshion/SimpleAudioEngine.js

+32
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,22 @@ cc.SimpleAudioEngine = cc.AudioEngine.extend(/** @lends cc.SimpleAudioEngine# */
158158
return this._soundSupported;
159159
},
160160

161+
/**
162+
* Preload music resource.
163+
* @param {String} path
164+
*/
165+
preloadMusic:function(path){
166+
this.preloadSound(path);
167+
},
168+
169+
/**
170+
* Preload effect resource.
171+
* @param {String} path
172+
*/
173+
preloadEffect:function(path){
174+
this.preloadSound(path);
175+
},
176+
161177
/**
162178
* Preload music resource.<br />
163179
* This method is called when cc.Loader preload resources.
@@ -766,6 +782,22 @@ cc.WebAudioEngine = cc.AudioEngine.extend(/** @lends cc.WebAudioEngine# */{
766782
req.send();
767783
},
768784

785+
/**
786+
* Preload music resource.
787+
* @param {String} path
788+
*/
789+
preloadMusic:function(path){
790+
this.preloadSound(path);
791+
},
792+
793+
/**
794+
* Preload effect resource.
795+
* @param {String} path
796+
*/
797+
preloadEffect:function(path){
798+
this.preloadSound(path);
799+
},
800+
769801
/**
770802
* Preload music resource.<br />
771803
* This method is called when cc.Loader preload resources.

HelloHTML5World/build.xml

+19-22
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@
9595
<file name="label_nodes/CCLabelBMFont.js"/>
9696
<file name="particle_nodes/CCParticleSystem.js"/>
9797
<file name="particle_nodes/CCParticleBatchNode.js"/>
98-
<file name="particle_nodes/CCParticleSystemQuad.js"/>
9998
<file name="particle_nodes/CCParticleExamples.js"/>
10099
<file name="touch_dispatcher/CCTouchDelegateProtocol.js"/>
101100
<file name="touch_dispatcher/CCTouchHandler.js"/>
@@ -158,27 +157,25 @@
158157
<file name="GUI/CCScrollView/CCScrollView.js"/>
159158
<file name="GUI/CCScrollView/CCTableView.js"/>
160159
<file name="CCEditBox.js"/>
161-
<file name="CCArmature/utils/CCArmatureDefine.js"/>
162-
<file name="CCArmature/utils/CCDataReaderHelper.js"/>
163-
<file name="CCArmature/utils/CCSpriteFrameCacheHelper.js"/>
164-
<file name="CCArmature/utils/CCTransformHelp.js"/>
165-
<file name="CCArmature/utils/CCTweenFunction.js"/>
166-
<file name="CCArmature/utils/CCUtilMath.js"/>
167-
<file name="CCArmature/utils/CSArmatureDataManager.js"/>
168-
<file name="CCArmature/datas/CCDatas.js"/>
169-
<file name="CCArmature/display/CCBatchNode.js"/>
170-
<file name="CCArmature/display/CCDecorativeDisplay.js"/>
171-
<file name="CCArmature/display/CCDisplayFactory.js"/>
172-
<file name="CCArmature/display/CCDisplayManager.js"/>
173-
<file name="CCArmature/display/CCShaderNode.js"/>
174-
<file name="CCArmature/display/CCSkin.js"/>
175-
<file name="CCArmature/animation/CCProcessBase.js"/>
176-
<file name="CCArmature/animation/CCArmatureAnimation.js"/>
177-
<file name="CCArmature/animation/CCTween.js"/>
178-
<file name="CCArmature/physics/CCColliderDetector.js"/>
179-
<file name="CCArmature/physics/CCPhysicsWorld.js"/>
180-
<file name="CCArmature/CCArmature.js"/>
181-
<file name="CCArmature/CCBone.js"/>
160+
<file name="CocoStudio/Armature/utils/CCArmatureDefine.js"/>
161+
<file name="CocoStudio/Armature/utils/CCDataReaderHelper.js"/>
162+
<file name="CocoStudio/Armature/utils/CCSpriteFrameCacheHelper.js"/>
163+
<file name="CocoStudio/Armature/utils/CCTransformHelp.js"/>
164+
<file name="CocoStudio/Armature/utils/CCTweenFunction.js"/>
165+
<file name="CocoStudio/Armature/utils/CCUtilMath.js"/>
166+
<file name="CocoStudio/Armature/utils/CSArmatureDataManager.js"/>
167+
<file name="CocoStudio/Armature/datas/CCDatas.js"/>
168+
<file name="CocoStudio/Armature/display/CCBatchNode.js"/>
169+
<file name="CocoStudio/Armature/display/CCDecorativeDisplay.js"/>
170+
<file name="CocoStudio/Armature/display/CCDisplayFactory.js"/>
171+
<file name="CocoStudio/Armature/display/CCDisplayManager.js"/>
172+
<file name="CocoStudio/Armature/display/CCSkin.js"/>
173+
<file name="CocoStudio/Armature/animation/CCProcessBase.js"/>
174+
<file name="CocoStudio/Armature/animation/CCArmatureAnimation.js"/>
175+
<file name="CocoStudio/Armature/animation/CCTween.js"/>
176+
<file name="CocoStudio/Armature/physics/CCColliderDetector.js"/>
177+
<file name="CocoStudio/Armature/CCArmature.js"/>
178+
<file name="CocoStudio/Armature/CCBone.js"/>
182179
</sources>
183180
<sources dir="${basedir}">
184181
<file name="src/resource.js"/>

HelloHTML5World/index.html

+6-7
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,12 @@
44
<meta charset="utf-8">
55
<title>Cocos2d-html5 Hello World test</title>
66
<link rel="icon" type="image/GIF" href="res/favicon.ico"/>
7-
<meta name="viewport" content="width=800,user-scalable=no"/>
8-
<meta name="screen-orientation" content="portrait"/>
7+
<meta name="viewport" content="width=800,target-densitydpi=device-dpi,user-scalable=no" />
98
<meta name="apple-mobile-web-app-capable" content="yes"/>
109
<meta name="full-screen" content="yes"/>
10+
<meta name="screen-orientation" content="portrait"/>
1111
<meta name="x5-fullscreen" content="true"/>
12+
<meta name="360-fullscreen" content="true"/>
1213
<style>
1314
body, canvas, div {
1415
-moz-user-select: none;
@@ -20,9 +21,7 @@
2021
</style>
2122
</head>
2223
<body style="padding:0; margin: 0; background: #000;">
23-
<div style="text-align: center;">
24-
<canvas id="gameCanvas" width="800" height="450"></canvas>
25-
</div>
24+
<canvas id="gameCanvas" width="800" height="450"></canvas>
25+
<script src="cocos2d.js"></script>
2626
</body>
27-
</html>
28-
<script src="cocos2d.js"></script>
27+
</html>

HelloHTML5World/main.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,7 @@ var cocos2dApp = cc.Application.extend({
4343
// initialize director
4444
var director = cc.Director.getInstance();
4545

46-
// enable High Resource Mode(2x, such as iphone4) and maintains low resource on other devices.
47-
//director.enableRetinaDisplay(true);
46+
cc.EGLView.getInstance().setDesignResolutionSize(800, 450, cc.RESOLUTION_POLICY.SHOW_ALL);
4847

4948
// turn on display FPS
5049
director.setDisplayStats(this.config['showFPS']);

cocos2d/CCDirector.js

+31-26
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
282282
* converts a UIKit coordinate to an OpenGL coordinate<br/>
283283
* Useful to convert (multi) touches coordinates to the current layout (portrait or landscape)
284284
* </p>
285-
* @param {cc.Point} point
285+
* @param {cc.Point} uiPoint
286286
* @return {cc.Point}
287287
*/
288288
convertToGL:function (uiPoint) {
@@ -326,31 +326,16 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
326326
/**
327327
* Draw the scene. This method is called every frame. Don't call it manually.
328328
*/
329-
drawScene:function () {
329+
drawScene: null,
330+
331+
_drawSceneForCanvas: function () {
330332
// calculate "global" dt
331333
this.calculateDeltaTime();
332334

333335
//tick before glClear: issue #533
334336
if (!this._paused)
335337
this._scheduler.update(this._deltaTime);
336338

337-
if (cc.renderContextType === cc.CANVAS)
338-
this._drawSceneForCanvas();
339-
else
340-
this._drawSceneForWebGL();
341-
342-
this._totalFrames++;
343-
344-
// swap buffers
345-
/* if (this._openGLView) {
346-
this._openGLView.swapBuffers();
347-
}*/
348-
349-
if (this._displayStats)
350-
this._calculateMPF();
351-
},
352-
353-
_drawSceneForCanvas:function () {
354339
cc.renderContext.clearRect(0, 0, cc.canvas.width, -cc.canvas.height);
355340

356341
/* to avoid flickr, nextScene MUST be here: after tick and before draw.
@@ -368,9 +353,21 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
368353

369354
if (this._displayStats)
370355
this._showStats();
356+
357+
this._totalFrames++;
358+
359+
if (this._displayStats)
360+
this._calculateMPF();
371361
},
372362

373-
_drawSceneForWebGL:function () {
363+
_drawSceneForWebGL: function () {
364+
// calculate "global" dt
365+
this.calculateDeltaTime();
366+
367+
//tick before glClear: issue #533
368+
if (!this._paused)
369+
this._scheduler.update(this._deltaTime);
370+
374371
var gl = cc.renderContext;
375372
gl.clear(gl.COLOR_BUFFER_BIT | gl.DEPTH_BUFFER_BIT);
376373

@@ -393,6 +390,11 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
393390
this._showStats();
394391

395392
cc.kmGLPopMatrix();
393+
394+
this._totalFrames++;
395+
396+
if (this._displayStats)
397+
this._calculateMPF();
396398
},
397399

398400
/**
@@ -1089,12 +1091,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
10891091
this._mouseDispatcher = mouseDispatcher;
10901092
},
10911093

1092-
_createStatsLabel:function () {
1093-
if(cc.renderContextType === cc.CANVAS)
1094-
this._createStatsLabelForCanvas();
1095-
else
1096-
this._createStatsLabelForWebGL();
1097-
},
1094+
_createStatsLabel: null,
10981095

10991096
_createStatsLabelForWebGL:function(){
11001097
if((cc.Director._fpsImageLoaded == null) || (cc.Director._fpsImageLoaded == false))
@@ -1171,6 +1168,14 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
11711168
}
11721169
});
11731170

1171+
if (cc.Browser.supportWebGL) {
1172+
cc.Director.prototype.drawScene = cc.Director.prototype._drawSceneForWebGL;
1173+
cc.Director.prototype._createStatsLabel = cc.Director.prototype._createStatsLabelForWebGL;
1174+
} else {
1175+
cc.Director.prototype.drawScene = cc.Director.prototype._drawSceneForCanvas;
1176+
cc.Director.prototype._createStatsLabel = cc.Director.prototype._createStatsLabelForCanvas;
1177+
}
1178+
11741179
/***************************************************
11751180
* implementation of DisplayLinkDirector
11761181
**************************************************/

0 commit comments

Comments
 (0)