/*jslint plusplus: true, white: true, indent: 2, maxlen: 90 */
/*global $wk$, $app$*/
/**
* @module $wk$
* @author Wolfgang Kowarschick
* @copyright 2013, Wolfgang Kowarschick
* <br/>
* Redistribution and use in source and binary forms, with or without
* modification, are permitted under the terms of the
* Creative Commons License Attribution-NonCommercial-ShareAlike 3.0 Unported
* (CC BY-NC-SA 3.0: http://creativecommons.org/licenses/by-nc-sa/3.0/).
*/
this.$app$ = { game: { snake: {}}};
(function($app$, window, XMLHttpRequest)
{ "use strict";
////////////////////////////////////////////////////////////////////////////////
// "AppSnake"
////////////////////////////////////////////////////////////////////////////////
var INIT_FILE = "json/init.json";
function f_create_game(p_init)
{ var l_app = new $app$.game.snake.AppSnake(p_init);
l_app.startGame();
}
function f_init()
{ var l_xhr = new XMLHttpRequest();
l_xhr.onload = function()
{ f_create_game(JSON.parse(this.response)); };
l_xhr.onerror = function()
{ throw new Error(INIT_FILE + " not found"); };
l_xhr.overrideMimeType("application/json");
l_xhr.open("GET", INIT_FILE, true);
l_xhr.send();
}
window.addEventListener("load", f_init);
////////////////////////////////////////////////////////////////////////////////
// End of "AppSnake"
////////////////////////////////////////////////////////////////////////////////
}(this.$app$, this.window, this.XMLHttpRequest));