private Sdl.Event GetWheelEvent(int delta) { Sdl.Event evt = new Sdl.Event(); evt.Wheel.Which = 0; evt.Wheel.Type = Sdl.EventType.MouseWheel; evt.Wheel.Y = delta; evt.Type = Sdl.EventType.MouseWheel; return(evt); }
protected override void OnMouseUp(MouseEventArgs e) { try { if (!designMode) { Sdl.Event evt = GetButtonEvent(ConvertMouseButtons(e), false, (short)e.X, (short)e.Y); Sdl.PushEvent(out evt); } } catch { } base.OnMouseUp(e); }
protected override void OnMouseMove(MouseEventArgs e) { try { if (!designMode) { Sdl.Event evt = GetMotionEvent(ConvertMouseButtons(e), false, (short)e.X, (short)e.Y, (short)(e.X - lastX), (short)(e.Y - lastY)); Sdl.PushEvent(out evt); } } catch { } base.OnMouseMove(e); }
protected override void OnKeyUp(KeyEventArgs e) { if (!_LockKeyboardInput) { try { if (!designMode) { Sdl.Event evt = GetKeyEvent((SDLK.Key)Enum.Parse(typeof(SDLK.Key), e.KeyCode.ToString()), (SDLK.ModifierKeys)e.Modifiers, false); Sdl.PushEvent(out evt); } } catch { } } base.OnKeyUp(e); }
public Sdl.Event GetKeyEvent(SDLK.Key key, SDLK.ModifierKeys modifierKeys, bool down) { Sdl.Event evt = new Sdl.Event(); evt.Key.Keysym.Scancode = 0; evt.Key.Keysym.Sym = (int)key; evt.Key.Keysym.Mod = (int)modifierKeys; if (down) { evt.Key.State = (byte)SDLB.ButtonKeyState.Pressed; evt.Type = Sdl.EventType.KeyDown; } else { evt.Key.State = (byte)SDLB.ButtonKeyState.NotPressed; evt.Type = Sdl.EventType.KeyUp; } return(evt); }
private Sdl.Event GetButtonEvent(SDLB.MouseButton button, bool buttonPressed, short positionX, short positionY) { Sdl.Event evt = new Sdl.Event(); evt.Button.button = (byte)button; evt.Button.which = 0; evt.Button.x = positionX; evt.Button.y = positionY; if (buttonPressed) { evt.Button.state = (byte)SDLB.ButtonKeyState.Pressed; evt.Type = Sdl.EventType.MouseButtonDown; } else { evt.Button.state = (byte)SDLB.ButtonKeyState.NotPressed; evt.Type = Sdl.EventType.MouseButtonup; } return(evt); }
protected override void OnMouseWheel(MouseEventArgs e) { base.OnMouseWheel(e); if (e.Delta > 0) { OnMouseWheelUpwards?.Invoke(e); } else if (e.Delta < 0) { OnMouseWheelDownwards?.Invoke(e); } try { if (!designMode) { Sdl.Event evt = GetWheelEvent(e.Delta); Sdl.PushEvent(out evt); } } catch { } }
private Sdl.Event GetMotionEvent( SDLB.MouseButton button, bool buttonPressed, short positionX, short positionY, short relativeX, short relativeY) { Sdl.Event evt = new Sdl.Event(); evt.Motion.Xrel = relativeX; evt.Motion.Yrel = relativeY; evt.Motion.Which = (byte)button; evt.Motion.X = positionX; evt.Motion.Y = positionY; evt.Type = Sdl.EventType.MouseMotion; if (buttonPressed) { evt.Motion.State = (byte)SDLB.ButtonKeyState.Pressed; } else { evt.Motion.State = (byte)SDLB.ButtonKeyState.NotPressed; } return(evt); }
public MultiGestureEvent(Sdl.Event evt) : base(evt) { }
public TouchDownEvent(Sdl.Event evt) : base(evt) { }
public ControllerButtonUpEvent(Sdl.Event evt) : base(evt) { }
public JoystickBallEvent(Sdl.Event evt) : base(evt) { }
public TextEditingEvent(Sdl.Event evt) : base(evt) { }
public KeyboardKeyDownEvent(Sdl.Event evt) : base(evt) { }
public DollarGestureEvent(Sdl.Event evt) : base(evt) { }
public UserEvent(Sdl.Event evt) : base(evt) { }
public DropCompleteEvent(Sdl.Event evt) : base(evt) { }
public DropBeginEvent(Sdl.Event evt) : base(evt) { }
public MouseButtonDownEvent(Sdl.Event evt) : base(evt) { }
public MouseButtonUpEvent(Sdl.Event evt) : base(evt) { }
public MouseEvent(Sdl.Event evt) : base(evt) { }
public MouseWheelEvent(Sdl.Event evt) : base(evt) { }
public DropFileEvent(Sdl.Event evt) : base(evt) { }
public JoystickButtonDownEvent(Sdl.Event evt) : base(evt) { }
public JoystickDeviceAddedEvent(Sdl.Event evt) : base(evt) { }
public TouchMoveEvent(Sdl.Event evt) : base(evt) { }
public JoystickHatEvent(Sdl.Event evt) : base(evt) { }
public DropTextEvent(Sdl.Event evt) : base(evt) { }
public ControllerDeviceRemovedEvent(Sdl.Event evt) : base(evt) { }
public ControllerDeviceAddedEvent(Sdl.Event evt) : base(evt) { }