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

Author Topic: Key events on sfml2  (Read 1496 times)

0 Members and 1 Guest are viewing this topic.

krrice

  • Newbie
  • *
  • Posts: 26
    • View Profile
Key events on sfml2
« on: November 13, 2011, 04:24:35 pm »
in this switch statement it does not matter whitch key i press it says f was pressed what am i doing wrong?

 case sf::Event::KeyPressed:
                switch (Event.KeyPressed)
                {
                case sf::Keyboard::Back:
                    std::cout << "Backspace was pressed." << std:: endl;
                    break;
                case sf::Keyboard::F:
                    std::cout << "f was pressed." << std:: endl;
                    break;
                default:
                    break;
                }

Tex Killer

  • Full Member
  • ***
  • Posts: 242
    • View Profile
Key events on sfml2
« Reply #1 on: November 13, 2011, 04:32:47 pm »
Replace Event.KeyPressed on the switch for Event.Key.Code.

krrice

  • Newbie
  • *
  • Posts: 26
    • View Profile
Key events on sfml2
« Reply #2 on: November 13, 2011, 04:38:41 pm »
Thanks alot that worked.