Skip to content

Commit cb529d1

Browse files
committed
Documentation fixes
A whole pile of (mostly?) non-controversial documentation fixes. I am running jsdoc 3.0 on the doc tree to produce a FlowType declaration file (for static type analysis of JavaScript code). The docs are actually quite awesome in how much information they provide; considering how much of the documentation Just Worked, this really isn't that many bugs. Some of the changes were because FlowType noticed that an inherited class member function signature didn't match the signature of the same function in an ancestor class. Many of the changes were just random typos. I may have other similar pull requests in the future as I use Cocos2d/html more, and I find more of the documentation that needs to be fixed. In general I think this will just help the docs. Let me know if you want me to actually submit *text* documentation changes. I could probably be encouraged to document bits of the code as I use them. I wrote an entire 500+ page book on an older (now dead) game SDK, just documenting things as I went, so it's become a bit of a habit. (cherry picked from commit ec06396) (cherry picked from commit a9909bb) (cherry picked from commit 4a1839f) (cherry picked from commit 5526087) (cherry picked from commit 543b891) (cherry picked from commit 94ee8d9)
1 parent f85697f commit cb529d1

27 files changed

+140
-131
lines changed

CCBoot.js

+13-13
Original file line numberDiff line numberDiff line change
@@ -1894,8 +1894,8 @@ var _initSys = function () {
18941894
};
18951895
_initSys();
18961896

1897-
delete _tmpCanvas1;
1898-
delete _tmpCanvas2;
1897+
delete window._tmpCanvas1;
1898+
delete window._tmpCanvas2;
18991899

