module Termisu::Event

Overview

Events module for terminal input handling.

Provides structured event types for keyboard input, mouse events, terminal resize events, and timer tick events.

Event types are namespaced under Termisu::Event::* and the union type Termisu::Event::Any is used for type annotations and pattern matching.

Example:

termisu = Termisu.new
begin
  termisu.each_event do |event|
    case event
    when Termisu::Event::Key
      break if event.ctrl_c? || event.key.escape?
      puts "Key: #{event.key}"
    when Termisu::Event::Mouse
      puts "Mouse: #{event.x},#{event.y} button=#{event.button}"
    when Termisu::Event::Resize
      puts "Resize: #{event.width}x#{event.height}"
    when Termisu::Event::Tick
      puts "Tick: frame=#{event.frame}"
    end
  end
ensure
  termisu.close
end

Defined in:

termisu/event.cr