split up code of sfml demo