struct
Termisu::Event::Mouse
- Termisu::Event::Mouse
- Struct
- Value
- Object
Overview
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
Defined in:
termisu/event/mouse.crConstructors
Instance Method Summary
-
#alt? : Bool
Returns true if Alt modifier was held.
-
#button : MouseButton
Mouse button that triggered the event.
-
#ctrl? : Bool
Returns true if Ctrl modifier was held.
-
#meta? : Bool
Returns true if Meta/Super/Windows modifier was held.
-
#modifiers : Input::Modifier
Modifier keys held during the mouse event.
-
#motion? : Bool
Whether this is a motion event (mouse moved while button held).
-
#press? : Bool
Returns true if this is a button press event.
-
#shift? : Bool
Returns true if Shift modifier was held.
-
#wheel? : Bool
Returns true if this is a wheel scroll event.
-
#x : Int32
X coordinate (column, 1-based).
-
#y : Int32
Y coordinate (row, 1-based).
Constructor Detail
def self.new(x : Int32, y : Int32, button : MouseButton, modifiers : Input::Modifier = Input::Modifier::None, motion : Bool = false)
#