Skip to content

Commit fe748e9

Browse files
committed
- wrote dot-notated config properties as seperate typedefs
- add some missing properties
1 parent c944049 commit fe748e9

1 file changed

Lines changed: 84 additions & 36 deletions

File tree

src/boot/Config.js

Lines changed: 84 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,50 @@ var ValueToColor = require('../display/color/ValueToColor');
2626
* @param {Phaser.Game} game - [description]
2727
*/
2828

29+
/**
30+
* @typedef {object} InputConfig
31+
*
32+
* @property {(boolean|KeyboardInputConfig)} [keyboard=true] - [description]
33+
* @property {(boolean|MouseInputConfig)} [mouse=true] - [description]
34+
* @property {(boolean|TouchInputConfig)} [touch=true] - [description]
35+
* @property {(boolean|GamepadInputConfig)} [gamepad=false] - [description]
36+
* @property {integer} [activePointers=1] - [description]
37+
*/
38+
39+
/**
40+
* @typedef {object} MouseInputConfig
41+
*
42+
* @property {*} [target=null] - [description]
43+
* @property {boolean} [capture=true] - [description]
44+
*/
45+
46+
/**
47+
* @typedef {object} KeyboardInputConfig
48+
*
49+
* @property {*} [target=window] - [description]
50+
*/
51+
52+
/**
53+
* @typedef {object} TouchInputConfig
54+
*
55+
* @property {*} [target=null] - [description]
56+
* @property {boolean} [capture=true] - [description]
57+
*/
58+
59+
/**
60+
* @typedef {object} GamepadInputConfig
61+
*
62+
* @property {*} [target=window] - [description]
63+
*/
64+
65+
/**
66+
* @typedef {object} BannerConfig
67+
*
68+
* @property {boolean} [hidePhaser=false] - [description]
69+
* @property {string} [text='#ffffff'] - [description]
70+
* @property {string[]} [background] - [description]
71+
*/
72+
2973
/**
3074
* @typedef {object} FPSConfig
3175
*
@@ -36,6 +80,22 @@ var ValueToColor = require('../display/color/ValueToColor');
3680
* @property {integer} [panicMax=120] - [description]
3781
*/
3882

83+
/**
84+
* @typedef {object} RenderConfig
85+
*
86+
* @property {boolean} [antialias=true] - [description]
87+
* @property {boolean} [pixelArt=false] - [description]
88+
* @property {boolean} [autoResize=false] - [description]
89+
* @property {boolean} [roundPixels=false] - [description]
90+
* @property {boolean} [transparent=false] - [description]
91+
* @property {boolean} [clearBeforeRender=true] - [description]
92+
* @property {boolean} [premultipliedAlpha=true] - [description]
93+
* @property {boolean} [preserveDrawingBuffer=false] - [description]
94+
* @property {boolean} [failIfMajorPerformanceCaveat=false] - [description]
95+
* @property {string} [powerPreference='default'] - "high-performance", "low-power" or "default"
96+
* @property {integer} [batchSize=2000] - The default WebGL batch size.
97+
*/
98+
3999
/**
40100
* @typedef {object} ScaleConfig
41101
*
@@ -51,6 +111,13 @@ var ValueToColor = require('../display/color/ValueToColor');
51111
* @property {integer} [maxHeight] - The maximum height the canvas can be scaled up to.
52112
*/
53113

114+
/**
115+
* @typedef {object} CallbacksConfig
116+
*
117+
* @property {BootCallback} [preBoot=NOOP] - [description]
118+
* @property {BootCallback} [postBoot=NOOP] - [description]
119+
*/
120+
54121
/**
55122
* @typedef {object} LoaderConfig
56123
*
@@ -72,9 +139,16 @@ var ValueToColor = require('../display/color/ValueToColor');
72139
* @property {boolean} [behindCanvas=false] - Place the DOM Container behind the Phaser Canvas. The default is to place it over the Canvas.
73140
*/
74141

