Exemple #1
0
 public static Coords coordsXY(int x, int y, int width, int height)
 {
     Coords coords = new Coords (x, y, width, height);
     if (!(coords.isValid ())) {
         String msg = coords.ToString () + " invalid due to max width of " + width + " and max height of " + height;
         throw new ArgumentException (msg);
     }
     return coords;
 }
Exemple #2
0
 public static Coords coordsTileNum(int width, int height, int tileNum)
 {
     int y = (int)Math.Floor ((double)(tileNum / width));
     int x = tileNum % width;
     Coords coords = new Coords (x, y, width, height);
     if (!(coords.isValid ())) {
         String msg = coords.ToString () + " invalid due to max width of " + width + " and max height of " + height;
         throw new ArgumentException(msg);
     }
     return coords;
 }