Skip to content

Commit ae8fff2

Browse files
author
SeanLin
committed
Merge pull request cocos2d#488 from ricardoquesada/api_fixes
API fixes
2 parents 6df4d92 + 1375a3b commit ae8fff2

Some content is hidden

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

55 files changed

+551
-540
lines changed

HelloHTML5World/src/myApp.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ var CircleSprite = cc.Sprite.extend({
3939
},
4040
myUpdate:function (dt) {
4141
this._radians -= 6;
42-
//this._addDirtyRegionToDirector(this.boundingBoxToWorld());
42+
//this._addDirtyRegionToDirector(this.getBoundingBoxToWorld());
4343
}
4444
});
4545

cocos2d/CCDirector.js

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
230230

231231
//purge?
232232
this._purgeDirecotorInNextLoop = false;
233-
this._winSizeInPixels = this._winSizeInPoints = cc.SizeMake(cc.canvas.width, cc.canvas.height);
233+
this._winSizeInPixels = this._winSizeInPoints = cc.size(cc.canvas.width, cc.canvas.height);
234234

235235
this._openGLView = null;
236236
this._contentScaleFactor = 1.0;
@@ -322,7 +322,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
322322
if (!this._paused) {
323323
this._scheduler.update(this._deltaTime);
324324
}
325-
//this._fullRect = new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height);
325+
//this._fullRect = cc.rect(0, 0, cc.canvas.width, cc.canvas.height);
326326
//cc.renderContext.clearRect(this._fullRect.origin.x, this._fullRect.origin.y, this._fullRect.size.width, -this._fullRect.size.height);
327327
cc.renderContext.clearRect(0, 0, cc.canvas.width, -cc.canvas.height);
328328

@@ -333,7 +333,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
333333
if (this._dirtyRegion) {
334334
//cc.renderContext.clearRect(0, 0, cc.canvas.width, -cc.canvas.height);
335335
336-
var fullRect = new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height);
336+
var fullRect = cc.rect(0, 0, cc.canvas.width, cc.canvas.height);
337337
this._dirtyRegion = cc.Rect.CCRectIntersection(this._dirtyRegion, fullRect);
338338
339339
if(cc.Rect.CCRectEqualToRect(cc.RectZero(), this._dirtyRegion)){
@@ -412,11 +412,11 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
412412
return;
413413

414414
if (!this._dirtyRegion) {
415-
this._dirtyRegion = new cc.Rect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
415+
this._dirtyRegion = cc.rect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height);
416416
return;
417417
}
418418
this._dirtyRegion = cc.Rect.CCRectUnion(this._dirtyRegion,
419-
new cc.Rect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height));
419+
cc.rect(rect.origin.x, rect.origin.y, rect.size.width, rect.size.height));
420420
},
421421

