123456789101112131415161718192021222324 |
- import { Point } from "./spatial/Point.js";
- export class Camera {
- constructor(x = 0, y = 0) {
- this.position = new Point(x,y)
- }
- update(delta) {
- }
- drawAtCameraCentered(ctx, drawFunc) {
- ctx.save();
- ctx.translate(-this.position.x + (Global.screenBounds.width / 2), -this.position.y + (Global.screenBounds.height / 2));
- drawFunc(ctx);
- ctx.restore();
- }
- drawAtCamera(ctx, drawFunc) {
- ctx.save();
- ctx.translate(-this.position.x, -this.position.y);
- drawFunc(ctx);
- ctx.restore();
- }
- }
|