sdl2 :: SDLEventBuffer :: to_event
self
as a precise SDLEvent
Returns null
if the event is unknown.
Note: The returned SDLEvent
is just a different Nit instance pointing to the same data.
A call to poll_event
will invalidate any instances returned previously by to_event
.
# Get a reference to the data at `self` as a precise `SDLEvent`
#
# Returns `null` if the event is unknown.
#
# Note: The returned `SDLEvent` is just a different Nit instance pointing to the same data.
# A call to `poll_event` will invalidate any instances returned previously by `to_event`.
fun to_event: SDLEvent
do
if is_quit then return to_quit
if is_mouse_motion then return to_mouse_motion
if is_mouse_button_down then return to_mouse_button_down
if is_mouse_button_up then return to_mouse_button_up
if is_mouse_wheel then return to_mouse_wheel
if is_keydown then return to_keydown
if is_keyup then return to_keyup
if is_window then return to_window
return to_event_direct
end
lib/sdl2/events.nit:38,2--55,4