Пример #1
0
        /// <summary>
        /// Handle selection change events (when the caret changes the position).
        /// </summary>
        /// <param name="s"></param>
        /// <param name="e"></param>
        private void HandleUpdateUI(object s, UpdateUIEventArgs e)
        {
            // handle selection changed events
            switch (e.Change)
            {
            case UpdateChange.Selection:
                // Update indicators only if the editor is in focus. This
                // is necessary, because they are also used by 'Find & Replace'.
                if (Focused)
                {
                    // get whole words from selections and get ranges from these words
                    var ranges = FindWordRanges(GetWordsFromSelections());
                    // highlight all selected words
                    ClearIndicators(HighlightIndicatorIndex);
                    AddIndicators(HighlightIndicatorIndex, ranges);
                }
                break;

            case UpdateChange.HScroll:
            case UpdateChange.VScroll:
                // call mouse scroll events
                MouseScroll?.Invoke(this, e);
                // update code folding
                UpdateCodeFolding(FirstVisibleLine, LastVisibleLine);
                break;
            }
        }
Пример #2
0
        /// <param name="gameTime">Snapshot of the application's timing values.</param>
        /// <param name="state">Current mouse state.</param>
        /// <summary>
        /// Updates the mouse device.
        /// </summary>
        private void UpdateMouse(MouseState state, GameTime gameTime)
        {
            if ((state.X != mouseState.X) || (state.Y != mouseState.Y))
            {
                var e = new MouseEventArgs();


                var btn = MouseButton.None;
                if (state.LeftButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Left;
                }
                else if (state.RightButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Right;
                }
                else if (state.MiddleButton == ButtonState.Pressed)
                {
                    btn = MouseButton.Middle;
                }
                else if (state.XButton1 == ButtonState.Pressed)
                {
                    btn = MouseButton.XButton1;
                }
                else if (state.XButton2 == ButtonState.Pressed)
                {
                    btn = MouseButton.XButton2;
                }


                BuildMouseEvent(state, btn, ref e);
                if (MouseMove != null)
                {
                    MouseMove.Invoke(this, e);
                }
            }


// Mouse wheel position changed
            if (state.ScrollWheelValue != mouseState.ScrollWheelValue)
            {
                var e         = new MouseEventArgs();
                var direction = state.ScrollWheelValue < mouseState.ScrollWheelValue
                    ? MouseScrollDirection.Down
                    : MouseScrollDirection.Up;


                BuildMouseEvent(state, MouseButton.None, direction, ref e);


                MouseScroll?.Invoke(this, e);
            }


            UpdateButtons(state, gameTime);


            mouseState = state;
        }
Пример #3
0
        private static IntPtr HookCallback(int nCode, IntPtr wParam, IntPtr lParam)
        {
            int intw = (int)wParam;

            if (nCode >= 0 &&
                intw == WM_LBUTTONDOWN || intw == WM_RBUTTONDOWN ||
                intw == WM_LBUTTONUP || intw == WM_RBUTTONUP ||
                intw == WM_MOUSEWHEEL || intw == WM_MOUSEMOVE ||
                intw == WM_MBUTTONDOWN || intw == WM_MBUTTONUP)
            {
                var  hookStruct = Marshal.PtrToStructure <MSLLHOOKSTRUCT>(lParam);
                int  x = hookStruct.pt.x, y = hookStruct.pt.y;
                bool res = true;
                switch ((int)wParam)
                {
                case WM_LBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.LEFT, x, y) ?? true;
                    break;

                case WM_RBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.RIGHT, x, y) ?? true;
                    break;

                case WM_LBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.LEFT, x, y) ?? true;
                    break;

                case WM_RBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.RIGHT, x, y) ?? true;
                    break;

                case WM_MOUSEMOVE:
                    res = MouseMove?.Invoke(MouseEventType.NONE, x, y) ?? true;
                    break;

                case WM_MOUSEWHEEL:
                    res = MouseScroll?.Invoke((int)hookStruct.mouseData > 0 ? MouseScrollType.UP : MouseScrollType.DOWN) ?? true;
                    break;

                case WM_MBUTTONDOWN:
                    res = MouseDown?.Invoke(MouseEventType.WHEEL, x, y) ?? true;
                    break;

                case WM_MBUTTONUP:
                    res = MouseUp?.Invoke(MouseEventType.WHEEL, x, y) ?? true;
                    break;
                }
                if (!res)
                {
                    return((IntPtr)1);
                }
            }
            return(CallNextHookEx(_hookID, nCode, wParam, lParam));
        }
