@@ -567,8 +567,19 @@ cc.path = /** @lends cc.path# */{
567
567
568
568
//+++++++++++++++++++++++++something about loader start+++++++++++++++++++++++++++
569
569
/**
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
571
573
* @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
572
583
*/
573
584
cc . loader = ( function ( ) {
574
585
var _jsCache = { } , //cache for js
@@ -607,10 +618,24 @@ cc.loader = (function () {
607
618
"$" , "i"
608
619
) ;
609
620
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 : { } ,
614
639
615
640
/**
616
641
* Get XMLHttpRequest.
@@ -2053,32 +2078,97 @@ cc.initEngine = function (config, cb) {
2053
2078
* An object to boot the game.
2054
2079
* @class
2055
2080
* @name cc.game
2081
+ *
2056
2082
*/
2057
2083
cc . game = /** @lends cc.game# */ {
2084
+ /**
2085
+ * Debug mode: No debugging. {@static }
2086
+ * @const {Number}
2087
+ * @static
2088
+ */
2058
2089
DEBUG_MODE_NONE : 0 ,
2090
+ /**
2091
+ * Debug mode: Info, warning, error to console.
2092
+ * @const {Number}
2093
+ * @static
2094
+ */
2059
2095
DEBUG_MODE_INFO : 1 ,
2096
+ /**
2097
+ * Debug mode: Warning, error to console.
2098
+ * @const {Number}
2099
+ * @static
2100
+ */
2060
2101
DEBUG_MODE_WARN : 2 ,
2102
+ /**
2103
+ * Debug mode: Error to console.
2104
+ * @const {Number}
2105
+ * @static
2106
+ */
2061
2107
DEBUG_MODE_ERROR : 3 ,
2108
+ /**
2109
+ * Debug mode: Info, warning, error to web page.
2110
+ * @const {Number}
2111
+ * @static
2112
+ */
2062
2113
DEBUG_MODE_INFO_FOR_WEB_PAGE : 4 ,
2114
+ /**
2115
+ * Debug mode: Warning, error to web page.
2116
+ * @const {Number}
2117
+ * @static
2118
+ */
2063
2119
DEBUG_MODE_WARN_FOR_WEB_PAGE : 5 ,
2120
+ /**
2121
+ * Debug mode: Error to web page.
2122
+ * @const {Number}
2123
+ * @static
2124
+ */
2064
2125
DEBUG_MODE_ERROR_FOR_WEB_PAGE : 6 ,
2065
2126
2127
+ /**
2128
+ * Event that is fired when the game is hidden.
2129
+ * @constant {String}
2130
+ */
2066
2131
EVENT_HIDE : "game_on_hide" ,
2132
+ /**
2133
+ * Event that is fired when the game is shown.
2134
+ * @constant {String}
2135
+ */
2067
2136
EVENT_SHOW : "game_on_show" ,
2137
+ /**
2138
+ * Event that is fired when the game is resized.
2139
+ * @constant {String}
2140
+ */
2068
2141
EVENT_RESIZE : "game_on_resize" ,
2142
+ /**
2143
+ * Event that is fired when the renderer is done being initialized.
2144
+ * @constant {String}
2145
+ */
2069
2146
EVENT_RENDERER_INITED : "renderer_inited" ,
2070
2147
2148
+ /** @constant {Number} */
2071
2149
RENDER_TYPE_CANVAS : 0 ,
2150
+ /** @constant {Number} */
2072
2151
RENDER_TYPE_WEBGL : 1 ,
2152
+ /** @constant {Number} */
2073
2153
RENDER_TYPE_OPENGL : 2 ,
2074
2154
2075
2155
_eventHide : null ,
2076
2156
_eventShow : null ,
2077
2157
2078
2158
/**
2079
- * Key of config
2159
+ * Keys found in project.json.
2160
+ *
2080
2161
* @constant
2081
2162
* @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.
2082
2172
*/
2083
2173
CONFIG_KEY : {
2084
2174
width : "width" ,
@@ -2092,17 +2182,17 @@ cc.game = /** @lends cc.game# */{
2092
2182
renderMode : "renderMode" ,
2093
2183
jsList : "jsList"
2094
2184
} ,
2095
-
2185
+
2096
2186
// states
2097
2187
_paused : true , //whether the game is paused
2098
2188
_prepareCalled : false , //whether the prepare function has been called
2099
2189
_prepared : false , //whether the engine has prepared
2100
2190
_rendererInitialized : false ,
2101
2191
2102
2192
_renderContext : null ,
2103
-
2193
+
2104
2194
_intervalId : null , //interval target of main
2105
-
2195
+
2106
2196
_lastTime : null ,
2107
2197
_frameTime : null ,
2108
2198
@@ -2130,13 +2220,13 @@ cc.game = /** @lends cc.game# */{
2130
2220
2131
2221
/**
2132
2222
* Callback when the scripts of engine have been load.
2133
- * @type {Function }
2223
+ * @type {Function|null }
2134
2224
*/
2135
2225
onStart : null ,
2136
2226
2137
2227
/**
2138
2228
* Callback when game exits.
2139
- * @type {Function }
2229
+ * @type {Function|null }
2140
2230
*/
2141
2231
onStop : null ,
2142
2232
@@ -2215,7 +2305,7 @@ cc.game = /** @lends cc.game# */{
2215
2305
*/
2216
2306
prepare : function ( cb ) {
2217
2307
var self = this ,
2218
- config = self . config ,
2308
+ config = self . config ,
2219
2309
CONFIG_KEY = self . CONFIG_KEY ;
2220
2310
2221
2311
this . _loadConfig ( ) ;
@@ -2236,10 +2326,10 @@ cc.game = /** @lends cc.game# */{
2236
2326
this . _initRenderer ( config [ CONFIG_KEY . width ] , config [ CONFIG_KEY . height ] ) ;
2237
2327
2238
2328
/**
2329
+ * cc.view is the shared view object.
2239
2330
* @type {cc.EGLView }
2240
2331
* @name cc.view
2241
2332
* @memberof cc
2242
- * cc.view is the shared view object.
2243
2333
*/
2244
2334
cc . view = cc . EGLView . _getInstance ( ) ;
2245
2335
@@ -2252,10 +2342,10 @@ cc.game = /** @lends cc.game# */{
2252
2342
if ( cc . director . setOpenGLView )
2253
2343
cc . director . setOpenGLView ( cc . view ) ;
2254
2344
/**
2345
+ * cc.winSize is the alias object for the size of the current game window.
2255
2346
* @type {cc.Size }
2256
2347
* @name cc.winSize
2257
2348
* @memberof cc
2258
- * cc.winSize is the alias object for the size of the current game window.
2259
2349
*/
2260
2350
cc . winSize = cc . director . getWinSize ( ) ;
2261
2351
@@ -2308,7 +2398,7 @@ cc.game = /** @lends cc.game# */{
2308
2398
cc . game . onStart = onStart ;
2309
2399
}
2310
2400
}
2311
-
2401
+
2312
2402
this . prepare ( cc . game . onStart && cc . game . onStart . bind ( cc . game ) ) ;
2313
2403
} ,
2314
2404
@@ -2385,7 +2475,7 @@ cc.game = /** @lends cc.game# */{
2385
2475
if ( document [ "ccConfig" ] ) {
2386
2476
this . _initConfig ( document [ "ccConfig" ] ) ;
2387
2477
}
2388
- // Load from project.json
2478
+ // Load from project.json
2389
2479
else {
2390
2480
var data = { } ;
2391
2481
try {
0 commit comments