This commit is contained in:
2026-02-27 11:22:22 -03:00
parent 28f0422771
commit b52b7f4c44
7 changed files with 208 additions and 0 deletions
+13
View File
@@ -13,3 +13,16 @@ export class Camera extends Component {
this.zoom = zoom;
}
}
export function screen_to_world(
screen_x: number,
screen_y: number,
camera: Camera,
screen_width: number,
screen_height: number,
) {
return {
x: (screen_x - screen_width / 2) / camera.zoom + camera.x,
y: (screen_y - screen_height / 2) / camera.zoom + camera.y,
};
}