partial conversion to SDL2