mirror of
https://github.com/logsol/chuck.js.git
synced 2026-05-11 18:47:35 +00:00
improved the view management
This commit is contained in:
parent
3d1e729650
commit
067114eaf5
8 changed files with 174 additions and 211 deletions
69
app/Game/Client/View/Views/AbstractView.js
Normal file
69
app/Game/Client/View/Views/AbstractView.js
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
define([
|
||||
"Game/Client/View/DomController",
|
||||
"Game/Config/Settings"
|
||||
],
|
||||
|
||||
function (DomController, Settings) {
|
||||
|
||||
function AbstractView () {
|
||||
this.me = null;
|
||||
this.canvas = null;
|
||||
}
|
||||
|
||||
AbstractView.prototype.isWebGlEnabled = function () {
|
||||
try {
|
||||
return !! window.WebGLRenderingContext && !! document.createElement( 'canvas' ).getContext( 'experimental-webgl' );
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
AbstractView.prototype.setCanvas = function (canvas) {
|
||||
|
||||
this.canvas = canvas;
|
||||
DomController.setCanvas(canvas);
|
||||
|
||||
if(Settings.DEBUG_MODE) {
|
||||
DomController.createDebugCanvas();
|
||||
}
|
||||
}
|
||||
|
||||
AbstractView.prototype.loadPlayerMesh = function(player) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
};
|
||||
|
||||
AbstractView.prototype.loadMeshes = function(objects) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
};
|
||||
|
||||
AbstractView.prototype.render = function () {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
}
|
||||
|
||||
AbstractView.prototype.createMesh = function (width, height, x, y, imgPath, callback) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
}
|
||||
|
||||
AbstractView.prototype.setMe = function(player) {
|
||||
this.me = player;
|
||||
};
|
||||
|
||||
AbstractView.prototype.addPlayer = function(player) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
};
|
||||
|
||||
AbstractView.prototype.removPlayer = function(player) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
};
|
||||
|
||||
AbstractView.prototype.setCameraPosition = function (x, y) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
}
|
||||
|
||||
AbstractView.prototype.setCameraZoom = function (z) {
|
||||
throw new Exception('Abstract Function not overwritten ' + arguments.callee.toString());
|
||||
}
|
||||
|
||||
|
||||
return AbstractView;
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue