{"size": 1916, "ext": "js", "max_stars_repo_path": "tutorials/tutorial1/game.js", "max_stars_repo_name": "lewisje/renderengine", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "tutorials/tutorial1/game.js", "max_issues_repo_name": "lewisje/renderengine", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "tutorials/tutorial1/game.js", "max_forks_repo_name": "lewisje/renderengine", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.985915493, "max_line_length": 87, "alphanum_fraction": 0.5647181628}
// Load all required engine components
Engine.include("/rendercontexts/context.canvascontext.js");

Engine.initObject("Tutorial1", "Game", function(){

   /**
    * @class Tutorial One.  Render a simple filled rectangle to
    *		 the Canvas context.
    */
   var Tutorial1 = Game.extend({

      constructor: null,

      // The rendering context
      renderContext: null,

      // Engine frames per second
      engineFPS: 15,

      // The play field
      fieldBox: null,
      fieldWidth: 200,
      fieldHeight: 200,

      /**
       * Called to set up the game, download any resources, and initialize
       * the game to its running state.
       */
      setup: function(){
         // Set the FPS of the game
         Engine.setFPS(this.engineFPS);
			
			$("#loading").remove();

         // Create the render context
         this.fieldBox = Rectangle2D.create(0, 0, this.fieldWidth, this.fieldHeight);
         this.renderContext = CanvasContext.create("Playfield",
                                                   this.fieldWidth, this.fieldHeight);
         this.renderContext.setBackgroundColor("black");

         // Add the new rendering context to the default engine context
         Engine.getDefaultContext().add(this.renderContext);
      },

      /**
       * Called when a game is being shut down to allow it to clean up
       * any objects, remove event handlers, destroy the rendering context, etc.
       */
      teardown: function(){
         this.renderContext.destroy();
      },

      /**
       * Return a reference to the render context
       */
      getRenderContext: function(){
         return this.renderContext;
      },

      /**
       * Return a reference to the playfield box
       */
      getFieldBox: function() {
         return this.fieldBox;
      }

   });

   return Tutorial1;

});