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

Author Topic: keyboard keys get pressed when i hover my mouse on sfml window.  (Read 773 times)

0 Members and 1 Guest are viewing this topic.

Nauman Ali

  • Newbie
  • *
  • Posts: 1
    • View Profile
    • Email
please help me with this. its my first time with sfml.

The problem is that whenever i move mouse on window keys are pressed and on left side of window escape key or return key is pressed.

Hapax

  • Hero Member
  • *****
  • Posts: 3351
  • My number of posts is shown in hexadecimal.
    • View Profile
    • Links
Re: keyboard keys get pressed when i hover my mouse on sfml window.
« Reply #1 on: April 30, 2017, 12:01:16 pm »
An sf::Event is a union and due to this, the key code should never be queried unless the event is confirmed to be a key event type.
For example:
if (event.type == sf::Event::Keypressed)
{
    if (event.key.code == sf::Keyboard::Escape)
        escapeWasPressed();
}
Selba Ward -SFML drawables
Cheese Map -Drawable Layered Tile Map
Kairos -Timing Library
Grambol
 *Hapaxia Links*

 

anything