Example #1
0
 public override void OnMouseRightUp(System.Drawing.Point location)
 {
     if (drawing && !drawButton)
     {
         drawing = false;
         drawAction = null;
     }
 }
Example #2
0
        private void setTiles(System.Drawing.Point location, int[] setTo)
        {
            location = LayerEditor.Layer.Definition.ConvertToGrid(location);
            if (!IsValidTileCell(location))
                return;

            // Check to see if all the tiles are already the same.
            int i = 0;
            bool skip = true;
            for (int x = 0; x < this.drawTilesWidth; x += 1)
            {
                for (int y = 0; y < this.drawTilesHeight; y += 1)
                {
                    if (LayerEditor.Layer.Tiles[location.X + x, location.Y + y] != setTo[i])
                    {
                        skip = false;
                        break;
                    }
                    i += 1;
                }
                if (!skip) break;
            }
            if (skip) return;

            // Draw all of the tiles.
            if (drawAction == null)
                LevelEditor.Perform(drawAction = new TileDrawAreaAction(LayerEditor.Layer, location, new System.Drawing.Size(drawTilesWidth, drawTilesHeight), setTo));
            else
                drawAction.DoAgain(location);
        }