Source code from the book HTML5 Game Engines