Mouse input is now feature complete

Mouse input is now fully implemented, with an updated and simpler to to use API

Mouse input is now feature complete

Mouse input is now fully implemented, featuring

  • Support for Left, right, and middle mouse buttons each withdown, up, pressed, and released states
  • Mouse wheel
  • Current position and delta position since the previous frame
  • Option to grab the mouse cursor and keep it inside of the game window
  • Option show or hide the mouse cursor
  • Replacing the cursor with a custom sprite is demonstrated in examples/input_mouse

See demo:

0:00
/0:47

The updated mouse input API is as follows:

# Mouse input API

Mouse.position # Current mouse cursor position (x & y)
Mouse.delta_position # Delta position since the previous frame

Mouse.cursor.show! # Show the mouse cursor
Mouse.cursor.hide! # Hide the mouse cursor

Mouse.cursor.grab! # Force the cursor to stay inside the game window
Mouse.cursor.release! # Allow the cursor to move outside of the window

Mouse.wheel # (x, y)
Mouse.buttons.[left|right|middle].[down?|up?|pressed?|released?]