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 - nakee

Pages: [1]
1
General discussions / Suggestion for function
« on: December 30, 2008, 09:36:40 am »
Code: [Select]

void SFKeyToString(unsigned int keycode, char *keyStr) {
    switch (keycode) {
    case sf::Key::Escape: sprintf(keyStr, "Escape"); break;
    case sf::Key::LControl: sprintf(keyStr, "LControl"); break;
    case sf::Key::LShift: sprintf(keyStr, "LShift"); break;
    case sf::Key::LAlt: sprintf(keyStr, "LAlt"); break;
    case sf::Key::LSystem: sprintf(keyStr, "LSystem"); break;
    case sf::Key::RControl: sprintf(keyStr, "RControl"); break;
    case sf::Key::RShift: sprintf(keyStr, "RShift"); break;
    case sf::Key::RAlt: sprintf(keyStr, "RAlt"); break;
    case sf::Key::RSystem: sprintf(keyStr, "RSystem"); break;
    case sf::Key::Menu: sprintf(keyStr, "Menu"); break;
    case sf::Key::LBracket: sprintf(keyStr, "LBracket"); break;
    case sf::Key::RBracket: sprintf(keyStr, "RBracket"); break;
    case sf::Key::SemiColon: sprintf(keyStr, ";"); break;
    case sf::Key::Comma: sprintf(keyStr, ","); break;
    case sf::Key::Period: sprintf(keyStr, "."); break;
    case sf::Key::Quote: sprintf(keyStr, "\'"); break;
    case sf::Key::Slash: sprintf(keyStr, "/"); break;
    case sf::Key::BackSlash: sprintf(keyStr, "\\"); break;
    case sf::Key::Tilde: sprintf(keyStr, "~"); break;
    case sf::Key::Equal: sprintf(keyStr, "="); break;
    case sf::Key::Dash: sprintf(keyStr, "-"); break;
    case sf::Key::Space: sprintf(keyStr, "Space"); break;
    case sf::Key::Return: sprintf(keyStr, "Return"); break;
    case sf::Key::Back: sprintf(keyStr, "Back"); break;
    case sf::Key::Tab: sprintf(keyStr, "Tab"); break;
    case sf::Key::PageUp: sprintf(keyStr, "Page Up"); break;
    case sf::Key::PageDown: sprintf(keyStr, "Page Down"); break;
    case sf::Key::End: sprintf(keyStr, "End"); break;
    case sf::Key::Home: sprintf(keyStr, "Home"); break;
    case sf::Key::Insert: sprintf(keyStr, "Insert"); break;
    case sf::Key::Delete: sprintf(keyStr, "Delete"); break;
    case sf::Key::Add: sprintf(keyStr, "+"); break;
    case sf::Key::Subtract: sprintf(keyStr, "-"); break;
    case sf::Key::Multiply: sprintf(keyStr, "*"); break;
    case sf::Key::Divide: sprintf(keyStr, "/"); break;
    case sf::Key::Left: sprintf(keyStr, "Left"); break;
    case sf::Key::Right: sprintf(keyStr, "Right"); break;
    case sf::Key::Up: sprintf(keyStr, "UP"); break;
   case sf::Key::Down: sprintf(keyStr, "Down"); break;
    case sf::Key::Numpad0: sprintf(keyStr, "NP 0"); break;
    case sf::Key::Numpad1: sprintf(keyStr, "NP 1"); break;
    case sf::Key::Numpad2: sprintf(keyStr, "NP 2"); break;
    case sf::Key::Numpad3: sprintf(keyStr, "NP 3"); break;
    case sf::Key::Numpad4: sprintf(keyStr, "NP 4"); break;
    case sf::Key::Numpad5: sprintf(keyStr, "NP 5"); break;
    case sf::Key::Numpad6: sprintf(keyStr, "NP 6"); break;
    case sf::Key::Numpad7: sprintf(keyStr, "NP 7"); break;
    case sf::Key::Numpad8: sprintf(keyStr, "NP 8"); break;
    case sf::Key::Numpad9: sprintf(keyStr, "NP 9"); break;
    case sf::Key::F1: sprintf(keyStr, "F1"); break;
    case sf::Key::F2: sprintf(keyStr, "F2"); break;
    case sf::Key::F3: sprintf(keyStr, "F3"); break;
    case sf::Key::F4: sprintf(keyStr, "F4"); break;
    case sf::Key::F5: sprintf(keyStr, "F5"); break;
    case sf::Key::F6: sprintf(keyStr, "F6"); break;
    case sf::Key::F7: sprintf(keyStr, "F7"); break;
    case sf::Key::F8: sprintf(keyStr, "F8"); break;
    case sf::Key::F9: sprintf(keyStr, "F9"); break;
    case sf::Key::F10: sprintf(keyStr, "F10"); break;
    case sf::Key::F11: sprintf(keyStr, "F11"); break;
    case sf::Key::F12: sprintf(keyStr, "F12"); break;
    case sf::Key::F13: sprintf(keyStr, "F13"); break;
    case sf::Key::F14: sprintf(keyStr, "F14"); break;
    case sf::Key::F15: sprintf(keyStr, "F15"); break;
    case sf::Key::Pause: sprintf(keyStr, "Paues"); break;
       
    default:
        sprintf(keyStr, "%c", keycode);
    }
}

Pages: [1]
anything