Exemple #1
0
 public Map()
 {
     this.info     = null;
     this.mapping  = new CompressMapping();
     this.tileSize = new Size(0, 0);
     this.width    = 0;
     this.height   = 0;
 }
Exemple #2
0
 public Map()
 {
     this.info     = null;
     this.mapping  = new CompressMapping();
     this.tileSize = new Size(0, 0);
     this.width    = 0;
     this.height   = 0;
 }
        protected static int Search(Pixel[] tile, List <Pixel[]> tiles, Size tileSize,
                                    out bool flipX, out bool flipY)
        {
            // Check if it's already in the list
            int index = Mapable.Search(tile, tiles);

            flipX = false;
            flipY = false;

            // Check flip X
            if (index == -1)
            {
                Pixel[] tileFlipX = (Pixel[])tile.Clone();
                tileFlipX.FlipX(tileSize);
                index = Mapable.Search(tileFlipX, tiles);
                flipX = true;
                flipY = false;

                // Check flip Y
                if (index == -1)
                {
                    Pixel[] tileFlipY = (Pixel[])tile.Clone();
                    tileFlipY.FlipY(tileSize);
                    index = Mapable.Search(tileFlipY, tiles);
                    flipX = false;
                    flipY = true;
                }

                // Check flip X & Y
                if (index == -1)
                {
                    tileFlipX.FlipY(tileSize);
                    index = Mapable.Search(tileFlipX, tiles);
                    flipX = true;
                    flipY = true;
                }
            }

            return(index);
        }