Exemplo n.º 1
0
 private void InputOnRightMouseButtonReleased(object sender, Blish_HUD.Input.MouseEventArgs e)
 {
     _screenshotPickerActive    = false;
     _magentaPickerActive       = false;
     _runtimeViewerPickerActive = false;
     _controlHighlighter.Hide();
 }
Exemplo n.º 2
0
        private void InputOnLeftMouseButtonReleased(object sender, Blish_HUD.Input.MouseEventArgs e)
        {
            if (_screenshotPickerActive && Control.ActiveControl != null)
            {
                GameService.Graphics.QueueMainThreadRender((graphicsDevice) => {
                    var activeControl  = Control.ActiveControl;
                    var absoluteBounds = activeControl.AbsoluteBounds;

                    var bounds = absoluteBounds.WithPadding(activeControl.Padding);

                    var screenshotTarget = new RenderTarget2D(graphicsDevice,
                                                              GameService.Graphics.SpriteScreen.Width,
                                                              GameService.Graphics.SpriteScreen.Height,
                                                              false,
                                                              graphicsDevice.PresentationParameters.BackBufferFormat,
                                                              DepthFormat.Depth24);

                    graphicsDevice.SetRenderTarget(screenshotTarget);
                    graphicsDevice.Clear(Color.Transparent);

                    using (var screenshotSpriteBatch = new SpriteBatch(graphicsDevice)) {
                        //GameService.Graphics.SpriteScreen.Draw(screenshotSpriteBatch, new Rectangle(Point.Zero, GameService.Graphics.SpriteScreen.Size), new Rectangle(Point.Zero, GameService.Graphics.SpriteScreen.Size));
                        activeControl.Draw(screenshotSpriteBatch, new Rectangle(Point.Zero, activeControl.Size), new Rectangle(Point.Zero, GameService.Graphics.SpriteScreen.Size));
                    }

                    using (var pngStream = new MemoryStream()) {
                        var croppedTarget = screenshotTarget.GetRegion(bounds);

                        croppedTarget.SaveAsPng(pngStream, screenshotTarget.Width, screenshotTarget.Height);
                        pngStream.Seek(0, SeekOrigin.Begin);

                        var sysImg = System.Drawing.Image.FromStream(pngStream);

                        ClipboardUtils.SetClipboardImage(new Bitmap(sysImg), null, null);
                    }

                    ScreenNotification.ShowNotification("Screenshot copied to clipboard!");

                    graphicsDevice.SetRenderTarget(null);
                });

                _screenshotPickerActive = false;
            }
            else if (_magentaPickerActive && Control.ActiveControl != null)
            {
                Control.ActiveControl.BackgroundColor = Color.Magenta;

                _magentaPickerActive = false;
            }
            else if (_runtimeViewerPickerActive && Control.ActiveControl != null)
            {
                _toolboxForm?.SetActiveControl(Control.ActiveControl);

                _runtimeViewerPickerActive = false;
            }

            _controlHighlighter.Hide();
        }
Exemplo n.º 3
0
 private void OnMouseLeft(MouseEventArgs e)
 {
     MouseLeft?.Invoke(this, e);
 }
Exemplo n.º 4
0
 private void OnMouseEntered(MouseEventArgs e)
 {
     MouseEntered?.Invoke(this, e);
 }
Exemplo n.º 5
0
 private void OnRightMouseButtonReleased(MouseEventArgs e)
 {
     RightMouseButtonReleased?.Invoke(this, e);
 }
Exemplo n.º 6
0
 private void OnLeftMouseButtonPressed(MouseEventArgs e)
 {
     LeftMouseButtonPressed?.Invoke(this, e);
 }