antirez / load81

SDL based Lua programming environment for kids similar to Codea
BSD 2-Clause "Simplified" License
599 stars 62 forks source link

process multiple SDL events per tick #24

Closed rlane closed 12 years ago

rlane commented 12 years ago

This greatly reduces input lag.

Fixes #17.

antirez commented 12 years ago

Hello Rich,

with the current implementation of events this patch breaks the functionality, for instance consider the following program:

function draw()
    if mouse.pressed['1'] then
        ellipse(mouse.x,mouse.y,30,30)
    end
end

If you have a touchpad and just touch it to simulate a very fast click, many times it will be missed, because this will generate other events with random ordering. In order to fix this we need a more complex solution where if something was touched in the context of the while() loop, the 'pressed' filed is set, but we remember to clear it later if we also captured the BUTTONUP event.

antirez commented 12 years ago

I just pushed a commit that should fix the issue properly. Thanks.