Skip to content

Commit ead766d

Browse files
committed
Merge pull request #3255 from pandamicro/develop
Fix documentation issues
2 parents 37a3654 + 305b296 commit ead766d

32 files changed

+273
-163
lines changed

CCBoot.js

+106-16
Original file line numberDiff line numberDiff line change
@@ -567,8 +567,19 @@ cc.path = /** @lends cc.path# */{
567567

568568
//+++++++++++++++++++++++++something about loader start+++++++++++++++++++++++++++
569569
/**
570-
* Loader for resource loading process. It's a singleton object.
570+
* Resource loading management. Created by in CCBoot.js as a singleton
571+
* cc.loader.
572+
* @name cc.Loader
571573
* @class
574+
* @memberof cc
575+
* @see cc.loader
576+
*/
577+
578+
/**
579+
* Singleton instance of cc.Loader.
580+
* @name cc.loader
581+
* @member {cc.Loader}
582+
* @memberof cc
572583
*/
573584
cc.loader = (function () {
574585
var _jsCache = {}, //cache for js
@@ -607,10 +618,24 @@ cc.loader = (function () {
607618
"$", "i"
608619
);
609620

610-
return /** @lends cc.loader# */{
611-
resPath: "",//root path of resource
612-
audioPath: "",//root path of audio
613-
cache: {},//cache for data loaded
621+
return /** @lends cc.Loader# */{
622+
/**
623+
* Root path of resources.
624+
* @type {String}
625+
*/
626+
resPath: "",
627+
628+
/**
629+
* Root path of audio resources
630+
* @type {String}
631+
*/
632+
audioPath: "",
633+
634+
/**
635+
* Cache for data loaded.
636+
* @type {Object}
637+
*/
638+
cache: {},
614639

615640
/**
616641
* Get XMLHttpRequest.
@@ -2053,32 +2078,97 @@ cc.initEngine = function (config, cb) {
20532078
* An object to boot the game.
20542079
* @class
20552080
* @name cc.game
2081+
*
20562082
*/
20572083
cc.game = /** @lends cc.game# */{
2084+
/**
2085+
* Debug mode: No debugging. {@static}
2086+
* @const {Number}
2087+
* @static
2088+
*/
20582089
DEBUG_MODE_NONE: 0,
2090+
/**
2091+
* Debug mode: Info, warning, error to console.
2092+
* @const {Number}
2093+
* @static
2094+
*/
20592095
DEBUG_MODE_INFO: 1,
2096+
/**
2097+
* Debug mode: Warning, error to console.
2098+
* @const {Number}
2099+
* @static
2100+
*/
20602101
DEBUG_MODE_WARN: 2,
2102+
/**
2103+
* Debug mode: Error to console.
2104+
* @const {Number}
2105+
* @static
2106+
*/
20612107
DEBUG_MODE_ERROR: 3,
2108+
/**
2109+
* Debug mode: Info, warning, error to web page.
2110+
* @const {Number}
2111+
* @static
2112+
*/
20622113
DEBUG_MODE_INFO_FOR_WEB_PAGE: 4,
2114+
/**
2115+
* Debug mode: Warning, error to web page.
2116+
* @const {Number}
2117+
* @static
2118+
*/
20632119
DEBUG_MODE_WARN_FOR_WEB_PAGE: 5,
2120+
/**
2121+
* Debug mode: Error to web page.
2122+
* @const {Number}
2123+
* @static
2124+
*/
20642125
DEBUG_MODE_ERROR_FOR_WEB_PAGE: 6,
20652126

2127+
/**
2128+
* Event that is fired when the game is hidden.
2129+
* @constant {String}
2130+
*/
20662131
EVENT_HIDE: "game_on_hide",
2132+
/**
2133+
* Event that is fired when the game is shown.
2134+
* @constant {String}
2135+
*/
20672136
EVENT_SHOW: "game_on_show",
2137+
/**
2138+
* Event that is fired when the game is resized.
2139+
* @constant {String}
2140+
*/
20682141
EVENT_RESIZE: "game_on_resize",
2142+
/**
2143+
* Event that is fired when the renderer is done being initialized.
2144+
* @constant {String}
2145+
*/
20692146
EVENT_RENDERER_INITED: "renderer_inited",
20702147

2148+
/** @constant {Number} */
20712149
RENDER_TYPE_CANVAS: 0,
2150+
/** @constant {Number} */
20722151
RENDER_TYPE_WEBGL: 1,
2152+
/** @constant {Number} */
20732153
RENDER_TYPE_OPENGL: 2,
20742154

20752155
_eventHide: null,
20762156
_eventShow: null,
20772157

20782158
/**
2079-
* Key of config
2159+
* Keys found in project.json.
2160+
*
20802161
* @constant
20812162
* @type {Object}
2163+
*
2164+
* @prop {String} engineDir - In debug mode, if you use the whole engine to develop your game, you should specify its relative path with "engineDir".
2165+
* @prop {String} modules - Defines which modules you will need in your game, it's useful only on web
2166+
* @prop {String} debugMode - Debug mode, see DEBUG_MODE_XXX constant definitions.
2167+
* @prop {String} showFPS - Left bottom corner fps information will show when "showFPS" equals true, otherwise it will be hide.
2168+
* @prop {String} frameRate - Sets the wanted frame rate for your game, but the real fps depends on your game implementation and the running environment.
2169+
* @prop {String} id - Sets the id of your canvas element on the web page, it's useful only on web.
2170+
* @prop {String} renderMode - Sets the renderer type, only useful on web, 0: Automatic, 1: Canvas, 2: WebGL
2171+
* @prop {String} jsList - Sets the list of js files in your game.
20822172
*/
20832173
CONFIG_KEY: {
20842174
width: "width",
@@ -2092,17 +2182,17 @@ cc.game = /** @lends cc.game# */{
20922182
renderMode: "renderMode",
20932183
jsList: "jsList"
20942184
},
2095-
2185+
20962186
// states
20972187
_paused: true,//whether the game is paused
20982188
_prepareCalled: false,//whether the prepare function has been called
20992189
_prepared: false,//whether the engine has prepared
21002190
_rendererInitialized: false,
21012191

21022192
_renderContext: null,
2103-
2193+
21042194
_intervalId: null,//interval target of main
2105-
2195+
21062196
_lastTime: null,
21072197
_frameTime: null,
21082198

@@ -2130,13 +2220,13 @@ cc.game = /** @lends cc.game# */{
21302220

21312221
/**
21322222
* Callback when the scripts of engine have been load.
2133-
* @type {Function}
2223+
* @type {Function|null}
21342224
*/
21352225
onStart: null,
21362226

21372227
/**
21382228
* Callback when game exits.
2139-
* @type {Function}
2229+
* @type {Function|null}
21402230
*/
21412231
onStop: null,
21422232

@@ -2215,7 +2305,7 @@ cc.game = /** @lends cc.game# */{
22152305
*/
22162306
prepare: function (cb) {
22172307
var self = this,
2218-
config = self.config,
2308+
config = self.config,
22192309
CONFIG_KEY = self.CONFIG_KEY;
22202310

22212311
this._loadConfig();
@@ -2236,10 +2326,10 @@ cc.game = /** @lends cc.game# */{
22362326
this._initRenderer(config[CONFIG_KEY.width], config[CONFIG_KEY.height]);
22372327

22382328
/**
2329+
* cc.view is the shared view object.
22392330
* @type {cc.EGLView}
22402331
* @name cc.view
22412332
* @memberof cc
2242-
* cc.view is the shared view object.
22432333
*/
22442334
cc.view = cc.EGLView._getInstance();
22452335

@@ -2252,10 +2342,10 @@ cc.game = /** @lends cc.game# */{
22522342
if (cc.director.setOpenGLView)
22532343
cc.director.setOpenGLView(cc.view);
22542344
/**
2345+
* cc.winSize is the alias object for the size of the current game window.
22552346
* @type {cc.Size}
22562347
* @name cc.winSize
22572348
* @memberof cc
2258-
* cc.winSize is the alias object for the size of the current game window.
22592349
*/
22602350
cc.winSize = cc.director.getWinSize();
22612351

@@ -2308,7 +2398,7 @@ cc.game = /** @lends cc.game# */{
23082398
cc.game.onStart = onStart;
23092399
}
23102400
}
2311-
2401+
23122402
this.prepare(cc.game.onStart && cc.game.onStart.bind(cc.game));
23132403
},
23142404

@@ -2385,7 +2475,7 @@ cc.game = /** @lends cc.game# */{
23852475
if (document["ccConfig"]) {
23862476
this._initConfig(document["ccConfig"]);
23872477
}
2388-
// Load from project.json
2478+
// Load from project.json
23892479
else {
23902480
var data = {};
23912481
try {

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
@@ -898,7 +898,7 @@ cc.Audio = cc.Class.extend({
898898

899899
/**
900900
* Pause playing sound effect.
901-
* @param {Number} cc.Audio The return value of function playEffect.
901+
* @param {Number} audio The return value of function playEffect.
902902
* @example
903903
* //example
904904
* cc.audioEngine.pauseEffect(audioID);
@@ -929,7 +929,7 @@ cc.Audio = cc.Class.extend({
929929

930930
/**
931931
* Resume playing sound effect.
932-
* @param {Number} cc.Audio The return value of function playEffect.
932+
* @param {Number} audio The return value of function playEffect.
933933
* @audioID
934934
* //example
935935
* cc.audioEngine.resumeEffect(audioID);
@@ -957,7 +957,7 @@ cc.Audio = cc.Class.extend({
957957

958958
/**
959959
* Stop playing sound effect.
960-
* @param {Number} cc.Audio The return value of function playEffect.
960+
* @param {Number} audio The return value of function playEffect.
961961
* @example
962962
* //example
963963
* 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/cocoa/CCGeometry.js

+13-2
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@
2929
* @class cc.Point
3030
* @param {Number} x
3131
* @param {Number} y
32+
*
33+
* @property x {Number}
34+
* @property y {Number}
3235
* @see cc.p
3336
*/
3437
cc.Point = function (x, y) {
@@ -79,6 +82,8 @@ cc.pointEqualToPoint = function (point1, point2) {
7982
* @class cc.Size
8083
* @param {Number} width
8184
* @param {Number} height
85+
* @property {Number} width
86+
* @property {Number} height
8287
* @see cc.size
8388
*/
8489
cc.Size = function (width, height) {
@@ -127,8 +132,16 @@ cc.sizeEqualToSize = function (size1, size2) {
127132
/**
128133
* cc.Rect is the class for rect object, please do not use its constructor to create rects, use cc.rect() alias function instead.
129134
* @class cc.Rect
135+
* @param {Number} x
136+
* @param {Number} y
130137
* @param {Number} width
131138
* @param {Number} height
139+
*
140+
* @property {Number} x
141+
* @property {Number} y
142+
* @property {Number} width
143+
* @property {Number} height
144+
*
132145
* @see cc.rect
133146
*/
134147
cc.Rect = function (x, y, width, height) {
@@ -323,5 +336,3 @@ cc.rectIntersection = function (rectA, rectB) {
323336
intersection.height = Math.min(cc.rectGetMaxY(rectA), cc.rectGetMaxY(rectB)) - cc.rectGetMinY(intersection);
324337
return intersection;
325338
};
326-
327-

0 commit comments

Comments
 (0)