GetState() public static method

Retrieves the MouseState for the specified mouse device.
public static GetState ( int index ) : MouseState
index int The index of the mouse device.
return MouseState
Exemplo n.º 1
0
        public static bool IsMouseDown(string button)
        {
            var btn = button.ToLower();

            switch (btn)
            {
            case "left":
                return(Mouse.GetState().LeftButton == ButtonState.Pressed);

            case "right":
                return(Mouse.GetState().RightButton == ButtonState.Pressed);

            case "middle":
                return(Mouse.GetState().MiddleButton == ButtonState.Pressed);
            }
            return(false);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Retrieves the combined hardware <see cref="OpenTK.Input.MouseState"/> for all specified mouse devices.
 /// This method is equivalent to <see cref="OpenTK.Input.Mouse.GetState()"/>.
 /// </summary>
 /// <returns>A <see cref="OpenTK.Input.MouseState"/> structure representing the state for the specified mouse device.</returns>
 /// <seealso cref="OpenTK.Input.Mouse.GetState()"/>
 public MouseState GetState()
 {
     return(Mouse.GetState());
 }
Exemplo n.º 3
0
 /// <summary>
 /// Retrieves the hardware <see cref="OpenTK.Input.MouseState"/> for the specified mouse device.
 /// This method is equivalent to <see cref="OpenTK.Input.Mouse.GetState(int)"/>.
 /// </summary>
 /// <param name="index">The index of the mouse device.</param>
 /// <returns>A <see cref="OpenTK.Input.MouseState"/> structure representing the state for the specified mouse device.</returns>
 /// <seealso cref="OpenTK.Input.Mouse.GetState(int)"/>
 public MouseState GetState(int index)
 {
     return(Mouse.GetState(index));
 }