422422
rectIsInDirtyRegion:function (rect) {
@@ -547,7 +547,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
547547
popScene:function () {
548548
cc.Assert(this._runningScene != null, "running scene should not null");
549549

550-
//this.addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
550+
//this.addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
551551

552552
this._scenesStack.pop();
553553
var c = this._scenesStack.length;
@@ -627,7 +627,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
627627
pushScene:function (scene) {
628628
cc.Assert(scene, "the scene should not null");
629629

630-
//this.addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
630+
//this.addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
631631

632632
this._sendCleanupToScene = false;
633633

@@ -642,7 +642,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
642642
replaceScene:function (scene) {
643643
cc.Assert(scene != null, "the scene should not be null");
644644

645-
//this.addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
645+
//this.addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
646646
var i = this._scenesStack.length;
647647

648648
this._sendCleanupToScene = true;
@@ -657,7 +657,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
657657
reshapeProjection:function (newWindowSize) {
658658
if(this._openGLView){
659659
this._winSizeInPoints = this._openGLView.getSize();
660-
this._winSizeInPixels = cc.SizeMake(this._winSizeInPoints.width * this._contentScaleFactor,
660+
this._winSizeInPixels = cc.size(this._winSizeInPoints.width * this._contentScaleFactor,
661661
this._winSizeInPoints.height * this._contentScaleFactor);
662662

663663
this.setProjection(this._projection);
@@ -671,7 +671,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
671671
if (!this._paused) {
672672
return;
673673
}
674-
//this.addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
674+
//this.addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
675675

676676
this.setAnimationInterval(this._oldAnimationInterval);
677677
this._lastUpdate = cc.Time.gettimeofdayCocos2d();
@@ -695,7 +695,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
695695
cc.Assert(scene != null, "running scene should not be null");
696696
cc.Assert(this._runningScene == null, "_runningScene should be null");
697697

698-
//this.addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
698+
//this.addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
699699

700700
this.pushScene(scene);
701701
this.startAnimation();
@@ -728,7 +728,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
728728
setContentScaleFactor:function (scaleFactor) {
729729
if (scaleFactor != this._contentScaleFactor) {
730730
this._contentScaleFactor = scaleFactor;
731-
this._winSizeInPixels = cc.SizeMake(this._winSizeInPoints.width * scaleFactor, this._winSizeInPoints.height * scaleFactor);
731+
this._winSizeInPixels = cc.size(this._winSizeInPoints.width * scaleFactor, this._winSizeInPoints.height * scaleFactor);
732732

733733
if (this._openGLView) {
734734
this.updateContentScaleFactor();
@@ -834,7 +834,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
834834

835835
// set size
836836
this._winSizeInPoints = this._openGLView.getSize();
837-
this._winSizeInPixels = cc.SizeMake(this._winSizeInPoints.width * this._contentScaleFactor, this._winSizeInPoints.height * this._contentScaleFactor);
837+
this._winSizeInPixels = cc.size(this._winSizeInPoints.width * this._contentScaleFactor, this._winSizeInPoints.height * this._contentScaleFactor);
838838

839839
this._createStatsLabel();
840840

@@ -1132,9 +1132,9 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
11321132
},
11331133

11341134
_createStatsLabel:function(){
1135-
this._FPSLabel = cc.LabelTTF.create("00.0", "Arial", 18, cc.SizeMake(60,16), cc.TEXT_ALIGNMENT_RIGHT);
1136-
this._SPFLabel = cc.LabelTTF.create("0.000", "Arial", 18, cc.SizeMake(60,16), cc.TEXT_ALIGNMENT_RIGHT);
1137-
this._drawsLabel = cc.LabelTTF.create("000", "Arial", 18, cc.SizeMake(60,16), cc.TEXT_ALIGNMENT_RIGHT);
1135+
this._FPSLabel = cc.LabelTTF.create("00.0", "Arial", 18, cc.size(60,16), cc.TEXT_ALIGNMENT_RIGHT);
1136+
this._SPFLabel = cc.LabelTTF.create("0.000", "Arial", 18, cc.size(60,16), cc.TEXT_ALIGNMENT_RIGHT);
1137+
this._drawsLabel = cc.LabelTTF.create("000", "Arial", 18, cc.size(60,16), cc.TEXT_ALIGNMENT_RIGHT);
11381138

11391139
this._drawsLabel.setPosition( cc.pAdd( cc.p(20,48), cc.DIRECTOR_STATS_POSITION ) );
11401140
this._SPFLabel.setPosition( cc.pAdd( cc.p(20,30), cc.DIRECTOR_STATS_POSITION ) );
@@ -1244,7 +1244,7 @@ cc.defaultFPS = 60;
12441244
/*
12451245
window.onfocus = function () {
12461246
if (!cc.firstRun) {
1247-
cc.Director.getInstance().addRegionToDirtyRegion(new cc.Rect(0, 0, cc.canvas.width, cc.canvas.height));
1247+
cc.Director.getInstance().addRegionToDirtyRegion(cc.rect(0, 0, cc.canvas.width, cc.canvas.height));
12481248
}
12491249
};
12501250
*/

cocos2d/actions/CCAction.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -468,7 +468,7 @@ cc.Follow = cc.Action.extend(/** @lends cc.Follow# */{
468468
* // example
469469
* // creates the action with a set boundary
470470
* var sprite = cc.Sprite.create("spriteFileName");
471-
* var followAction = cc.Follow.create(sprite, cc.RectMake(0, 0, s.width * 2 - 100, s.height));
471+
* var followAction = cc.Follow.create(sprite, cc.rect(0, 0, s.width * 2 - 100, s.height));
472472
* this.runAction(followAction);
473473
*
474474
* // creates the action with no boundary set

cocos2d/actions/CCActionGrid3D.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -778,7 +778,7 @@ cc.Twirl = cc.Grid3DAction.extend({
778778
var amp = 0.1 * this._amplitude * this._amplitudeRate;
779779
var a = r * Math.cos(Math.PI / 2.0 + time * Math.PI * this._twirls * 2) * amp;
780780

781-
var d = cc.p();
781+
var d = cc.p(0,0);
782782

783783
d.x = Math.sin(a) * (v.y - c.y) + Math.cos(a) * (v.x - c.x);
784784
d.y = Math.cos(a) * (v.y - c.y) - Math.sin(a) * (v.x - c.x);

cocos2d/actions/CCActionInterval.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1241,7 +1241,7 @@ cc.BezierBy = cc.ActionInterval.extend(/** @lends cc.BezierBy# */{
12411241
*/
12421242
ctor:function () {
12431243
this._config = new cc.BezierConfig();
1244-
this._startPosition = cc.p();
1244+
this._startPosition = cc.p(0,0);
12451245
}
12461246
});
12471247

cocos2d/base_nodes/CCAtlasNode.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ cc.AtlasNode = cc.Node.extend(/** @lends cc.AtlasNode# */{
7171
this._itemHeight = tileHeight;
7272

7373
this._opacity = 255;
74-
this._color = this._colorUnmodified = cc.WHITE();
74+
this._color = this._colorUnmodified = cc.WHITE;
7575
this._isOpacityModifyRGB = true;
7676

7777
this._blendFunc.src = cc.BLEND_SRC;
@@ -156,7 +156,7 @@ cc.AtlasNode = cc.Node.extend(/** @lends cc.AtlasNode# */{
156156
var cacheTextureForColor = cc.TextureCache.getInstance().getTextureColors(this._originalTexture);
157157
if (cacheTextureForColor) {
158158
var tx = this._originalTexture;
159-
var textureRect = new cc.Rect(0, 0, tx.width, tx.height);
159+
var textureRect = cc.rect(0, 0, tx.width, tx.height);
160160
var colorTexture = cc.generateTintImage(tx, cacheTextureForColor, this._color, textureRect);
161161
var img = new Image();
162162
img.src = colorTexture.toDataURL();
@@ -272,7 +272,7 @@ cc.AtlasNode = cc.Node.extend(/** @lends cc.AtlasNode# */{
272272
size = this._textureAtlas.getTexture().getContentSize();
273273
}
274274
else {
275-
size = new cc.Size(this._textureAtlas.getTexture().width, this._textureAtlas.getTexture().height);
275+
size = cc.size(this._textureAtlas.getTexture().width, this._textureAtlas.getTexture().height);
276276
}
277277
this._itemsPerColumn = parseInt(size.height / this._itemHeight);
278278
this._itemsPerRow = parseInt(size.width / this._itemWidth);

0 commit comments

Comments
 (0)