Adapted for SFML 2.1