Beispiel #1
0
        public KeyboardSDL(InputSourceSDL source, Window window)
        {
            Source      = source;
            this.window = window;
            this.window.KeyDownActions     += OnKeyEvent;
            this.window.KeyUpActions       += OnKeyEvent;
            this.window.TextInputActions   += OnTextInputActions;
            this.window.TextEditingActions += OnTextEditingActions;

            Id = InputDeviceUtils.DeviceNameToGuid(window.SdlHandle.ToString() + Name);
        }
Beispiel #2
0
        public PointerSDL(InputSourceSDL source, Window uiControl)
        {
            Source         = source;
            this.uiControl = uiControl;

            // Disable Touch-Mouse synthesis
            SDL.SetHint(Sdl.HintTouchMouseEvents, "false");

            uiControl.FingerMoveActions    += OnFingerMoveEvent;
            uiControl.FingerPressActions   += OnFingerPressEvent;
            uiControl.FingerReleaseActions += OnFingerReleaseEvent;

            uiControl.ResizeEndActions += OnSizeChanged;
            OnSizeChanged(new WindowEvent());

            Id = InputDeviceUtils.DeviceNameToGuid(uiControl.SdlHandle.ToString() + Name);
        }
Beispiel #3
0
        /// <summary>
        /// Runs the specified main loop for the specified windows form.
        /// </summary>
        /// <param name="form">The form.</param>
        /// <param name="renderCallback">The rendering callback.</param>
        /// <exception cref="System.ArgumentNullException">form
        /// or
        /// renderCallback</exception>
        public static void Run(Window form, RenderCallback renderCallback)
        {
            if (form == null)
            {
                throw new ArgumentNullException(nameof(form));
            }
            if (renderCallback == null)
            {
                throw new ArgumentNullException(nameof(renderCallback));
            }

            form.Show();
            using (var renderLoop = new SDLMessageLoop(form))
            {
                while (renderLoop.NextFrame())
                {
                    renderCallback();
                }
            }
        }
Beispiel #4
0
 public InputSourceSDL(Window uiControl)
 {
     this.uiControl = uiControl ?? throw new ArgumentNullException(nameof(uiControl));
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="WindowsMessageLoop"/> class.
 /// </summary>
 public SDLMessageLoop(Window control)
 {
     Control = control;
 }
Beispiel #6
0
 /// <summary>
 /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
 /// </summary>
 public void Dispose()
 {
     Control = null;
 }