Пример #4
0
        public void UpdateMouse(MouseState state, GameTime gameTime)
        {
            #if (!XBOX && !XBOX_FAKE)
            if ((state.X != mouseState.X) || (state.Y != mouseState.Y))
            {
                MouseEventArgs e = new MouseEventArgs();

                MouseButtons btn = MouseButtons.None;
                if (state.LeftButton == ButtonState.Pressed)
                {
                    btn = MouseButtons.Left;
                }
                else if (state.RightButton == ButtonState.Pressed)
                {
                    btn = MouseButtons.Right;
                }
                else if (state.MiddleButton == ButtonState.Pressed)
                {
                    btn = MouseButtons.Middle;
                }
                else if (state.XButton1 == ButtonState.Pressed)
                {
                    btn = MouseButtons.XButton1;
                }
                else if (state.XButton2 == ButtonState.Pressed)
                {
                    btn = MouseButtons.XButton2;
                }

                BuildMouseEvent(state, btn, ref e);
                if (MouseMove != null)
                {
                    MouseMove.Invoke(this, e);
                }
            }

            if (state.ScrollWheelValue != mouseState.ScrollWheelValue)
            {
                MouseEventArgs       e         = new MouseEventArgs();
                MouseScrollDirection direction = state.ScrollWheelValue < mouseState.ScrollWheelValue ? MouseScrollDirection.Down : MouseScrollDirection.Up;

                BuildMouseEvent(state, MouseButtons.None, direction, ref e);

                if (MouseScroll != null)
                {
                    MouseScroll.Invoke(this, e);
                }
            }

            UpdateButtons(state, gameTime);

            mouseState = state;
            #endif
        }
Пример #5
0
        /// <inheritdoc />
        protected override void OnUpdate(GameTime gameTime)
        {
            _clickCooldown = Math.Max(0, _clickCooldown - (float)gameTime.ElapsedGameTime.TotalSeconds);
            var mouseState = GetMouseState(GameLoop.Window);

            // Handle button events.
            if (Settings.SwapPrimaryMouseButton)
            {
                // Swap right and left click internally so royce is happy lol.
                HandleButtonEvent(mouseState, MouseButton.Left, _lastMouseState.RightButton, mouseState.RightButton);
                HandleButtonEvent(mouseState, MouseButton.Right, _lastMouseState.LeftButton, mouseState.LeftButton);
            }
            else
            {
                HandleButtonEvent(mouseState, MouseButton.Left, _lastMouseState.LeftButton, mouseState.LeftButton);
                HandleButtonEvent(mouseState, MouseButton.Right, _lastMouseState.RightButton, mouseState.RightButton);
            }

            HandleButtonEvent(mouseState, MouseButton.Middle, _lastMouseState.MiddleButton,
                              mouseState.MiddleButton);

            // And now let's do the browser buttons.
            HandleButtonEvent(mouseState, MouseButton.X1, _lastMouseState.XButton1, mouseState.XButton1);
            HandleButtonEvent(mouseState, MouseButton.X2, _lastMouseState.XButton2, mouseState.XButton2);

            // Vertical scrolling.
            if (mouseState.ScrollWheelValue != _lastMouseState.ScrollWheelValue)
            {
                MouseScroll?.Invoke(this, new MouseScrollEventArgs(mouseState, ScrollDirection.Vertical, mouseState.ScrollWheelValue, (mouseState.ScrollWheelValue - _lastMouseState.ScrollWheelValue)));
            }

            // Horizontal scrolling.
            if (mouseState.HorizontalScrollWheelValue != _lastMouseState.HorizontalScrollWheelValue)
            {
                MouseHorizontalScroll?.Invoke(this, new MouseScrollEventArgs(mouseState, ScrollDirection.Horizontal, mouseState.HorizontalScrollWheelValue, (mouseState.HorizontalScrollWheelValue - _lastMouseState.HorizontalScrollWheelValue)));
            }


            // Handle mouse movement.
            if (mouseState.X != _lastMouseState.X || mouseState.Y != _lastMouseState.Y)
            {
                var deltaX = mouseState.X - _lastMouseState.X;
                var deltaY = mouseState.Y - _lastMouseState.Y;

                MouseMove?.Invoke(this, new MouseMoveEventArgs(mouseState, deltaX, deltaY));
            }

            _lastMouseState = mouseState;
        }
    private IntPtr LowLevelMouseCallback(int nCode, IntPtr wParam, IntPtr lParam)
    {
        if (nCode >= 0 && MouseMessages.WM_MOUSEWHEEL == (MouseMessages)wParam)
        {
            var structure = Marshal.PtrToStructure(lParam, typeof(MSLLHOOKSTRUCT));

            if (structure != null)
            {
                var hookStruct = (MSLLHOOKSTRUCT)structure;

                MouseScroll?.Invoke(this, new() { Delta = (int)hookStruct.mouseData });
            }
        }

        return(User32.CallNextHookEx(IntPtr.Zero, nCode, wParam, lParam));
    }
