Exemplo n.º 1
0
        // Called when the map is clicked.
        private void pictureBox_Click(object sender, EventArgs e)
        {
            MouseEventArgs me = (MouseEventArgs)e;

            // LEFT MOUSE BUTTON------------------------------------
            if (me.Button == System.Windows.Forms.MouseButtons.Left)
            {
                // Figure out the location of the click.
                SetMouseLocation(MousePosition.X, MousePosition.Y);

                // Check if erasing is turned on.
                if (isErasing)
                {
                    // Make sure a valid tile was clicked.
                    if (map.ClickedOnTile(currentMouseLocation))
                    {
                        map.GetClickedTile(currentMouseLocation).SetTileImage(map.GetCurrentLayer(), Tile.NO_IMAGE);
                        Refresh();
                    }
                }
                // Check if there is a current image selected. If there is, set the tile to it.
                else if (map.GetImagePalette().GetCurrentImage() != null)
                {
                    // Make sure a valid tile was clicked.
                    if (map.ClickedOnTile(currentMouseLocation))
                    {
                        map.GetClickedTile(currentMouseLocation).SetTileImage(map.GetCurrentLayer(), map.GetImagePalette().GetCurrentImage());
                        Refresh();
                    }
                }
            }

            // RIGHT MOUSE BUTTON-----------------------------------
            if (me.Button == System.Windows.Forms.MouseButtons.Right)
            {
            }
        }