Skip to content

Commit 7572b2b

Browse files
committed
Merge branch 'develop' of https://github.com/cocos2d/cocos2d-html5 into Iss2280_FixVideoMomeryBug
2 parents ada74f8 + f667cfd commit 7572b2b

File tree

6 files changed

+50
-27
lines changed

6 files changed

+50
-27
lines changed

CHANGELOG.txt

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
Cocos2d-html5-v2.1.4 @ Jun.12, 2013
2-
* Added support for Multi resources loading
3-
* Performance optimization for sprite performance tests 220%
4-
* Sync audio api to JSB
5-
* Added auto test for NodeTests
6-
* Changed textureKeyName to full path when removeTextureForKey
2+
* Added support for multiple resources loading. This mechanic is the same as cocos2d-x now
3+
* Optimised "Performance Tests -> Sprites Test", and increased its benchmark to 220%!
4+
* Migrated audio (CocosDenshion) API to keep the same as Cocos2d JS API
5+
* Added auto test for NodeTests and TilemapTests
6+
* Changed CCTextureCache member functions such as addImage(path), addImageAysnc(path), removeTextureForKey(key) from using relative path to absolute path
77
* Added support for particle batch node
88

9-
*Bug fix:
10-
1. PreLoading on iOS5.1.1
11-
2. cc.Menu / cc.MenuItemImage remain touchable after replaceScene
12-
3. Box2d and chipmunk path error for single file mode
13-
4. cc.EditBox that position of Dom Element is wrong when cc.EditBox skewed
14-
5. cc.ScrollView position is wrong when it's parent node moved
15-
6. cc.TouchDispatcher can't touch when WebPage has been scrolled on Firefox and IE
9+
* Bug fix:
10+
1. Fixed preLoading issue on iOS 5.1.1
11+
2. Fixed cc.Menu / cc.MenuItemImage remaining touchable issue after replaceScene
12+
3. Fixed Box2d and chipmunk path error for single engine file mode
13+
4. Fixed cc.EditBox Dom Element position issue when cc.EditBox skewed
14+
5. Fixed cc.ScrollView position issue when it's parent node moved
15+
6. Fixed cc.TouchDispatcher can't touch issue when WebPage has been scrolled on Firefox or IE
1616
* Known Issues:
1717
1. Effect Advanced Lens3D doesn't work
1818
2. ClipNodeTest effects varies in different browsers
@@ -27,7 +27,7 @@ Cocos2d-html5-v2.1.3 @ May.1, 2013
2727
* EGLView now works if canvas is placed inside another DOM element
2828
* Added a Simulator which can be found in MoonWarriors Directory
2929

30-
*Bug fix:
30+
* Bug fix:
3131
1. Preloading on some mobile browsers
3232
2. CCLoader for WebGL
3333
3. ccNode memory leak

cocos2d/CCDirector.js

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,10 +592,15 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
592592
cc.Assert(scene != null, "the scene should not be null");
593593

594594
var i = this._scenesStack.length;
595-
596-
this._sendCleanupToScene = true;
597-
this._scenesStack[i - 1] = scene;
598-
this._nextScene = scene;
595+
if(i === 0){
596+
this._sendCleanupToScene = true;
597+
this._scenesStack[i] = scene;
598+
this._nextScene = scene;
599+
} else {
600+
this._sendCleanupToScene = true;
601+
this._scenesStack[i - 1] = scene;
602+
this._nextScene = scene;
603+
}
599604
},
600605

601606
/**

cocos2d/label_nodes/CCLabelTTF.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -757,6 +757,13 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
757757
_updateTexture:function () {
758758
this._labelContext = this._getLabelContext();
759759

760+
if(this._string.length === 0){
761+
this._labelCanvas.width = 1;
762+
this._labelCanvas.height = this._contentSize.height;
763+
this.setTextureRect(cc.rect(0, 0, 1, this._contentSize.height));
764+
return true;
765+
}
766+
760767
//set size for labelCanvas
761768
this._labelContext.font = this._fontStyleStr;
762769
this._updateTTF();
@@ -774,7 +781,7 @@ cc.LabelTTFWebGL = cc.Sprite.extend(/** @lends cc.LabelTTFWebGL# */{
774781

775782
_needUpdateTexture:false,
776783
visit:function(){
777-
if(this._needUpdateTexture && this._string.length > 0){
784+
if(this._needUpdateTexture ){
778785
this._needUpdateTexture = false;
779786
this._updateTexture();
780787
}

cocos2d/particle_nodes/CCParticleSystem.js

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,7 +1404,6 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
14041404
this.setTexture(canvasObj);
14051405
else
14061406
this.setTexture(addTexture);
1407-
14081407
}
14091408
}
14101409

@@ -1477,11 +1476,20 @@ cc.ParticleSystem = cc.Node.extend(/** @lends cc.ParticleSystem# */{
14771476
* Add a particle to the emitter
14781477
* @return {Boolean}
14791478
*/
1480-
addParticle:function () {
1479+
addParticle: function () {
14811480
if (this.isFull())
14821481
return false;
1483-
1484-
var particle =this._particles[this._particleCount];
1482+
var particle, particles = this._particles;
1483+
if (cc.renderContextType === cc.CANVAS) {
1484+
if (this._particleCount < particles.length) {
1485+
particle = particles[this._particleCount];
1486+
} else {
1487+
particle = new cc.Particle();
1488+
particles.push(particle);
1489+
}
1490+
} else {
1491+
particle = particles[this._particleCount];
1492+
}
14851493
this.initParticle(particle);
14861494
++this._particleCount;
14871495
return true;

cocos2d/sprite_nodes/CCSprite.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2114,7 +2114,6 @@ cc.SpriteWebGL = cc.Node.extend(/** @lends cc.SpriteWebGL# */{
21142114
this._quad.tl.colors = new cc.Color4B(255, 255, 255, 255);
21152115
this._quad.tr.colors = new cc.Color4B(255, 255, 255, 255);
21162116
this._quadDirty = true;
2117-
this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));
21182117

21192118
// updated in "useSelfRender"
21202119
// Atlas: TexCoords
@@ -2517,6 +2516,11 @@ cc.SpriteWebGL = cc.Node.extend(/** @lends cc.SpriteWebGL# */{
25172516
// If batchnode, then texture id should be the same
25182517
cc.Assert(!this._batchNode, "cc.Sprite: Batched sprites should use the same texture as the batchnode");
25192518

2519+
if(texture)
2520+
this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_TEXTURECOLOR));
2521+
else
2522+
this.setShaderProgram(cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_COLOR));
2523+
25202524
if (!this._batchNode && this._texture != texture) {
25212525
this._texture = texture;
25222526
this._updateBlendFunc();
@@ -2647,9 +2651,8 @@ cc.SpriteWebGL = cc.Node.extend(/** @lends cc.SpriteWebGL# */{
26472651
gl.drawArrays(gl.TRIANGLE_STRIP, 0, 4);
26482652
}
26492653
} else {
2650-
var shaderProgram = cc.ShaderCache.getInstance().programForKey(cc.SHADER_POSITION_COLOR);
2651-
shaderProgram.use();
2652-
shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4();
2654+
this._shaderProgram.use();
2655+
this._shaderProgram.setUniformForModelViewAndProjectionMatrixWithMat4();
26532656

26542657
cc.glBlendFunc(this._blendFunc.src, this._blendFunc.dst);
26552658
cc.glBindTexture2D(null);

0 commit comments

Comments
 (0)