Port to SDL2, refactor main.cc