Esempio n. 1
0
        private static void ProcessMouseButtonEvent(Sdl2NativeWindow window, MouseButtonEvent ev)
        {
            bool button_pressed = ev.State == State.Pressed;

            // We need MouseUp events to be reported even if they occur
            // outside the window. CaptureMouse ensures we get them.
            if (!window.is_cursor_grabbed)
            {
                SDL.CaptureMouse(button_pressed);
            }

            MouseButton button = Sdl2Mouse.TranslateButton(ev.Button);

            if (button_pressed)
            {
                window.OnMouseDown(button);
            }
            else
            {
                window.OnMouseUp(button);
            }
        }