Пример #7
0
        private static void Handle_Mouse_Position(MouseUpdate data)
        {
            var posX = (float)0;
            var posY = (float)0;

            switch (data.Offset)
            {
            case MouseOffset.X:
                posX = mouse.GetCurrentState().X;
                break;

            case MouseOffset.Z:
                MouseScroll?.Invoke(null, new MouseScrollEventArgs(mouse.GetCurrentState().Z));
                break;

            case MouseOffset.Y:
                posY = mouse.GetCurrentState().Y;
                break;
            }

            MousePosition?.Invoke(null, new MousePositionEventArgs(posX, posY));
        }
        /// <summary>
        /// Handling aller Eingaben, Mausbewegungen und Updaten aller Screens und Controls.
        /// </summary>
        /// <param name="gameTime"></param>
        public override void Update(GameTime gameTime)
        {
            if (Game.IsActive)
            {
                #region Mouse Interaction

                if (MouseEnabled)
                {
                    MouseState mouse;
                    Point      mousePosition;
                    if (MouseMode == MouseMode.Captured)
                    {
                        mouse         = Mouse.GetState();
                        mousePosition = new Point(
                            mouse.X - (lastMousePosition.X),
                            mouse.Y - (lastMousePosition.Y));
                    }
                    else
                    {
                        mouse         = Mouse.GetCursorState();
                        mousePosition = Game.Window.PointToClient(mouse.Location);
                    }

                    // Mausposition anhand des Mouse Modes ermitteln



                    MouseEventArgs mouseEventArgs = MouseEventArgsPool.Instance.Take();

                    mouseEventArgs.MouseMode      = MouseMode;
                    mouseEventArgs.GlobalPosition = mousePosition;
                    mouseEventArgs.LocalPosition  = mousePosition;

                    // Mouse Move
                    if (mousePosition != lastMousePosition)
                    {
                        mouseEventArgs.Handled = false;

                        root.InternalMouseMove(mouseEventArgs);
                        if (!mouseEventArgs.Handled)
                        {
                            MouseMove?.Invoke(mouseEventArgs);
                        }

                        // Start Drag Handling
                        if (mouse.LeftButton == ButtonState.Pressed &&
                            DraggingArgs == null)
                        {
                            DraggingArgs = DragEventArgsPool.Instance.Take();
                            DraggingArgs.GlobalPosition = mousePosition;
                            DraggingArgs.LocalPosition  = mousePosition;

                            draggingId = null;

                            root.InternalStartDrag(DraggingArgs);
                            if (!DraggingArgs.Handled)
                            {
                                StartDrag?.Invoke(DraggingArgs);
                            }
                        }

                        // Drop move
                        if (mouse.LeftButton == ButtonState.Pressed &&
                            DraggingArgs != null &&
                            draggingId == null &&
                            DraggingArgs.Handled)
                        {
                            //TODO: perhaps pool single object?
                            DragEventArgs args = DragEventArgsPool.Instance.Take();

                            args.GlobalPosition = mousePosition;
                            args.LocalPosition  = mousePosition;
                            args.Content        = DraggingArgs.Content;
                            args.Icon           = DraggingArgs.Icon;
                            args.Sender         = DraggingArgs.Sender;

                            root.InternalDropMove(args);
                            if (!args.Handled)
                            {
                                DropMove?.Invoke(args);
                            }
                        }
                    }

                    // Linke Maustaste
                    if (mouse.LeftButton == ButtonState.Pressed)
                    {
                        if (!lastLeftMouseButtonPressed)
                        {
                            mouseEventArgs.Handled = false;

                            // Linke Maustaste wurde neu gedrückt
                            root.InternalLeftMouseDown(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                LeftMouseDown?.Invoke(mouseEventArgs);
                            }
                        }
                        lastLeftMouseButtonPressed = true;
                    }
                    else
                    {
                        if (lastLeftMouseButtonPressed)
                        {
                            // Handle Drop
                            if (DraggingArgs != null && DraggingArgs.Handled)
                            {
                                DragEventArgs args = DragEventArgsPool.Instance.Take();
                                args.GlobalPosition = mousePosition;
                                args.LocalPosition  = mousePosition;
                                args.Content        = DraggingArgs.Content;
                                args.Icon           = DraggingArgs.Icon;
                                args.Sender         = DraggingArgs.Sender;

                                root.InternalEndDrop(args);
                                if (!args.Handled)
                                {
                                    EndDrop?.Invoke(args);
                                }
                            }

                            // Discard Dragging Infos
                            DragEventArgsPool.Instance.Release(DraggingArgs);
                            DraggingArgs = null;
                            draggingId   = null;

                            // Linke Maustaste wurde losgelassen
                            mouseEventArgs.Handled = false;

                            root.InternalLeftMouseClick(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                LeftMouseClick?.Invoke(mouseEventArgs);
                            }

                            if (lastLeftClick.HasValue &&
                                gameTime.TotalGameTime - lastLeftClick.Value < TimeSpan.FromMilliseconds(DoubleClickDelay))
                            {
                                // Double Left Click
                                mouseEventArgs.Handled = false;

                                root.InternalLeftMouseDoubleClick(mouseEventArgs);
                                if (!mouseEventArgs.Handled)
                                {
                                    LeftMouseDoubleClick?.Invoke(mouseEventArgs);
                                }

                                lastLeftClick = null;
                            }
                            else
                            {
                                lastLeftClick = gameTime.TotalGameTime;
                            }

                            // Mouse Up
                            mouseEventArgs.Handled = false;

                            root.InternalLeftMouseUp(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                LeftMouseUp?.Invoke(mouseEventArgs);
                            }
                        }
                        lastLeftMouseButtonPressed = false;
                    }

                    // Rechte Maustaste
                    if (mouse.RightButton == ButtonState.Pressed)
                    {
                        if (!lastRightMouseButtonPressed)
                        {
                            // Rechte Maustaste neu gedrückt
                            mouseEventArgs.Handled = false;

                            root.InternalRightMouseDown(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                RightMouseDown?.Invoke(mouseEventArgs);
                            }
                        }
                        lastRightMouseButtonPressed = true;
                    }
                    else
                    {
                        if (lastRightMouseButtonPressed)
                        {
                            // Rechte Maustaste losgelassen
                            mouseEventArgs.Handled = false;
                            root.InternalRightMouseClick(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                RightMouseClick?.Invoke(mouseEventArgs);
                            }

                            if (lastRightClick.HasValue &&
                                gameTime.TotalGameTime - lastRightClick.Value < TimeSpan.FromMilliseconds(DoubleClickDelay))
                            {
                                // Double Left Click
                                mouseEventArgs.Handled = false;

                                root.InternalRightMouseDoubleClick(mouseEventArgs);
                                if (!mouseEventArgs.Handled)
                                {
                                    RightMouseDoubleClick?.Invoke(mouseEventArgs);
                                }

                                lastRightClick = null;
                            }
                            else
                            {
                                lastRightClick = gameTime.TotalGameTime;
                            }

                            mouseEventArgs.Handled = false;

                            root.InternalRightMouseUp(mouseEventArgs);
                            if (!mouseEventArgs.Handled)
                            {
                                RightMouseUp?.Invoke(mouseEventArgs);
                            }
                        }
                        lastRightMouseButtonPressed = false;
                    }

                    // Mousewheel
                    if (lastMouseWheelValue != mouse.ScrollWheelValue)
                    {
                        int diff = (mouse.ScrollWheelValue - lastMouseWheelValue);

                        MouseScrollEventArgs scrollArgs = new MouseScrollEventArgs
                        {
                            MouseMode      = MouseMode,
                            GlobalPosition = mousePosition,
                            LocalPosition  = mousePosition,
                            Steps          = diff
                        };
                        root.InternalMouseScroll(scrollArgs);
                        if (!scrollArgs.Handled)
                        {
                            MouseScroll?.Invoke(scrollArgs);
                        }

                        lastMouseWheelValue = mouse.ScrollWheelValue;
                    }

                    // Potentieller Positionsreset
                    if (MouseMode == MouseMode.Free)
                    {
                        lastMousePosition = mousePosition;
                    }
                    else if (mousePosition.X != 0 || mousePosition.Y != 0)
                    {
                        lastMousePosition = mouse.Location;
                    }

                    MouseEventArgsPool.Instance.Release(mouseEventArgs);
                }

                #endregion

                #region Keyboard Interaction

                if (KeyboardEnabled)
                {
                    KeyboardState keyboard = Keyboard.GetState();

                    bool shift = keyboard.IsKeyDown(Keys.LeftShift) | keyboard.IsKeyDown(Keys.RightShift);
                    bool ctrl  = keyboard.IsKeyDown(Keys.LeftControl) | keyboard.IsKeyDown(Keys.RightControl);
                    bool alt   = keyboard.IsKeyDown(Keys.LeftAlt) | keyboard.IsKeyDown(Keys.RightAlt);

                    KeyEventArgs args;

                    for (int i = 0; i < _pressedKeys.Length; i++)
                    {
                        var key = (Keys)i;
                        if (keyboard.IsKeyDown(key))
                        {
                            // ReSharper disable once CompareOfFloatsByEqualityOperator
                            if (_pressedKeys[i] == UnpressedKeyTimestamp)
                            {
                                // Taste ist neu

                                args = KeyEventArgsPool.Take();

                                args.Key   = key;
                                args.Shift = shift;
                                args.Ctrl  = ctrl;
                                args.Alt   = alt;

                                root.InternalKeyDown(args);

                                if (!args.Handled)
                                {
                                    KeyDown?.Invoke(args);
                                }

                                KeyEventArgsPool.Release(args);

                                args = KeyEventArgsPool.Take();

                                args.Key   = key;
                                args.Shift = shift;
                                args.Ctrl  = ctrl;
                                args.Alt   = alt;

                                root.InternalKeyPress(args);
                                _pressedKeys[i] = gameTime.TotalGameTime.TotalMilliseconds + 500;

                                KeyEventArgsPool.Release(args);

                                // Spezialfall Tab-Taste (falls nicht verarbeitet wurde)
                                if (key == Keys.Tab && !args.Handled)
                                {
                                    if (shift)
                                    {
                                        root.InternalTabbedBackward();
                                    }
                                    else
                                    {
                                        root.InternalTabbedForward();
                                    }
                                }
                            }
                            else
                            {
                                // Taste ist immernoch gedrückt
                                if (_pressedKeys[i] <= gameTime.TotalGameTime.TotalMilliseconds)
                                {
                                    args = KeyEventArgsPool.Take();

                                    args.Key   = key;
                                    args.Shift = shift;
                                    args.Ctrl  = ctrl;
                                    args.Alt   = alt;


                                    root.InternalKeyPress(args);
                                    if (!args.Handled)
                                    {
                                        KeyPress?.Invoke(args);
                                    }

                                    KeyEventArgsPool.Release(args);

                                    _pressedKeys[i] = gameTime.TotalGameTime.TotalMilliseconds + 50;
                                }
                            }
                        }
                        else
                        {
                            // ReSharper disable once CompareOfFloatsByEqualityOperator
                            if (_pressedKeys[i] != UnpressedKeyTimestamp)
                            {
                                // Taste losgelassen
                                args = KeyEventArgsPool.Take();

                                args.Key   = key;
                                args.Shift = shift;
                                args.Ctrl  = ctrl;
                                args.Alt   = alt;

                                root.InternalKeyUp(args);
                                _pressedKeys[i] = UnpressedKeyTimestamp;

                                if (!args.Handled)
                                {
                                    KeyUp?.Invoke(args);
                                }

                                KeyEventArgsPool.Release(args);
                            }
                        }
                    }
                }

                #endregion

                #region Touchpanel Interaction

                //if (TouchEnabled)
                //{
                //    TouchCollection touchPoints = TouchPanel.GetState();
                //    foreach (var touchPoint in touchPoints)
                //    {
                //        Point point = touchPoint.Position.ToPoint();
                //        TouchEventArgs args = new TouchEventArgs()
                //        {
                //            TouchId = touchPoint.Id,
                //            GlobalPosition = point,
                //            LocalPosition = point
                //        };

                //        switch (touchPoint.State)
                //        {
                //            case TouchLocationState.Pressed:
                //                root.InternalTouchDown(args);
                //                if (!args.Handled && TouchDown != null)
                //                    TouchDown(args);
                //                break;
                //            case TouchLocationState.Moved:

                //                // Touch Move
                //                root.InternalTouchMove(args);
                //                if (!args.Handled && TouchMove != null)
                //                    TouchMove(args);

                //                // Start Dragging
                //                if (DraggingArgs == null)
                //                {
                //                    DraggingArgs = new DragEventArgs()
                //                    {
                //                        GlobalPosition = point,
                //                        LocalPosition = point,
                //                    };

                //                    draggingId = touchPoint.Id;

                //                    root.InternalStartDrag(DraggingArgs);
                //                    if (!DraggingArgs.Handled && StartDrag != null)
                //                        StartDrag(DraggingArgs);
                //                }

                //                // Drop move
                //                if (DraggingArgs != null &&
                //                    draggingId == touchPoint.Id &&
                //                    DraggingArgs.Handled)
                //                {
                //                    DragEventArgs moveArgs = new DragEventArgs()
                //                    {
                //                        GlobalPosition = point,
                //                        LocalPosition = point,
                //                        Content = DraggingArgs.Content,
                //                        Icon = DraggingArgs.Icon,
                //                        Sender = DraggingArgs.Sender
                //                    };

                //                    root.InternalDropMove(moveArgs);
                //                    if (!args.Handled && DropMove != null)
                //                        DropMove(moveArgs);
                //                }

                //                break;
                //            case TouchLocationState.Released:

                //                // Handle Drop
                //                if (DraggingArgs != null &&
                //                    draggingId == touchPoint.Id &&
                //                    DraggingArgs.Handled)
                //                {
                //                    DragEventArgs dropArgs = new DragEventArgs()
                //                    {
                //                        GlobalPosition = point,
                //                        LocalPosition = point,
                //                        Content = DraggingArgs.Content,
                //                        Icon = DraggingArgs.Icon,
                //                        Sender = DraggingArgs.Sender
                //                    };

                //                    root.InternalEndDrop(dropArgs);
                //                    if (!args.Handled && EndDrop != null)
                //                        EndDrop(dropArgs);
                //                }

                //                // Discard Dragging Infos
                //                DraggingArgs = null;
                //                draggingId = null;

                //                // Linke Maustaste wurde losgelassen
                //                TouchEventArgs tapArgs = new TouchEventArgs
                //                {
                //                    TouchId = touchPoint.Id,
                //                    GlobalPosition = point,
                //                    LocalPosition = point
                //                };

                //                root.InternalTouchTap(tapArgs);
                //                if (!tapArgs.Handled && TouchTap != null)
                //                    TouchTap(tapArgs);

                //                if (lastTouchTap.HasValue &&
                //                gameTime.TotalGameTime - lastLeftClick.Value < TimeSpan.FromMilliseconds(DoubleClickDelay))
                //                {
                //                    // Double Tap
                //                    TouchEventArgs doubleTapArgs = new TouchEventArgs
                //                    {
                //                        TouchId = touchPoint.Id,
                //                        GlobalPosition = point,
                //                        LocalPosition = point
                //                    };

                //                    root.InternalTouchDoubleTap(doubleTapArgs);
                //                    if (!doubleTapArgs.Handled && TouchDoubleTap != null)
                //                        TouchDoubleTap(doubleTapArgs);

                //                    lastTouchTap = null;
                //                }
                //                else
                //                {
                //                    lastTouchTap = gameTime.TotalGameTime;
                //                }

                //                root.InternalTouchUp(args);
                //                if (!args.Handled && TouchUp != null)
                //                    TouchUp(args);
                //                break;
                //        }
                //    }
                //}

                #endregion
            }

            #region Recalculate Sizes

            if (root.HasInvalidDimensions())
            {
                Point available = new Point(GraphicsDevice.Viewport.Width, GraphicsDevice.Viewport.Height);
                Point required  = root.GetExpectedSize(available);
                root.SetActualSize(available);
            }

            root.Update(gameTime);

            #endregion

            #region Form anpassen


            if (_titleDirty || (ActiveScreen?.Title != _lastActiveScreenTitle))
            {
                string screentitle = ActiveScreen?.Title ?? string.Empty;
                string windowtitle = TitlePrefix + (string.IsNullOrEmpty(screentitle) ? string.Empty : " - " + screentitle);

                if (Game.Window != null && Game.Window.Title != windowtitle)
                {
                    Game.Window.Title = windowtitle;
                }

                _titleDirty            = false;
                _lastActiveScreenTitle = ActiveScreen?.Title;
            }

            #endregion
        }
Пример #9
0
 public void FireMouseScroll(MouseScrollEventArgs e)
 {
     MouseScroll?.Invoke(this, e);
 }
Пример #10
0
 protected void RaiseMouseScroll(object sender, MouseScrollArg e)
 {
     MouseScroll?.Invoke(sender, e);
 }