コード例 #1
0
 /// <summary>Converts a rectangle in screen space to simulation space.</summary>
 /// <param name="rectangle">The rectangle.</param>
 /// <returns></returns>
 public static FarRectangle ToSimulationUnits(FarRectangle rectangle)
 {
     rectangle.Inflate(
         -rectangle.Width / 2f * (1f - Util.UnitConversion.SimulationOverScreenRatio),
         -rectangle.Height / 2f * (1f - Util.UnitConversion.SimulationOverScreenRatio));
     return(rectangle);
 }
コード例 #2
0
 /// <summary>Converts a rectangle in simulation space to screen space.</summary>
 /// <param name="rectangle">The rectangle.</param>
 /// <returns></returns>
 public static FarRectangle ToScreenUnits(FarRectangle rectangle)
 {
     rectangle.Inflate(
         rectangle.Width / 2f * (Util.UnitConversion.ScreenOverSimulationRatio - 1f),
         rectangle.Height / 2f * (Util.UnitConversion.ScreenOverSimulationRatio - 1f));
     return(rectangle);
 }