19001900
//to make sure the cc.log, cc.warn, cc.error and cc.assert would not throw error before init by debugger mode.
19011901
cc.log = cc.warn = cc.error = cc.assert = function () {
@@ -1923,9 +1923,9 @@ function _determineRenderType(config) {
19231923
cc._renderType = cc.game.RENDER_TYPE_CANVAS;
19241924
cc._supportRender = true;
19251925

1926-
if ( userRenderMode === 2 ||
1927-
( userRenderMode === 0 &&
1928-
shieldOs.indexOf(cc.sys.os) === -1 &&
1926+
if ( userRenderMode === 2 ||
1927+
( userRenderMode === 0 &&
1928+
shieldOs.indexOf(cc.sys.os) === -1 &&
19291929
shieldBrowser.indexOf(cc.sys.browserType) === -1 )) {
19301930
if (cc.sys.capabilities["opengl"]) {
19311931
cc._renderType = cc.game.RENDER_TYPE_WEBGL;
@@ -2084,17 +2084,17 @@ cc.game = /** @lends cc.game# */{
20842084
renderMode: "renderMode",
20852085
jsList: "jsList"
20862086
},
2087-
2087+
20882088
// states
20892089
_paused: true,//whether the game is paused
20902090
_prepareCalled: false,//whether the prepare function has been called
20912091
_prepared: false,//whether the engine has prepared
20922092
_rendererInitialized: false,
20932093

20942094
_renderContext: null,
2095-
2095+
20962096
_intervalId: null,//interval target of main
2097-
2097+
20982098
_lastTime: null,
20992099
_frameTime: null,
21002100

@@ -2207,7 +2207,7 @@ cc.game = /** @lends cc.game# */{
22072207
*/
22082208
prepare: function (cb) {
22092209
var self = this,
2210-
config = self.config,
2210+
config = self.config,
22112211
CONFIG_KEY = self.CONFIG_KEY;
22122212

22132213
this._loadConfig();
@@ -2228,10 +2228,10 @@ cc.game = /** @lends cc.game# */{
22282228
this._initRenderer(config[CONFIG_KEY.width], config[CONFIG_KEY.height]);
22292229

22302230
/**
2231+
* cc.view is the shared view object.
22312232
* @type {cc.EGLView}
22322233
* @name cc.view
22332234
* @memberof cc
2234-
* cc.view is the shared view object.
22352235
*/
22362236
cc.view = cc.EGLView._getInstance();
22372237

@@ -2244,10 +2244,10 @@ cc.game = /** @lends cc.game# */{
22442244
if (cc.director.setOpenGLView)
22452245
cc.director.setOpenGLView(cc.view);
22462246
/**
2247+
* cc.winSize is the alias object for the size of the current game window.
22472248
* @type {cc.Size}
22482249
* @name cc.winSize
22492250
* @memberof cc
2250-
* cc.winSize is the alias object for the size of the current game window.
22512251
*/
22522252
cc.winSize = cc.director.getWinSize();
22532253

@@ -2300,7 +2300,7 @@ cc.game = /** @lends cc.game# */{
23002300
cc.game.onStart = onStart;
23012301
}
23022302
}
2303-
2303+
23042304
this.prepare(cc.game.onStart && cc.game.onStart.bind(cc.game));
23052305
},
23062306

@@ -2377,7 +2377,7 @@ cc.game = /** @lends cc.game# */{
23772377
if (document["ccConfig"]) {
23782378
this._initConfig(document["ccConfig"]);
23792379
}
2380-
// Load from project.json
2380+
// Load from project.json
23812381
else {
23822382
try {
23832383
var cocos_script = document.getElementsByTagName('script');

cocos2d/actions/CCAction.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ cc.FiniteTimeAction = cc.Action.extend(/** @lends cc.FiniteTimeAction# */{
274274
* - The reversed action will be x of 100 move to 0.
275275
* - Will be rewritten
276276
*
277-
* @return {Null}
277+
* @return {?cc.Action}
278278
*/
279279
reverse:function () {
280280
cc.log("cocos2d: FiniteTimeAction#reverse: Implement me");

cocos2d/actions/CCActionCamera.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ cc.ActionCamera = cc.ActionInterval.extend(/** @lends cc.ActionCamera# */{
100100
* - The action will be x coordinates of 0 move to 100. <br />
101101
* - The reversed action will be x of 100 move to 0.
102102
* - Will be rewritten
103-
*
103+
* @return {?cc.Action}
104104
*/
105105
reverse:function () {
106106
return new cc.ReverseTime(this);

cocos2d/actions/CCActionEase.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1140,7 +1140,7 @@ cc.EaseElastic = cc.ActionEase.extend(/** @lends cc.EaseElastic# */{
11401140
/**
11411141
* Create a action. Opposite with the original motion trajectory. <br />
11421142
* Will be overwrite.
1143-
* @return {null}
1143+
* @return {?cc.Action}
11441144
*/
11451145
reverse:function () {
11461146
cc.log("cc.EaseElastic.reverse(): it should be overridden in subclass.");
@@ -3678,4 +3678,3 @@ cc._easeCubicActionInOut = {
36783678
cc.easeCubicActionInOut = function(){
36793679
return cc._easeCubicActionInOut;
36803680
};
3681-

cocos2d/actions/CCActionInterval.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ cc.ActionInterval = cc.FiniteTimeAction.extend(/** @lends cc.ActionInterval# */{
208208
* returns a reversed action. <br />
209209
* Will be overwrite.
210210
*
211-
* @return {null}
211+
* @return {?cc.Action}
212212
*/
213213
reverse:function () {
214214
cc.log("cc.IntervalAction: reverse not implemented.");
@@ -1121,6 +1121,7 @@ cc.RotateTo = cc.ActionInterval.extend(/** @lends cc.RotateTo# */{
11211121
/**
11221122
* RotateTo reverse not implemented.
11231123
* Will be overridden.
1124+
* @returns {cc.Action}
11241125
*/
11251126
reverse:function () {
11261127
cc.log("cc.RotateTo.reverse(): it should be overridden in subclass.");

cocos2d/actions3d/CCActionGrid.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ cc.GridAction = cc.ActionInterval.extend(/** @lends cc.GridAction# */{
5656
* to copy object with deep copy.
5757
* returns a clone of action.
5858
*
59-
* @return {cc.Action}
59+
* @return {cc.ActionInterval}
6060
*/
6161
clone:function(){
6262
var action = new cc.GridAction();

cocos2d/audio/CCAudio.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -866,7 +866,7 @@ cc.Audio = cc.Class.extend({
866866

867867
/**
868868
* Pause playing sound effect.
869-
* @param {Number} cc.Audio The return value of function playEffect.
869+
* @param {Number} audio The return value of function playEffect.
870870
* @example
871871
* //example
872872
* cc.audioEngine.pauseEffect(audioID);
@@ -897,7 +897,7 @@ cc.Audio = cc.Class.extend({
897897

898898
/**
899899
* Resume playing sound effect.
900-
* @param {Number} cc.Audio The return value of function playEffect.
900+
* @param {Number} audio The return value of function playEffect.
901901
* @audioID
902902
* //example
903903
* cc.audioEngine.resumeEffect(audioID);
@@ -925,7 +925,7 @@ cc.Audio = cc.Class.extend({
925925

926926
/**
927927
* Stop playing sound effect.
928-
* @param {Number} cc.Audio The return value of function playEffect.
928+
* @param {Number} audio The return value of function playEffect.
929929
* @example
930930
* //example
931931
* cc.audioEngine.stopEffect(audioID);

cocos2d/core/CCCamera.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
* - It is recommended to use it ONLY if you are going to create 3D effects. For 2D effecs, use the action CCFollow or position/scale/rotate. *
4444
* </p>
4545
*/
46-
cc.Camera = cc.Class.extend({
46+
cc.Camera = cc.Class.extend(/** @lends cc.Camera# */{
4747
_eyeX:null,
4848
_eyeY:null,
4949
_eyeZ:null,

cocos2d/core/CCDirector.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2424
THE SOFTWARE.
2525
****************************************************************************/
26-
26+
2727
cc.g_NumberOfDraws = 0;
2828

2929
cc.GLToClipTransform = function (transformOut) {
@@ -495,7 +495,7 @@ cc.Director = cc.Class.extend(/** @lends cc.Director# */{
495495
* set color for clear screen.<br/>
496496
* Implementation can be found in CCDirectorCanvas.js/CCDirectorWebGL.js
497497
* @function
498-
* @param {cc.color} clearColor
498+
* @param {cc.Color} clearColor
499499
*/
500500
setClearColor: null,
501501
/**
@@ -933,4 +933,4 @@ cc.Director.PROJECTION_CUSTOM = 3;
933933
* @constant
934934
* @type {Number}
935935
*/
936-
cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_3D;
936+
cc.Director.PROJECTION_DEFAULT = cc.Director.PROJECTION_3D;

cocos2d/core/platform/CCSAXParser.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -162,8 +162,9 @@ cc.PlistParser = cc.SAXParser.extend(/** @lends cc.plistParser# */{
162162

163163
cc.saxParser = new cc.SAXParser();
164164
/**
165-
* @type {cc.PlistParser}
166-
* @name cc.plistParser
167165
* A Plist Parser
166+
* @type {cc.PlistParser}
167+
* @name plistParser
168+
* @memberof cc
168169
*/
169170
cc.plistParser = new cc.PlistParser();

cocos2d/core/platform/CCTypesWebGL.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED, function () {
365365
/**
366366
* @class cc.V3F_C4B_T2F
367367
* @param {cc.Vertex3F} vertices
368-
* @param { cc.color} colors
368+
* @param {cc.Color} colors
369369
* @param {cc.Tex2F} texCoords
370370
* @param {Array} arrayBuffer
371371
* @param {Number} offset
@@ -568,7 +568,7 @@ cc.game.addEventListener(cc.game.EVENT_RENDERER_INITED, function () {
568568
/**
569569
* @class cc.V2F_C4B_T2F
570570
* @param {cc.Vertex2F} vertices
571-
* @param {cc.color} colors
571+
* @param {cc.Color} colors
572572
* @param {cc.Tex2F} texCoords
573573
* @param {Array} arrayBuffer
574574
* @param {Number} offset

cocos2d/core/sprites/CCSprite.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -797,7 +797,7 @@ cc.Sprite = cc.Node.extend(/** @lends cc.Sprite# */{
797797
* @function
798798
* @param {cc.Sprite} child
799799
* @param {Number} localZOrder child's zOrder
800-
* @param {String} [tag] child's tag
800+
* @param {number|String} [tag] child's tag
801801
* @override
802802
*/
803803
addChild: function (child, localZOrder, tag) {
@@ -1027,4 +1027,4 @@ cc.EventHelper.prototype.apply(cc.Sprite.prototype);
10271027

10281028
cc.assert(cc.isFunction(cc._tmp.PrototypeSprite), cc._LogInfos.MissingFile, "SpritesPropertyDefine.js");
10291029
cc._tmp.PrototypeSprite();
1030-
delete cc._tmp.PrototypeSprite;
1030+
delete cc._tmp.PrototypeSprite;

cocos2d/core/sprites/CCSpriteBatchNode.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -576,7 +576,7 @@ cc.SpriteBatchNode = cc.Node.extend(/** @lends cc.SpriteBatchNode# */{
576576
* Removes all children from the container and do a cleanup all running actions depending on the cleanup parameter. <br/>
577577
* (override removeAllChildren of cc.Node)
578578
* @function
579-
* @param {Boolean} cleanup
579+
* @param {Boolean} [cleanup=true]
580580
*/
581581
removeAllChildren: function (cleanup) {
582582
// Invalidate atlas index. issue #569
@@ -673,4 +673,4 @@ cc.SpriteBatchNode.create = function (fileImage, capacity) {
673673
* @see cc.SpriteBatchNode
674674
* @function
675675
*/
676-
cc.SpriteBatchNode.createWithTexture = cc.SpriteBatchNode.create;
676+
cc.SpriteBatchNode.createWithTexture = cc.SpriteBatchNode.create;

cocos2d/core/support/CCPointExtension.js

+4-5
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ cc.pMult = function (point, floatVar) {
8686
* Calculates midpoint between two points.
8787
* @param {cc.Point} v1
8888
* @param {cc.Point} v2
89-
* @return {cc.pMult}
89+
* @return {cc.Point}
9090
*/
9191
cc.pMidpoint = function (v1, v2) {
9292
return cc.pMult(cc.pAdd(v1, v2), 0.5);
@@ -134,7 +134,7 @@ cc.pRPerp = function (point) {
134134
* Calculates the projection of v1 over v2.
135135
* @param {cc.Point} v1
136136
* @param {cc.Point} v2
137-
* @return {cc.pMult}
137+
* @return {cc.Point}
138138
*/
139139
cc.pProject = function (v1, v2) {
140140
return cc.pMult(v2, cc.pDot(v1, v2) / cc.pDot(v2, v2));
@@ -284,7 +284,7 @@ cc.pCompOp = function (p, opFunc) {
284284
* @param {cc.Point} a
285285
* @param {cc.Point} b
286286
* @param {Number} alpha
287-
* @return {cc.pAdd}
287+
* @return {cc.Point}
288288
*/
289289
cc.pLerp = function (a, b, alpha) {
290290
return cc.pAdd(cc.pMult(a, 1 - alpha), cc.pMult(b, alpha));
@@ -498,7 +498,7 @@ cc.pSubIn = function(v1, v2) {
498498
/**
499499
* adds one point to another (inplace)
500500
* @param {cc.Point} v1
501-
* @param {cc.point} v2
501+
* @param {cc.Point} v2
502502
*/
503503
cc.pAddIn = function(v1, v2) {
504504
v1.x += v2.x;
@@ -512,4 +512,3 @@ cc.pAddIn = function(v1, v2) {
512512
cc.pNormalizeIn = function(v) {
513513
cc.pMultIn(v, 1.0 / Math.sqrt(v.x * v.x + v.y * v.y));
514514
};
515-

0 commit comments

Comments
 (0)