Merge branch 'master' of github.com:glenux/wyrian
This commit is contained in:
commit
8696567ae8
4 changed files with 24 additions and 23 deletions
|
@ -1,7 +1,8 @@
|
||||||
var DisplayController = function() {
|
var DisplayController = function() {
|
||||||
|
var that = {};
|
||||||
|
|
||||||
|
that.draw = function() {
|
||||||
this.draw = function() {
|
console.log("draw");
|
||||||
|
|
||||||
};
|
};
|
||||||
|
return that;
|
||||||
};
|
};
|
|
@ -1,26 +1,25 @@
|
||||||
var GameController = function(inputController, displayController) {
|
var GameController = function(inputController, displayController) {
|
||||||
|
var that = {};
|
||||||
|
that._loopRunning = false;
|
||||||
|
that._loop = null;
|
||||||
|
that._inputController = inputController;
|
||||||
|
that._displayController = displayController;
|
||||||
|
|
||||||
this._loopRunning = false;
|
that.start = function() {
|
||||||
this._loop = null;
|
that._loopRunning = true;
|
||||||
this._inputController = inputController;
|
that._loop = setInterval(that.loop, 30);
|
||||||
this._displayController = displayController;
|
|
||||||
|
|
||||||
this.start = function() {
|
|
||||||
this._loopRunning = true;
|
|
||||||
this._loop = setInterval(this.loop, 30);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
this.stop = function() {
|
that.stop = function() {
|
||||||
this._loopRunning = false;
|
that._loopRunning = false;
|
||||||
};
|
};
|
||||||
|
|
||||||
this.loop = function() {
|
that.loop = function() {
|
||||||
this._inputController.observe();
|
that._inputController.observe();
|
||||||
|
|
||||||
// add other stuff here
|
// add other stuff here
|
||||||
|
|
||||||
this._displayController.draw();
|
that._displayController.draw();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
return that;
|
||||||
};
|
};
|
|
@ -1,7 +1,8 @@
|
||||||
var InputController = function() {
|
var InputController = function() {
|
||||||
|
var that = {};
|
||||||
|
|
||||||
this.observe = function() {
|
that.observe = function() {
|
||||||
|
console.log("input");
|
||||||
};
|
};
|
||||||
|
return that;
|
||||||
};
|
};
|
|
@ -1,6 +1,6 @@
|
||||||
var Wyrian = function() {
|
var Wyrian = function() {
|
||||||
// do basic initializations
|
// do basic initializations
|
||||||
|
|
||||||
var inputController = new InputController(),
|
var inputController = new InputController(),
|
||||||
displayController = new DisplayController(),
|
displayController = new DisplayController(),
|
||||||
gameController = new GameController(inputController, displayController);
|
gameController = new GameController(inputController, displayController);
|
Loading…
Reference in a new issue