forked from phaserjs/phaser
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDebugHeader.js
More file actions
91 lines (68 loc) · 2.1 KB
/
Copy pathDebugHeader.js
File metadata and controls
91 lines (68 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
/**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2016 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
var CONST = require('../const');
var CHECKSUM = require('../checksum');
var DebugHeader = function (game)
{
var config = game.config;
if (config.hideBanner)
{
return;
}
var renderType = (config.renderType === CONST.CANVAS) ? 'Canvas' : 'WebGL';
var ie = false;
if (!ie)
{
var c = '';
var args = [ c ];
if (Array.isArray(config.bannerBackgroundColor))
{
var lastColor;
config.bannerBackgroundColor.forEach(function (color)
{
c = c.concat('%c ');
args.push('background: ' + color);
lastColor = color;
});
// inject the text color
args[args.length - 1] = 'color: ' + config.bannerTextColor + '; background: ' + lastColor;
}
else
{
c = c.concat('%c ');
args.push('color: ' + config.bannerTextColor + '; background: ' + config.bannerBackgroundColor);
}
// URL link background color (always white)
args.push('background: #fff');
if (config.gameTitle)
{
c = c.concat(config.gameTitle);
if (config.gameVersion)
{
c = c.concat(' v' + config.gameVersion);
}
if (!config.hidePhaser)
{
c = c.concat(' / ');
}
}
if (!config.hidePhaser)
{
c = c.concat('Phaser v' + CONST.VERSION + ' (' + renderType + ')');
}
c = c.concat(' %c ' + config.gameURL);
// Inject the new string back into the args array
args[0] = c;
console.log.apply(console, args);
}
else if (window['console'])
{
console.log('Phaser v' + CONST.VERSION + ' / http://phaser.io');
}
// Keep this during dev build only
console.log(CHECKSUM.build);
};
module.exports = DebugHeader;