Jump to content

I know what the hearts mean


Noid
 Share

Recommended Posts

(Either I'm the first to notice this or everyone thinks it's so obvious they didn't bother to write a forum post about it :P )

 

When I run my game, I see two red hearts and a gray one next to "Phaser vX.X.X ...". I thought it was just decoration but I noticed in screenshots from other people that sometimes there are three red hearts. So I inspected the piece of code responsible for the output of that line which, with 'pretty print' enabled, reads: 

var a = b.VERSION, c = "Canvas", d = "HTML Audio", e = 1;if (this.renderType === b.WEBGL ? (c = "WebGL", e++) : this.renderType == b.HEADLESS && (c = "Headless"), this.device.webAudio && (d = "WebAudio", e++), this.device.chrome) {                for (var f = ["%c %c %c Phaser v" + a + " - " + c + " - " + d + "  %c %c  http://phaser.io  %c %c ♥%c♥%c♥ ", "background: #0cf300", "background: #00bc17", "color: #ffffff; background: #00711f;", "background: #00bc17", "background: #0cf300", "background: #00bc17"], g = 0; 3 > g; g++)                    f.push(e > g ? "color: #ff2424; background: #fff" : "color: #959595; background: #fff");                console.log.apply(console, f)            }

Notice there is an 'e' variable that starts at 1 and is incremented  when c = WebGL and d = "WebAudio". There is also a loop using a 'g' variable and at the end an f.push line that compares e to g and according to which is greater sets color to #ff2424(red) or #959595(gray).

 

So the meaning of the hearts are: 

♥: Basic functionality

♥♥: Either WebGl or WebAudio enabled

♥♥♥: WebGl and WebAudio enabled

 

That's really cool!

 

Link to comment
Share on other sites

I wondered when someone would bother to dig into the code behind this easter egg :)

The easteregg looks really really ugly in the webstorm console btw :)

(When running from webstorm in chrome, you get alot of weird characters in the webstorm console, but no colors)

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...