Adds support for HiDPI (Retina) screens

The game was pretty blurry on a Retina Macbook Pro, so I added in context scaling. Looks great now! I also moved the code into it's own JS file.