initial copy from github.com/mgutz/gosu