Quellcode durchsuchen

Add int bound method

habeebweeb vor 4 Jahren
Ursprung
Commit
00745719b4
1 geänderte Dateien mit 6 neuen und 0 gelöschten Zeilen
  1. 6 0
      COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

+ 6 - 0
COM3D2.MeidoPhotoStudio.Plugin/MeidoPhotoStudio/Utility.cs

@@ -41,6 +41,12 @@ namespace COM3D2.MeidoPhotoStudio.Plugin
             else return Mathf.Clamp(value, left, right);
         }
 
+        public static int Bound(int value, int left, int right)
+        {
+            if (left > right) return Mathf.Clamp(value, right, left);
+            else return Mathf.Clamp(value, left, right);
+        }
+
         public static Texture2D MakeTex(int width, int height, Color color)
         {
             Color[] colors = new Color[width * height];