Welcome, Guest. Please login or register. Did you miss your activation email?

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - garee

Pages: [1]
1
Window / String representation of a sf::Keyboard::Key
« on: June 19, 2013, 08:12:53 pm »
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.
}

Pages: [1]
anything