altered define paths

This commit is contained in:
logsol 2012-07-21 21:53:44 +02:00
parent ced41c3611
commit 8caaee66de

View file

@ -1,30 +1,29 @@
var requires = [ var requires = [
"Chuck/View/ViewController", "Game/Client/View/ViewController",
"Chuck/Physics/Engine", "Game/Core/Physics/Engine",
"Chuck/Player", "Game/Core/Player",
"Chuck/Control/InputControlUnit", "Game/Client/Control/KeyboardController",
"Chuck/Settings", "Game/Config/Settings",
"Vendor/Box2D", "Game/Core/Loader/Level",
"Chuck/Loader/Level", "Lib/Vendor/Box2D",
"RequestAnimationFrame" "Lib/Utilities/RequestAnimFrame"
]; ];
define(requires, define(requires, function(ViewController, PhysicsEngine, Player, KeyboardController, Settings, Level, Box2D, requestAnimFrame) {
function(ViewController, PhysicsEngine, Player, InputControlUnit, Settings, Box2D, Level, requestAnimFrame) {
function ClientProcessor (clientGame) { function GameController (clientGame) {
this.clientGame = clientGame; this.clientGame = clientGame;
this.init(); this.init();
}; };
ClientProcessor.prototype.init = function() { GameController.prototype.init = function() {
this.viewController = new ViewController(); this.viewController = new ViewController();
this.physicsEngine = new PhysicsEngine(); this.physicsEngine = new PhysicsEngine();
this.update(); this.update();
} }
ClientProcessor.prototype.loadLevel = function(path) { GameController.prototype.loadLevel = function(path) {
if (this.level) { if (this.level) {
this.level.unload(); this.level.unload();
} }
@ -33,15 +32,15 @@ define(requires,
this.level.loadLevelInToEngine(); this.level.loadLevelInToEngine();
} }
ClientProcessor.prototype.getPhysicsEngine = function() { GameController.prototype.getPhysicsEngine = function() {
return this.physicsEngine; return this.physicsEngine;
} }
ClientProcessor.prototype.getMe = function() { GameController.prototype.getMe = function() {
return this.me; return this.me;
} }
ClientProcessor.prototype.update = function() { GameController.prototype.update = function() {
requestAnimFrame(this.update.bind(this)); requestAnimFrame(this.update.bind(this));
@ -49,32 +48,32 @@ define(requires,
this.viewController.update(); this.viewController.update();
if(this.me) { if(this.me) {
this.inputControlUnit.update(); this.KeyboardController.update();
this.me.update(); this.me.update();
} }
} }
ClientProcessor.prototype.destruct = function() { GameController.prototype.destruct = function() {
} }
ClientProcessor.prototype.spawnNewPlayerWithId = function(id) { GameController.prototype.spawnNewPlayerWithId = function(id) {
var player = new Player(this.physicsEngine, id, null); var player = new Player(this.physicsEngine, id, null);
player.spawn(100, 0); player.spawn(100, 0);
this.physicsEngine.setCollisionDetector(player); this.physicsEngine.setCollisionDetector(player);
return player; return player;
} }
ClientProcessor.prototype.spawnMeWithId = function(id) { GameController.prototype.spawnMeWithId = function(id) {
this.me = this.spawnNewPlayerWithId(id); this.me = this.spawnNewPlayerWithId(id);
this.inputControlUnit = new InputControlUnit(this.me, this); this.KeyboardController = new KeyboardController(this.me, this);
} }
ClientProcessor.prototype.sendGameCommand = function(command, options) { GameController.prototype.sendGameCommand = function(command, options) {
this.clientGame.sendGameCommand(command, options); this.clientGame.sendGameCommand(command, options);
} }
ClientProcessor.prototype.processGameCommand = function(command, options) { GameController.prototype.processGameCommand = function(command, options) {
if (command == "worldUpdate") { if (command == "worldUpdate") {
@ -98,5 +97,5 @@ define(requires,
} }
return ClientProcessor; return GameController;
}); });