this.phys = physics.kinematic; this.dir_view2world = function(dir) { return dir.scale(this.zoom); }; this.view2world = function(pos) { var useren = window.rendersize.scale(this.zoom); if (window.mode === window.modetypes.stretch) { pos = pos.scale([window.rendersize.x/window.size.x, window.rendersize.y/window.size.y]); pos = pos.sub(window.rendersize.scale(0.5)); pos = pos.scale(this.zoom); pos = pos.add(this.pos); } if (window.mode === window.modetypes.full) { pos = pos.sub(window.size.scale(0.5)); pos = pos.scale(this.zoom); pos = pos.add(this.pos); } return pos; }; this.world2view = function(pos) { if (window.mode === window.modetypes.stretch) { pos = pos.sub(this.pos); pos = pos.scale(1.0/this.zoom); pos = pos.add(window.rendersize.scale(0.5)); } if (window.mode === window.modetypes.full) { pos = pos.sub(this.pos); pos = pos.scale(1/this.zoom); pos = pos.add(window.size.scale(0.5)); } return pos; }; this.screenright = function() { return this.view2world(window.size).x; } this.screenleft = function() { return this.view2world([0,0]).x; } this.zoom = 1;