| 23 | } |
| 24 | |
| 25 | Vector2 screenToWorld(Point screen_point, Camera camera, ScreenRect screen) { |
| 26 | float x = (float)(((screen_point.x * camera.size.x) / screen.w) + |
| 27 | camera.position.x); |
| 28 | float y = |
| 29 | (float)(((screen_point.y - screen.h) / screen.h) * -1 * +camera.size.y + |
| 30 | camera.position.y); |
| 31 | return Vector2(x, y); |
| 32 | } |
| 33 | |
| 34 | Point worldToTile(Vector2 position, Vector2 size) { |
| 35 | return Point((int)(position.x / size.x), (int)(position.y / size.y)); |