/** Pixel coordinates of the center vertically */ public static float Center(nAxis axis) { if (nAxis.X == axis) return (float)Screen.width / 2f; else if (nAxis.Y == axis) return (float)Screen.height / 2f; return 0f; }
/** Special mapping function for screen -> world */ public static float DistanceInWorld(float mm, nAxis axis, nCamera camera) { var height = camera.Native.orthographicSize * 2; var width = camera.Native.GetScreenWidth() / camera.Native.GetScreenHeight() * height; var p = 0f; if (axis == nAxis.X) { p = Distance(mm) / camera.Native.GetScreenWidth() * width; } else if (axis == nAxis.Y) { p = Distance(mm) / camera.Native.GetScreenHeight() * height; } return p; }