abstract class
Eagle::Event
- Eagle::Event
- Reference
- Object
Overview
Base class for input and window events, delivered to App#input and Node#input.
Use events when you care that something happened: a key went down, a button was
clicked, the window resized. For "is this key held right now?", ask Input instead.
Nodes receive events deepest-first, in reverse order of addition, so the thing
drawn on top gets the first chance. Set handled = true to stop the event from
reaching anything else.
class Menu < Node2D
def input(event : Event) : Nil
case event
when KeyEvent
if event.pressed? && event.key.escape?
visible = !visible?
event.handled = true
end
when MouseButtonEvent
puts "click at #{event.position}" if event.pressed?
end
end
end
Direct Known Subclasses
- Eagle::FileDropEvent
- Eagle::GamepadAxisEvent
- Eagle::GamepadButtonEvent
- Eagle::GamepadConnectionEvent
- Eagle::KeyEvent
- Eagle::MouseButtonEvent
- Eagle::MouseMotionEvent
- Eagle::MouseWheelEvent
- Eagle::QuitEvent
- Eagle::TextEvent
- Eagle::WindowEvent
Defined in:
eagle/core/events.crInstance Method Summary
-
#handled=(handled : Bool)
Set to true in a handler to stop the event from reaching later nodes.
-
#handled? : Bool
Set to true in a handler to stop the event from reaching later nodes.
Instance Method Detail
def handled=(handled : Bool)
#
Set to true in a handler to stop the event from reaching later nodes.