prosperon/scripts/camera2d.jso

23 lines
713 B
Plaintext
Raw Normal View History

this.phys = physics.kinematic;
this.dir_view2world = function(dir) { return dir.scale(this.realzoom()); };
2024-03-19 14:39:19 -05:00
this.view2world = function(pos) { return render.view2world(pos); };
this.world2view = function(pos) { return render.world2view(pos); };
this.realzoom = function() { return render.get_zoom(); };
2024-03-19 14:39:19 -05:00
this.right = function() { return this.pos.x + (window.rendersize.x/2); }
2024-03-01 11:45:06 -06:00
2024-03-19 14:39:19 -05:00
this.left = function() { return this.pos.x - (window.rendersize.x/2); }
2024-03-01 11:45:06 -06:00
this.mixin({
get zoom() {
2024-03-18 08:16:25 -05:00
// var z = game.native.y / window.dimensions.y;
2024-03-19 14:39:19 -05:00
return render.get_zoom(); // /z
},
set zoom(x) {
x = Math.clamp(x,0.1,10);
2024-03-18 08:16:25 -05:00
// var z = game.native.y / window.dimensions.y;
// z *= x;
2024-03-19 14:39:19 -05:00
render.add_zoom(x);
},
});