75-
/**
142+
/**
143+
* @typedef {object} ImagesConfig
144+
*
145+
* @property {string} [default] - [description]
146+
* @property {string} [missing] - [description]
147+
*/
148+
149+
/**
76150
* @typedef {object} PluginObjectItem
77-
*
151+
*
78152
* @property {string} [key] - [description]
79153
* @property {*} [plugin] - [description]
80154
* @property {boolean} [start] - [description]
@@ -83,9 +157,9 @@ var ValueToColor = require('../display/color/ValueToColor');
83157
* @property {*} [data] - [description]
84158
*/
85159

86-
/**
160+
/**
87161
* @typedef {object} PluginObject
88-
*
162+
*
89163
* @property {PluginObjectItem[]} [global=null] - [description]
90164
* @property {PluginObjectItem[]} [scene=null] - [description]
91165
* @property {Array} [default=[]] - [description]
@@ -110,42 +184,16 @@ var ValueToColor = require('../display/color/ValueToColor');
110184
* @property {string} [url='http://phaser.io'] - [description]
111185
* @property {string} [version=''] - [description]
112186
* @property {boolean} [autoFocus=true] - Automatically call window.focus() when the game boots.
113-
* @property {(boolean|object)} [input] - [description]
114-
* @property {boolean} [input.keyboard=true] - [description]
115-
* @property {*} [input.keyboard.target=window] - [description]
116-
* @property {(boolean|object)} [input.mouse=true] - [description]
117-
* @property {*} [input.mouse.target=null] - [description]
118-
* @property {boolean} [input.touch=true] - [description]
119-
* @property {integer} [input.activePointers=1] - [description]
120-
* @property {*} [input.touch.target=null] - [description]
121-
* @property {boolean} [input.touch.capture=true] - [description]
122-
* @property {(boolean|object)} [input.gamepad=false] - [description]
187+
* @property {(boolean|InputConfig)} [input] - [description]
123188
* @property {boolean} [disableContextMenu=false] - [description]
124-
* @property {(boolean|object)} [banner=false] - [description]
125-
* @property {boolean} [banner.hidePhaser=false] - [description]
126-
* @property {string} [banner.text='#ffffff'] - [description]
127-
* @property {string[]} [banner.background] - [description]
189+
* @property {(boolean|BannerConfig)} [banner=false] - [description]
128190
* @property {DOMContainerConfig} [dom] - The DOM Container configuration object.
129191
* @property {FPSConfig} [fps] - [description]
130-
* @property {boolean} [render.antialias=true] - [description]
131-
* @property {boolean} [render.pixelArt=false] - [description]
132-
* @property {boolean} [render.autoResize=false] - [description]
133-
* @property {boolean} [render.roundPixels=false] - [description]
134-
* @property {boolean} [render.transparent=false] - [description]
135-
* @property {boolean} [render.clearBeforeRender=true] - [description]
136-
* @property {boolean} [render.premultipliedAlpha=true] - [description]
137-
* @property {boolean} [render.preserveDrawingBuffer=false] - [description]
138-
* @property {boolean} [render.failIfMajorPerformanceCaveat=false] - [description]
139-
* @property {string} [render.powerPreference='default'] - "high-performance", "low-power" or "default"
140-
* @property {integer} [render.batchSize=2000] - The default WebGL batch size.
192+
* @property {RenderConfig} [render] - [description]
141193
* @property {(string|number)} [backgroundColor=0x000000] - [description]
142-
* @property {object} [callbacks] - [description]
143-
* @property {BootCallback} [callbacks.preBoot=NOOP] - [description]
144-
* @property {BootCallback} [callbacks.postBoot=NOOP] - [description]
194+
* @property {CallbacksConfig} [callbacks] - [description]
145195
* @property {LoaderConfig} [loader] - [description]
146-
* @property {object} [images] - [description]
147-
* @property {string} [images.default] - [description]
148-
* @property {string} [images.missing] - [description]
196+
* @property {ImagesConfig} [images] - [description]
149197
* @property {object} [physics] - [description]
150198
* @property {PluginObject|PluginObjectItem[]} [plugins] - [description]
151199
*/
@@ -619,7 +667,7 @@ var Config = new Class({
619667
* @const {string} Phaser.Boot.Config#defaultImage - [description]
620668
*/
621669
this.defaultImage = GetValue(config, 'images.default', pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==');
622-
670+
623671
/**
624672
* @const {string} Phaser.Boot.Config#missingImage - [description]
625673
*/

0 commit comments

Comments
 (0)