Crops !
This commit is contained in:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user