/*jslint plusplus: true, white: true, indent: 2, maxlen: 90 */
/*global $wk$, $app$*/
/**
* @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/).
*/
$wk$(
function()
{ "use strict";
////////////////////////////////////////////////////////////////////////////////
// Class "AppSnake"
////////////////////////////////////////////////////////////////////////////////
// import
var Plane = $app$.game.snake.Plane,
Snake = $app$.game.snake.Snake,
Controller = $app$.game.snake.Controller;
/**
* @class
* @name $app$.game.snake.AppSnake
*
* @param {Object} p_init
* Should contain the attributes
* <code>canvasID</code> (the id of the canvas tag),
* <code>colsNr</code> (the number of columns of the plane),
* <code>rowsNr</code> (the number of rows of the plane),
* <code>item</code> (the initialization object for the items
* that are placed on the plane).
*/
$wk$.WKcClass(
{ name: "$app$.game.snake.AppSnake",
methods:
{ init:
function AppSnake(p_init)
{ var l_plane = new Plane (p_init.plane),
l_snake = new Snake (p_init.snake, l_plane);
this.v_controller = new Controller(p_init.controller, l_plane, l_snake);
},
/**
* Starts the game.
*
* @method
* @name $app$.game.snake.AppSnaker#startGame
*/
startGame:
function(){ this.v_controller.startGame(); }
}
});
////////////////////////////////////////////////////////////////////////////////
// End of Class "AppSnake"
////////////////////////////////////////////////////////////////////////////////
});