-
Notifications
You must be signed in to change notification settings - Fork 74
Sdl pollEvent
dmzotov1986 edited this page Jan 30, 2025
·
5 revisions
Use this function to poll for currently pending events. This function is implemented as an iterator.
function SDL.pollEvent()
- an iterator of event (see Event)
--
-- This is the recommended way of handling events
--
local running = true
while running do
for e in SDL.pollEvent() do
if e.type == SDL.event.Quit then
running = false
end
end
-- To avoid wasting processor time waiting for events by constantly spinning in a loop.
-- The actual code may contain drawing the next frame here (or maybe at the beginning of the loop). Perhaps you will need a variable instead of a constant, or just use a timer.
SDL.delay(100)
end