Ejemplo n.º 1
0
            public void EnqueueState(InputState state)
            {
                if (state.Mouse is MouseState ms)
                {
                    lastMouseState = ms;
                }

                PendingStates.Enqueue(state);
            }
Ejemplo n.º 2
0
            public void Click(MouseButton button)
            {
                var mouseState = new MouseState {
                    Position = lastMousePosition
                };

                mouseState.SetPressed(button, true);

                PendingStates.Enqueue(new InputState {
                    Mouse = mouseState
                });

                mouseState = (MouseState)mouseState.Clone();
                mouseState.SetPressed(button, false);

                PendingStates.Enqueue(new InputState {
                    Mouse = mouseState
                });
            }
Ejemplo n.º 3
0
            protected override void TransformState(InputState state)
            {
                base.TransformState(state);

                MouseState mouse = (MouseState)state.Mouse;

                foreach (Key k in state.Keyboard.Keys)
                {
                    switch (k)
                    {
                    case Key.Z:
                        mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
                        break;

                    case Key.X:
                        mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
                        break;
                    }
                }
            }
Ejemplo n.º 4
0
Archivo: Player.cs Proyecto: fystir/osu
            protected override void TransformState(InputState state)
            {
                base.TransformState(state);

                MouseState mouse = (MouseState)state.Mouse;

                if (state.Keyboard != null)
                {
                    leftViaKeyboard  = state.Keyboard.Keys.Contains(Key.Z);
                    rightViaKeyboard = state.Keyboard.Keys.Contains(Key.X);
                }

                if (state.Mouse != null)
                {
                    if (leftViaKeyboard)
                    {
                        mouse.ButtonStates.Find(s => s.Button == MouseButton.Left).State = true;
                    }
                    if (rightViaKeyboard)
                    {
                        mouse.ButtonStates.Find(s => s.Button == MouseButton.Right).State = true;
                    }
                }
            }