Skip to content

Commit 4540efe

Browse files
committed
Fixed cocos2d#3501: Modify some codes for NPM
1 parent 1924673 commit 4540efe

File tree

8 files changed

+18
-12
lines changed

8 files changed

+18
-12
lines changed

HelloHTML5World/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<file name="core/CCCamera.js"/>
4949
<file name="core/CCScheduler.js"/>
5050
<file name="core/CCLoader.js"/>
51+
<file name="core/CCDrawingPrimitives.js"/>
5152
<file name="core/platform/CCApplication.js"/>
5253
<file name="core/platform/CCSAXParser.js"/>
5354
<file name="core/platform/AppControl.js"/>
@@ -113,7 +114,6 @@
113114
<file name="accelerometer/CCAccelerometer.js"/>
114115
<file name="text_input_node/CCIMEDispatcher.js"/>
115116
<file name="text_input_node/CCTextFieldTTF.js"/>
116-
<file name="CCDrawingPrimitives.js"/>
117117
<file name="menu_nodes/CCMenuItem.js"/>
118118
<file name="menu_nodes/CCMenu.js"/>
119119
<file name="tileMap_nodes/CCTGAlib.js"/>

cocos2d/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<file name="core/CCCamera.js"/>
4949
<file name="core/CCScheduler.js"/>
5050
<file name="core/CCLoader.js"/>
51+
<file name="core/CCDrawingPrimitives.js"/>
5152
<file name="core/platform/CCApplication.js"/>
5253
<file name="core/platform/CCSAXParser.js"/>
5354
<file name="core/platform/AppControl.js"/>
@@ -113,7 +114,6 @@
113114
<file name="accelerometer/CCAccelerometer.js"/>
114115
<file name="text_input_node/CCIMEDispatcher.js"/>
115116
<file name="text_input_node/CCTextFieldTTF.js"/>
116-
<file name="CCDrawingPrimitives.js"/>
117117
<file name="menu_nodes/CCMenuItem.js"/>
118118
<file name="menu_nodes/CCMenu.js"/>
119119
<file name="tileMap_nodes/CCTGAlib.js"/>

cocos2d/core/CCDirector.js

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

519519
// don't release the event handlers
520520
// They are needed in case the director is run again
521-
this._touchDispatcher.removeAllDelegates();
521+
if(this._touchDispatcher)this._touchDispatcher.removeAllDelegates();
522522

523523
if (this._runningScene) {
524524
this._runningScene.onExitTransitionDidStart();
@@ -799,7 +799,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
799799
this.updateContentScaleFactor();
800800
}*/
801801

802-
this._touchDispatcher.setDispatchEvents(true);
802+
if(this._touchDispatcher)this._touchDispatcher.setDispatchEvents(true);
803803
//}
804804
},
805805

@@ -1108,6 +1108,9 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
11081108
_createStatsLabel: null,
11091109

