Skip to content

Commit 1414b77

Browse files
committed
Merge branch 'master' of https://github.com/photonstorm/phaser
2 parents 672a535 + aed8961 commit 1414b77

1 file changed

Lines changed: 231 additions & 10 deletions

File tree

src/boot/Config.js

Lines changed: 231 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -79,16 +79,16 @@ var ValueToColor = require('../display/color/ValueToColor');
7979
* @property {string} [banner.text='#ffffff'] - [description]
8080
* @property {string[]} [banner.background] - [description]
8181
* @property {FPSConfig} [fps] - [description]
82-
* @property {boolean} [antialias=true] - [description]
83-
* @property {boolean} [pixelArt=false] - [description]
84-
* @property {boolean} [autoResize=false] - [description]
85-
* @property {boolean} [roundPixels=false] - [description]
86-
* @property {boolean} [transparent=false] - [description]
87-
* @property {boolean} [clearBeforeRender=true] - [description]
88-
* @property {boolean} [premultipliedAlpha=true] - [description]
89-
* @property {boolean} [preserveDrawingBuffer=false] - [description]
90-
* @property {boolean} [failIfMajorPerformanceCaveat=false] - [description]
91-
* @property {boolean} [powerPreference='default'] - "high-performance", "low-power" or "default"
82+
* @property {boolean} [render.antialias=true] - [description]
83+
* @property {boolean} [render.pixelArt=false] - [description]
84+
* @property {boolean} [render.autoResize=false] - [description]
85+
* @property {boolean} [render.roundPixels=false] - [description]
86+
* @property {boolean} [render.transparent=false] - [description]
87+
* @property {boolean} [render.clearBeforeRender=true] - [description]
88+
* @property {boolean} [render.premultipliedAlpha=true] - [description]
89+
* @property {boolean} [render.preserveDrawingBuffer=false] - [description]
90+
* @property {boolean} [render.failIfMajorPerformanceCaveat=false] - [description]
91+
* @property {string} [render.powerPreference='default'] - "high-performance", "low-power" or "default"
9292
* @property {(string|number)} [backgroundColor=0x000000] - [description]
9393
* @property {object} [callbacks] - [description]
9494
* @property {BootCallback} [callbacks.preBoot=NOOP] - [description]
@@ -130,51 +130,162 @@ var Config = new Class({
130130

131131
var defaultBannerTextColor = '#ffffff';
132132

133+
/**
134+
* @const {(integer|string)} Phaser.Boot.Config#width - [description]
135+
*/
133136
this.width = GetValue(config, 'width', 1024);
137+
138+
/**
139+
* @const {(integer|string)} Phaser.Boot.Config#height - [description]
140+
*/
134141
this.height = GetValue(config, 'height', 768);
142+
143+
/**
144+
* @const {number} Phaser.Boot.Config#zoom - [description]
145+
*/
135146
this.zoom = GetValue(config, 'zoom', 1);
136147

148+
149+
/**
150+
* @const {number} Phaser.Boot.Config#resolution - [description]
151+
*/
137152
this.resolution = GetValue(config, 'resolution', 1);
138153

154+
155+
/**
156+
* @const {number} Phaser.Boot.Config#renderType - [description]
157+
*/
139158
this.renderType = GetValue(config, 'type', CONST.AUTO);
140159

160+
161+
/**
162+
* @const {?*} Phaser.Boot.Config#parent - [description]
163+
*/
141164
this.parent = GetValue(config, 'parent', null);
165+
166+
/**
167+
* @const {?HTMLCanvasElement} Phaser.Boot.Config#canvas - [description]
168+
*/
142169
this.canvas = GetValue(config, 'canvas', null);
170+
171+
/**
172+
* @const {?string} Phaser.Boot.Config#canvasStyle - [description]
173+
*/
143174
this.canvasStyle = GetValue(config, 'canvasStyle', null);
144175

176+
177+
/**
178+
* @const {?object} Phaser.Boot.Config#sceneConfig - [description]
179+
*/
145180
this.sceneConfig = GetValue(config, 'scene', null);
146181

182+
183+
/**
184+
* @const {string[]} Phaser.Boot.Config#seed - [description]
185+
*/
147186
this.seed = GetValue(config, 'seed', [ (Date.now() * Math.random()).toString() ]);
148187

149188
MATH.RND.init(this.seed);
150189

190+
191+
/**
192+
* @const {string} Phaser.Boot.Config#gameTitle - [description]
193+
*/
151194
this.gameTitle = GetValue(config, 'title', '');
195+
196+
/**
197+
* @const {string} Phaser.Boot.Config#gameURL - [description]
198+
*/
152199
this.gameURL = GetValue(config, 'url', 'https://phaser.io');
200+
201+
/**
202+
* @const {string} Phaser.Boot.Config#gameVersion - [description]
203+
*/
153204
this.gameVersion = GetValue(config, 'version', '');
154205

206+
155207
// Input
208+
/**
209+
* @const {boolean} Phaser.Boot.Config#inputKeyboard - [description]
210+
*/
156211
this.inputKeyboard = GetValue(config, 'input.keyboard', true);
212+
213+
/**
214+
* @const {*} Phaser.Boot.Config#inputKeyboardEventTarget - [description]
215+
*/
157216
this.inputKeyboardEventTarget = GetValue(config, 'input.keyboard.target', window);
158217

218+
219+
/**
220+
* @const {(boolean|object)} Phaser.Boot.Config#inputMouse - [description]
221+
*/
159222
this.inputMouse = GetValue(config, 'input.mouse', true);
223+
224+
/**
225+
* @const {?*} Phaser.Boot.Config#inputMouseEventTarget - [description]
226+
*/
160227
this.inputMouseEventTarget = GetValue(config, 'input.mouse.target', null);
228+
229+
/**
230+
* @const {boolean} Phaser.Boot.Config#inputMouseCapture - [description]
231+
*/
161232
this.inputMouseCapture = GetValue(config, 'input.mouse.capture', true);
162233

234+
235+
/**
236+
* @const {boolean} Phaser.Boot.Config#inputTouch - [description]
237+
*/
163238
this.inputTouch = GetValue(config, 'input.touch', true);
239+
240+
/**
241+
* @const {?*} Phaser.Boot.Config#inputTouchEventTarget - [description]
242+
*/
164243
this.inputTouchEventTarget = GetValue(config, 'input.touch.target', null);
244+
245+
/**
246+
* @const {boolean} Phaser.Boot.Config#inputTouchCapture - [description]
247+
*/
165248
this.inputTouchCapture = GetValue(config, 'input.touch.capture', true);
166249

250+
251+
/**
252+
* @const {boolean} Phaser.Boot.Config#inputGamepad - [description]
253+
*/
167254
this.inputGamepad = GetValue(config, 'input.gamepad', false);
168255

256+
257+
/**
258+
* @const {boolean} Phaser.Boot.Config#disableContextMenu - [description]
259+
*/
169260
this.disableContextMenu = GetValue(config, 'disableContextMenu', false);
170261

262+
263+
/**
264+
* @const {any} Phaser.Boot.Config#audio - [description]
265+
*/
171266
this.audio = GetValue(config, 'audio');
172267

268+
173269
// If you do: { banner: false } it won't display any banner at all
270+
/**
271+
* @const {boolean} Phaser.Boot.Config#hideBanner - [description]
272+
*/
174273
this.hideBanner = (GetValue(config, 'banner', null) === false);
175274

275+
276+
/**
277+
* @const {boolean} Phaser.Boot.Config#hidePhaser - [description]
278+
*/
176279
this.hidePhaser = GetValue(config, 'banner.hidePhaser', false);
280+
281+
/**
282+
* @const {string} Phaser.Boot.Config#bannerTextColor - [description]
283+
*/
177284
this.bannerTextColor = GetValue(config, 'banner.text', defaultBannerTextColor);
285+
286+
/**
287+
* @const {string[]} Phaser.Boot.Config#bannerBackgroundColor - [description]
288+
*/
178289
this.bannerBackgroundColor = GetValue(config, 'banner.background', defaultBannerColor);
179290

180291
if (this.gameTitle === '' && this.hidePhaser)
@@ -190,37 +301,92 @@ var Config = new Class({
190301
// deltaHistory: 10
191302
// }
192303

304+
/**
305+
* @const {?FPSConfig} Phaser.Boot.Config#fps - [description]
306+
*/
193307
this.fps = GetValue(config, 'fps', null);
194308

195309
// Renderer Settings
196310
// These can either be in a `render` object within the Config, or specified on their own
197311

198312
var renderConfig = GetValue(config, 'render', config);
199313

314+
/**
315+
* @const {boolean} Phaser.Boot.Config#antialias - [description]
316+
*/
200317
this.antialias = GetValue(renderConfig, 'antialias', true);
318+
319+
/**
320+
* @const {boolean} Phaser.Boot.Config#pixelArt - [description]
321+
*/
201322
this.pixelArt = GetValue(renderConfig, 'pixelArt', false);
323+
324+
/**
325+
* @const {boolean} Phaser.Boot.Config#autoResize - [description]
326+
*/
202327
this.autoResize = GetValue(renderConfig, 'autoResize', false);
328+
329+
/**
330+
* @const {boolean} Phaser.Boot.Config#roundPixels - [description]
331+
*/
203332
this.roundPixels = GetValue(renderConfig, 'roundPixels', false);
333+
334+
/**
335+
* @const {boolean} Phaser.Boot.Config#transparent - [description]
336+
*/
204337
this.transparent = GetValue(renderConfig, 'transparent', false);
338+
339+
/**
340+
* @const {boolean} Phaser.Boot.Config#zoclearBeforeRenderom - [description]
341+
*/
205342
this.clearBeforeRender = GetValue(renderConfig, 'clearBeforeRender', true);
343+
344+
/**
345+
* @const {boolean} Phaser.Boot.Config#premultipliedAlpha - [description]
346+
*/
206347
this.premultipliedAlpha = GetValue(renderConfig, 'premultipliedAlpha', true);
348+
349+
/**
350+
* @const {boolean} Phaser.Boot.Config#preserveDrawingBuffer - [description]
351+
*/
207352
this.preserveDrawingBuffer = GetValue(renderConfig, 'preserveDrawingBuffer', false);
353+
354+
/**
355+
* @const {boolean} Phaser.Boot.Config#failIfMajorPerformanceCaveat - [description]
356+
*/
208357
this.failIfMajorPerformanceCaveat = GetValue(renderConfig, 'failIfMajorPerformanceCaveat', false);
358+
359+
/**
360+
* @const {string} Phaser.Boot.Config#powerPreference - [description]
361+
*/
209362
this.powerPreference = GetValue(renderConfig, 'powerPreference', 'default');
210363

364+
211365
var bgc = GetValue(config, 'backgroundColor', 0);
212366

367+
/**
368+
* @const {Phaser.Display.Color} Phaser.Boot.Config#backgroundColor - [description]
369+
*/
213370
this.backgroundColor = ValueToColor(bgc);
214371

215372
if (bgc === 0 && this.transparent)
216373
{
217374
this.backgroundColor.alpha = 0;
218375
}
219376

377+
220378
// Callbacks
379+
/**
380+
* @const {BootCallback} Phaser.Boot.Config#preBoot - [description]
381+
*/
221382
this.preBoot = GetValue(config, 'callbacks.preBoot', NOOP);
383+
384+
/**
385+
* @const {BootCallback} Phaser.Boot.Config#postBoot - [description]
386+
*/
222387
this.postBoot = GetValue(config, 'callbacks.postBoot', NOOP);
223388

389+
224390
// Physics
225391
// physics: {
226392
// system: 'impact',
@@ -229,27 +395,82 @@ var Config = new Class({
229395
// cellSize: 64
230396
// }
231397

398+
/**
399+
* @const {object} Phaser.Boot.Config#physics - [description]
400+
*/
232401
this.physics = GetValue(config, 'physics', {});
402+
403+
/**
404+
* @const {boolean} Phaser.Boot.Config#defaultPhysicsSystem - [description]
405+
*/
233406
this.defaultPhysicsSystem = GetValue(this.physics, 'default', false);
234407

408+
235409
// Loader Defaults
410+
/**
411+
* @const {string} Phaser.Boot.Config#loaderBaseURL - [description]
412+
*/
236413
this.loaderBaseURL = GetValue(config, 'loader.baseURL', '');
414+
415+
/**
416+
* @const {string} Phaser.Boot.Config#loaderPath - [description]
417+
*/
237418
this.loaderPath = GetValue(config, 'loader.path', '');
419+
420+
/**
421+
* @const {integer} Phaser.Boot.Config#loaderMaxParallelDownloads - [description]
422+
*/
238423
this.loaderMaxParallelDownloads = GetValue(config, 'loader.maxParallelDownloads', 32);
424+
425+
/**
426+
* @const {(string|undefined)} Phaser.Boot.Config#loaderCrossOrigin - [description]
427+
*/
239428
this.loaderCrossOrigin = GetValue(config, 'loader.crossOrigin', undefined);
429+
430+
/**
431+
* @const {string} Phaser.Boot.Config#loaderResponseType - [description]
432+
*/
240433
this.loaderResponseType = GetValue(config, 'loader.responseType', '');
434+
435+
/**
436+
* @const {boolean} Phaser.Boot.Config#loaderAsync - [description]
437+
*/
241438
this.loaderAsync = GetValue(config, 'loader.async', true);
439+
440+
/**
441+
* @const {string} Phaser.Boot.Config#loaderUser - [description]
442+
*/
242443
this.loaderUser = GetValue(config, 'loader.user', '');
444+
445+
/**
446+
* @const {string} Phaser.Boot.Config#loaderPassword - [description]
447+
*/
243448
this.loaderPassword = GetValue(config, 'loader.password', '');
449+
450+
/**
451+
* @const {integer} Phaser.Boot.Config#loaderTimeout - [description]
452+
*/
244453
this.loaderTimeout = GetValue(config, 'loader.timeout', 0);
245454

455+
246456
// Scene Plugins
457+
/**
458+
* @const {any} Phaser.Boot.Config#defaultPlugins - [description]
459+
*/
247460
this.defaultPlugins = GetValue(config, 'plugins', Plugins.DefaultScene);
248461

462+
249463
// Default / Missing Images
250464
var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg';
251465

466+
/**
467+
* @const {string} Phaser.Boot.Config#defaultImage - [description]
468+
*/
252469
this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
470+
471+
/**
472+
* @const {string} Phaser.Boot.Config#missingImage - [description]
473+
*/
253474
this.missingImage = GetValue(config, 'images.missing', pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==');
254475
}
255476

0 commit comments

Comments
 (0)