CEngineSharp_Editor.Graphics.MapRenderer.tileSetRenderWindow_MouseButtonReleased C# (CSharp) Method

tileSetRenderWindow_MouseButtonReleased() private method

private tileSetRenderWindow_MouseButtonReleased ( object sender, MouseButtonEventArgs e ) : void
sender object
e SFML.Window.MouseButtonEventArgs
return void
        private void tileSetRenderWindow_MouseButtonReleased(object sender, MouseButtonEventArgs e)
        {
            if (e.Button == Mouse.Button.Left)
            {
                Vector2f realPosition = this._tileSetRenderWindow.MapPixelToCoords(new Vector2i(e.X, e.Y));

                int width = (int)(realPosition.X - this._tileSetSelector.Position.X);
                int height = (int)(realPosition.Y - this._tileSetSelector.Position.Y);

                if (width < 0)
                    width -= 32;
                else
                    width += 32;

                if (height < 0)
                    height -= 32;
                else
                    height += 32;

                width = (width / 32) * 32;
                height = (height / 32) * 32;

                this._tileSetSelector.Size = new Vector2f(width, height);

                this._selectedTileSprite = this._selectedTileSprite = new Sprite(this._currentTileSetSprite.Texture, new IntRect((int)_tileSetSelector.Position.X, (int)_tileSetSelector.Position.Y, width, height));
            }
        }