Is there a solution to computing the string representation of a sf::Keyboard::Key that doesn't involve a massive switch or if-else statement?
Ideally, I would like to avoid something like this:
const char *getKeyName(const sf::Keyboard::Key key) {
switch(key) {
case sf::Keyboard::Unknown:
return "Unknown";
case sf::Keyboard::A:
return "A";
case sf::Keyboard::B:
return "B";
case sf::Keyboard::C:
return "C";
// ... All the other keys.
}
Not in SFML, but in Thor (http://www.bromeon.ch/libraries/thor/v2.0/doc/_input_names_8hpp.html):
std::string s = thor::toString(sf::Keyboard::A);