11101110
_createStatsLabelForWebGL:function(){
1111+
if(!cc.LabelAtlas)
1112+
return this._createStatsLabelForCanvas();
1113+
11111114
if((cc.Director._fpsImageLoaded == null) || (cc.Director._fpsImageLoaded == false))
11121115
return;
11131116

File renamed without changes.

cocos2d/jsloader.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,12 +62,12 @@
6262
'core/CCCamera.js',
6363
'core/CCScheduler.js',
6464
'core/CCLoader.js',
65+
'core/CCDrawingPrimitives.js',
6566
'core/platform/CCApplication.js',
6667
'core/platform/CCSAXParser.js',
6768
'core/platform/AppControl.js',
6869
'core/labelTTF/CCLabelTTF.js',
6970
'core/CCActionManager.js',
70-
7171
'kazmath/utility.js',
7272
'kazmath/vec2.js',
7373
'kazmath/vec3.js',
@@ -126,7 +126,6 @@
126126
'accelerometer/CCAccelerometer.js',
127127
'text_input_node/CCIMEDispatcher.js',
128128
'text_input_node/CCTextFieldTTF.js',
129-
'CCDrawingPrimitives.js',
130129
'menu_nodes/CCMenuItem.js',
131130
'menu_nodes/CCMenu.js',
132131
'tileMap_nodes/CCTGAlib.js',

extensions/GUI/CCControlExtension/CCControlColourPicker.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@
3030
* converted to Javascript / cocos2d-x by Angus C
3131
*/
3232

33-
3433
cc.ControlColourPicker = cc.Control.extend({
3534
_hsv:null,
3635
_colourPicker:null,
@@ -84,10 +83,10 @@ cc.ControlColourPicker = cc.Control.extend({
8483
if (cc.Control.prototype.init.call(this)) {
8584
this.setTouchEnabled(true);
8685
// Cache the sprites
87-
cc.SpriteFrameCache.getInstance().addSpriteFrames("res/extensions/CCControlColourPickerSpriteSheet.plist");
86+
cc.SpriteFrameCache.getInstance().addSpriteFrames(res.CCControlColourPickerSpriteSheet_plist);
8887

8988
// Create the sprite batch node
90-
var spriteSheet = cc.SpriteBatchNode.create("res/extensions/CCControlColourPickerSpriteSheet.png");
89+
var spriteSheet = cc.SpriteBatchNode.create(res.CCControlColourPickerSpriteSheet_png);
9190
this.addChild(spriteSheet);
9291

9392
/*// MIPMAP
@@ -159,4 +158,9 @@ cc.ControlColourPicker.create = function () {
159158
var pRet = new cc.ControlColourPicker();
160159
pRet.init();
161160
return pRet;
162-
};
161+
};
162+
163+
// compatible with NPM
164+
var res = res || {};
165+
res.CCControlColourPickerSpriteSheet_plist = res.CCControlColourPickerSpriteSheet_plist || "res/extensions/CCControlColourPickerSpriteSheet.plist";
166+
res.CCControlColourPickerSpriteSheet_png = res.CCControlColourPickerSpriteSheet_png || "res/extensions/CCControlColourPickerSpriteSheet.png";

template/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
<file name="core/CCCamera.js"/>
4949
<file name="core/CCScheduler.js"/>
5050
<file name="core/CCLoader.js"/>
51+
<file name="core/CCDrawingPrimitives.js"/>
5152
<file name="core/platform/CCApplication.js"/>
5253
<file name="core/platform/CCSAXParser.js"/>
5354
<file name="core/platform/AppControl.js"/>
@@ -113,7 +114,6 @@
113114
<file name="accelerometer/CCAccelerometer.js"/>
114115
<file name="text_input_node/CCIMEDispatcher.js"/>
115116
<file name="text_input_node/CCTextFieldTTF.js"/>
116-
<file name="CCDrawingPrimitives.js"/>
117117
<file name="menu_nodes/CCMenuItem.js"/>
118118
<file name="menu_nodes/CCMenu.js"/>
119119
<file name="tileMap_nodes/CCTGAlib.js"/>

tools/jsdoc_toolkit/build.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
<include name="core/CCCamera.js"/>
5656
<include name="core/CCScheduler.js"/>
5757
<include name="core/CCLoader.js"/>
58+
<include name="core/CCDrawingPrimitives.js"/>
5859
<include name="core/platform/CCApplication.js"/>
5960
<include name="core/platform/CCSAXParser.js"/>
6061
<include name="core/platform/AppControl.js"/>
@@ -118,7 +119,6 @@
118119
<include name="accelerometer/CCAccelerometer.js"/>
119120
<include name="text_input_node/CCIMEDispatcher.js"/>
120121
<include name="text_input_node/CCTextFieldTTF.js"/>
121-
<include name="CCDrawingPrimitives.js"/>
122122
<include name="menu_nodes/CCMenuItem.js"/>
123123
<include name="menu_nodes/CCMenu.js"/>
124124
<include name="tileMap_nodes/CCTGAlib.js"/>

0 commit comments

Comments
 (0)