struct

Termisu::Event::Mouse

Inherits Struct / Value / Object

Mouse input event.

Contains mouse position, button state, and modifiers. Supports all mouse protocols (X10, Normal, SGR, URXVT).

Example:

event = termisu.poll_event
if event.is_a?(Termisu::Event::Mouse)
  case event.button
  when .left?
    puts "Left click at #{event.x},#{event.y}"
  when .wheel_up?
    puts "Scroll up"
  when .release?
    puts "Button released"
  end
end

Constructors

new(x : Int32, y : Int32, button : Button, modifiers : Input::Modifier = Input::Modifier::None, motion : Bool = false)
Source

Instance methods

alt?

Returns true if Alt modifier was held.

Source
button

Mouse button that triggered the event.

Source
ctrl?

Returns true if Ctrl modifier was held.

Source
meta?

Returns true if Meta/Super/Windows modifier was held.

Source
modifiers

Modifier keys held during the mouse event.

Source
motion?

Whether this is a motion event (mouse moved while button held).

Source
press?

Returns true if this is a button press event.

Source
shift?

Returns true if Shift modifier was held.

Source
wheel?

Returns true if this is a wheel scroll event.

Source
x

X coordinate (column, 1-based).

Source
y

Y coordinate (row, 1-based).

Source

Nested types