basic structure
This commit is contained in:
parent
6dc7a5485e
commit
9b1ede1772
5 changed files with 47 additions and 16 deletions
|
@ -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
7
js/DisplayController.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
var DisplayController = function() {
|
||||
|
||||
|
||||
this.draw = function() {
|
||||
|
||||
};
|
||||
};
|
26
js/GameController.js
Normal file
26
js/GameController.js
Normal 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
7
js/InputController.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
var InputController = function() {
|
||||
|
||||
|
||||
this.observe = function() {
|
||||
|
||||
};
|
||||
};
|
18
js/wyrian.js
18
js/wyrian.js
|
@ -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();
|
||||
}();
|
Loading…
Reference in a new issue