basic structure

This commit is contained in:
Arian Glander 2011-02-12 01:35:54 +01:00
parent 6dc7a5485e
commit 9b1ede1772
5 changed files with 47 additions and 16 deletions

View file

@ -9,6 +9,9 @@
<div id="game"><div id="ship"></div></div>
<div id="hud"></div>
<script type="text/javascript" src="js/jquery-1.5.js"></script>
<script type="text/javascript" src="js/wyrian.js"></script>
<script type="text/javascript" src="js/DisplayController.js"></script>
<script type="text/javascript" src="js/InputController.js"></script>
<script type="text/javascript" src="js/GameController.js"></script>
<script type="text/javascript" src="js/Wyrian.js"></script>
</body>
</html>

7
js/DisplayController.js Normal file
View file

@ -0,0 +1,7 @@
var DisplayController = function() {
this.draw = function() {
};
};

26
js/GameController.js Normal file
View file

@ -0,0 +1,26 @@
var GameController = function(inputController, displayController) {
this._loopRunning = false;
this._loop = null;
this._inputController = inputController;
this._displayController = displayController;
this.start = function() {
this._loopRunning = true;
this._loop = setInterval(this.loop, 30);
};
this.stop = function() {
this._loopRunning = false;
};
this.loop = function() {
this._inputController.observe();
// add other stuff here
this._displayController.draw();
};
};

7
js/InputController.js Normal file
View file

@ -0,0 +1,7 @@
var InputController = function() {
this.observe = function() {
};
};

View file

@ -1,21 +1,9 @@
var DisplayController = function() {
};
var InputController = function() {
};
var GameController = function() {
};
var Wyrian = function() {
// do basic initializations
var inputController = new InputController(),
var inputController = new InputController(),
displayController = new DisplayController(),
gameController = new GameController(inputController, displayController);
gameController.start();
}();