public OpenGLRenderer() { var windowCloseDelegate = new Action(() => { NativeDumpDebugInfo(); //Environment.Exit(0); }); var mouseDelegate = new MouseMoveEventHandler(ProcessMouseMoveEvent); var keyboardEvent = new KeyboardEventHandler(ProcessKeyPressedEvent); var mouseDownEvent = new MouseButtonEventHandler(ProcessMouseDownEvent); var mouseUpEvent = new MouseButtonEventHandler(ProcessMouseUpEvent); _unmanaged_references.Add(GCHandle.Alloc(windowCloseDelegate)); _unmanaged_references.Add(GCHandle.Alloc(mouseDelegate)); _unmanaged_references.Add(GCHandle.Alloc(mouseDownEvent)); _unmanaged_references.Add(GCHandle.Alloc(mouseUpEvent)); _unmanaged_references.Add(GCHandle.Alloc(keyboardEvent)); NativeRegisterWindowCloseCallback(windowCloseDelegate); NativeRegisterKeyboardCallback(keyboardEvent); NativeRegisterMouseDownCallback(mouseDownEvent); NativeRegisterMouseMoveCallback(mouseDelegate); NativeRegisterMouseUpCallback(mouseUpEvent); }
static void OnMouseMove(int x, int y) { MouseMoveEventHandler handler = MouseMove; if (handler != null) { handler(x, y); } }
/// <summary> /// Removes a handler for the <see cref="E:TwistedLogik.Ultraviolet.UI.Presentation.Input.Mouse.MouseMove"/> /// attached event from the specified element. /// </summary> /// <param name="element">The element to which to Remove the handler.</param> /// <param name="handler">The handler to remove from the specified element.</param> public static void RemoveMouseMoveHandler(DependencyObject element, MouseMoveEventHandler handler) { Contract.Require(element, nameof(element)); Contract.Require(handler, nameof(handler)); IInputElementHelper.RemoveHandler(element, MouseMoveEvent, handler); }
private static extern void NativeRegisterMouseMoveCallback(MouseMoveEventHandler pHandler);
public static void RemoveMouseMoveEventHandler(MouseMoveEventHandler e) => ModBase.InputManager.RemoveMouseMoveEventHandler(e);