public void Apply(InputState state, IInputStateChangeHandler handler)
 {
     var mouse = state.Mouse;
     if (Delta != Vector2.Zero)
     {
         var lastScroll = mouse.Scroll;
         mouse.Scroll += Delta;
         handler.HandleInputStateChange(new MouseScrollChangeEvent(state, this, lastScroll, IsPrecise));
     }
 }
Example #2
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            var mouse = state.Mouse;

            if (mouse.IsPositionValid && Delta != Vector2.Zero)
            {
                var lastPosition = mouse.Position;
                mouse.Position += Delta;
                handler.HandleInputStateChange(new MousePositionChangeEvent(state, this, lastPosition));
            }
        }
Example #3
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            var mouse = state.Mouse;

            if (!mouse.IsPositionValid || mouse.Position != Position)
            {
                mouse.IsPositionValid = true;
                mouse.LastPosition    = mouse.Position;
                mouse.Position        = Position;
                handler.HandleMousePositionChange(state);
            }
        }
Example #4
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            var mouse = state.Mouse;

            if (Delta != Vector2.Zero)
            {
                mouse.LastScroll       = mouse.Scroll;
                mouse.Scroll          += Delta;
                mouse.HasPreciseScroll = IsPrecise;
                handler.HandleMouseScrollChange(state);
            }
        }
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            foreach (var a in Axes)
            {
                // Not enough movement, don't fire event
                if (Precision.AlmostEquals(state.Joystick.AxesValues[(int)a.Source], a.Value))
                {
                    continue;
                }

                var lastValue = state.Joystick.AxesValues[(int)a.Source];
                state.Joystick.AxesValues[(int)a.Source] = a.Value;
                handler.HandleInputStateChange(new JoystickAxisChangeEvent(state, this, a, lastValue));
            }
        }
Example #6
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            foreach (var a in Axes)
            {
                float oldValue = state.Joystick.AxesValues[(int)a.Source];

                // Not enough movement, don't fire event (unless returning to zero).
                if (oldValue == a.Value || (a.Value != 0 && Precision.AlmostEquals(oldValue, a.Value)))
                {
                    continue;
                }

                state.Joystick.AxesValues[(int)a.Source] = a.Value;
                handler.HandleInputStateChange(new JoystickAxisChangeEvent(state, this, a, oldValue));
            }
        }
Example #7
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            var mouse = state.Mouse;

            if (Delta != Vector2.Zero)
            {
                if (!IsPrecise && Delta.X == 0 && state.Keyboard.ShiftPressed)
                {
                    Delta = new Vector2(Delta.Y, 0);
                }

                var lastScroll = mouse.Scroll;
                mouse.Scroll    += Delta;
                mouse.LastSource = this;
                handler.HandleInputStateChange(new MouseScrollChangeEvent(state, this, lastScroll, IsPrecise));
            }
        }
Example #8
0
        public void Apply(InputState state, IInputStateChangeHandler handler)
        {
            if (!(state is IMicrophoneInputState microphoneInputState))
            {
                throw new NotMicrophoneInputStateException();
            }

            var microphone = microphoneInputState.Microphone;

            if (microphone.Voice == Voice)
            {
                return;
            }

            var lastVoice = microphone.Voice;

            microphone.Voice = Voice;
            handler.HandleInputStateChange(new MicrophoneVoiceChangeEvent(state, this, lastVoice));
        }
Example #9
0
 public void Apply(InputState state, IInputStateChangeHandler handler)
 {
     handler.HandleCustomInput(state, this);
 }
Example #10
0
 public void Apply(InputState state, IInputStateChangeHandler handler)
 {
     handler.HandleInputStateChange(new ReplayStatisticsFrameEvent(state, this, Frame));
 }