Beispiel #1
0
        /// <summary>
        /// "Cements" either a dragged selection or a newly pasted selection.
        /// </summary>
        /// <param name="buffer">The dragged selection or the newly pasted selection.</param>
        public void Defloat(CopyBuffer buffer)
        {
            if (buffer == null)
            {
                return;
            }
            if (overlay.SelectTS.Empty)
            {
                return;
            }
            selection = null;
            int x_ = overlay.SelectTS.X / 16;
            int y_ = overlay.SelectTS.Y / 16;

            for (int y = 0; y < buffer.Height / 16; y++)
            {
                for (int x = 0; x < buffer.Width / 16; x++)
                {
                    if (y + y_ < 0 || y + y_ >= tileset.Height ||
                        x + x_ < 0 || x + x_ >= 16)
                    {
                        continue;
                    }
                    int  index = (y + y_) * 16 + x + x_;
                    Tile tile  = buffer.Tiles[y * (buffer.Width / 16) + x];
                    tileset.Tilesets_tiles[Layer][index]       = tile.Copy();
                    tileset.Tilesets_tiles[Layer][index].Index = index;
                }
            }
            tileset.DrawTileset(tileset.Tilesets_tiles[Layer], tileset.Tilesets_bytes[Layer]);
            tileset.Assemble(16, Layer);
            SetTileSetImage();
            if (autoUpdate.Checked)
            {
                update.DynamicInvoke();
            }
        }
Beispiel #2
0
 // Editor updating
 private void TileUpdate()
 {
     tileset.DrawTileset(tileset.Tileset_tiles, tileset.Tileset_bytes);
     SetWorldMapImage();
 }