SDL: add input support, use SDL mainloop in a thread