77var MATH = require ( '../math' ) ;
88var CONST = require ( '../const' ) ;
99var NOOP = require ( '../utils/NOOP' ) ;
10- var GetObjectValue = require ( '../utils/object/GetObjectValue ' ) ;
10+ var GetValue = require ( '../utils/object/GetValue ' ) ;
1111var ValueToColor = require ( '../graphics/color/ValueToColor' ) ;
1212
1313var defaultBannerColor = [
@@ -24,57 +24,57 @@ var Config = function (config)
2424{
2525 if ( config === undefined ) { config = { } ; }
2626
27- this . width = GetObjectValue ( config , 'width' , 1024 ) ;
28- this . height = GetObjectValue ( config , 'height' , 768 ) ;
29- this . zoom = GetObjectValue ( config , 'zoom' , 1 ) ;
27+ this . width = GetValue ( config , 'width' , 1024 ) ;
28+ this . height = GetValue ( config , 'height' , 768 ) ;
29+ this . zoom = GetValue ( config , 'zoom' , 1 ) ;
3030
31- this . resolution = GetObjectValue ( config , 'resolution' , 1 ) ;
31+ this . resolution = GetValue ( config , 'resolution' , 1 ) ;
3232
33- this . renderType = GetObjectValue ( config , 'type' , CONST . AUTO ) ;
33+ this . renderType = GetValue ( config , 'type' , CONST . AUTO ) ;
3434
35- this . parent = GetObjectValue ( config , 'parent' , null ) ;
36- this . canvas = GetObjectValue ( config , 'canvas' , null ) ;
37- this . canvasStyle = GetObjectValue ( config , 'canvasStyle' , null ) ;
35+ this . parent = GetValue ( config , 'parent' , null ) ;
36+ this . canvas = GetValue ( config , 'canvas' , null ) ;
37+ this . canvasStyle = GetValue ( config , 'canvasStyle' , null ) ;
3838
39- this . stateConfig = GetObjectValue ( config , 'state' , null ) ;
39+ this . stateConfig = GetValue ( config , 'state' , null ) ;
4040
41- this . seed = GetObjectValue ( config , 'seed' , [ ( Date . now ( ) * Math . random ( ) ) . toString ( ) ] ) ;
41+ this . seed = GetValue ( config , 'seed' , [ ( Date . now ( ) * Math . random ( ) ) . toString ( ) ] ) ;
4242
4343 MATH . RND . init ( this . seed ) ;
4444
45- this . gameTitle = GetObjectValue ( config , 'title' , '' ) ;
46- this . gameURL = GetObjectValue ( config , 'url' , 'http://phaser.io' ) ;
47- this . gameVersion = GetObjectValue ( config , 'version' , '' ) ;
45+ this . gameTitle = GetValue ( config , 'title' , '' ) ;
46+ this . gameURL = GetValue ( config , 'url' , 'http://phaser.io' ) ;
47+ this . gameVersion = GetValue ( config , 'version' , '' ) ;
4848
4949 // Input
50- this . inputKeyboard = GetObjectValue ( config , 'input.keyboard' , true ) ;
51- this . inputKeyboardEventTarget = GetObjectValue ( config , 'input.keyboard.target' , window ) ;
50+ this . inputKeyboard = GetValue ( config , 'input.keyboard' , true ) ;
51+ this . inputKeyboardEventTarget = GetValue ( config , 'input.keyboard.target' , window ) ;
5252
5353 // If you do: { banner: false } it won't display any banner at all
54- this . hideBanner = ( GetObjectValue ( config , 'banner' , null ) === false ) ;
54+ this . hideBanner = ( GetValue ( config , 'banner' , null ) === false ) ;
5555
56- this . hidePhaser = GetObjectValue ( config , 'banner.hidePhaser' , false ) ;
57- this . bannerTextColor = GetObjectValue ( config , 'banner.text' , defaultBannerTextColor ) ;
58- this . bannerBackgroundColor = GetObjectValue ( config , 'banner.background' , defaultBannerColor ) ;
56+ this . hidePhaser = GetValue ( config , 'banner.hidePhaser' , false ) ;
57+ this . bannerTextColor = GetValue ( config , 'banner.text' , defaultBannerTextColor ) ;
58+ this . bannerBackgroundColor = GetValue ( config , 'banner.background' , defaultBannerColor ) ;
5959
60- this . fps = GetObjectValue ( config , 'fps' , 60 ) ;
61- this . forceSetTimeOut = GetObjectValue ( config , 'forceSetTimeOut' , false ) ;
60+ this . fps = GetValue ( config , 'fps' , 60 ) ;
61+ this . forceSetTimeOut = GetValue ( config , 'forceSetTimeOut' , false ) ;
6262
63- this . pixelArt = GetObjectValue ( config , 'pixelArt' , false ) ;
64- this . transparent = GetObjectValue ( config , 'transparent' , false ) ;
65- this . clearBeforeRender = GetObjectValue ( config , 'clearBeforeRender' , true ) ;
66- this . backgroundColor = ValueToColor ( GetObjectValue ( config , 'backgroundColor' , 0 ) ) ;
67- this . preserveDrawingBuffer = ValueToColor ( GetObjectValue ( config , 'preserveDrawingBuffer' , false ) ) ;
63+ this . pixelArt = GetValue ( config , 'pixelArt' , false ) ;
64+ this . transparent = GetValue ( config , 'transparent' , false ) ;
65+ this . clearBeforeRender = GetValue ( config , 'clearBeforeRender' , true ) ;
66+ this . backgroundColor = ValueToColor ( GetValue ( config , 'backgroundColor' , 0 ) ) ;
67+ this . preserveDrawingBuffer = ValueToColor ( GetValue ( config , 'preserveDrawingBuffer' , false ) ) ;
6868
6969 // Callbacks
70- this . preBoot = GetObjectValue ( config , 'callbacks.preBoot' , NOOP ) ;
71- this . postBoot = GetObjectValue ( config , 'callbacks.postBoot' , NOOP ) ;
70+ this . preBoot = GetValue ( config , 'callbacks.preBoot' , NOOP ) ;
71+ this . postBoot = GetValue ( config , 'callbacks.postBoot' , NOOP ) ;
7272
7373 // Default / Missing Images
7474 var pngPrefix = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAg' ;
7575
76- this . defaultImage = GetObjectValue ( config , 'images.default' , pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==' ) ;
77- this . missingImage = GetObjectValue ( config , 'images.missing' , pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==' ) ;
76+ this . defaultImage = GetValue ( config , 'images.default' , pngPrefix + 'AQMAAABJtOi3AAAAA1BMVEX///+nxBvIAAAAAXRSTlMAQObYZgAAABVJREFUeF7NwIEAAAAAgKD9qdeocAMAoAABm3DkcAAAAABJRU5ErkJggg==' ) ;
77+ this . missingImage = GetValue ( config , 'images.missing' , pngPrefix + 'CAIAAAD8GO2jAAAAGXRFWHRTb2Z0d2FyZQBBZG9iZSBJbWFnZVJlYWR5ccllPAAAAJ9JREFUeNq01ssOwyAMRFG46v//Mt1ESmgh+DFmE2GPOBARKb2NVjo+17PXLD8a1+pl5+A+wSgFygymWYHBb0FtsKhJDdZlncG2IzJ4ayoMDv20wTmSMzClEgbWYNTAkQ0Z+OJ+A/eWnAaR9+oxCF4Os0H8htsMUp+pwcgBBiMNnAwF8GqIgL2hAzaGFFgZauDPKABmowZ4GL369/0rwACp2yA/ttmvsQAAAABJRU5ErkJggg==' ) ;
7878} ;
7979
8080Config . prototype . constructor = Config ;
0 commit comments