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

Pages: [1]
1
Window / Re: Problem with Mouse.x stored in Event.key.code
« on: March 25, 2015, 08:47:39 pm »
What is the difference between using sf::Event::KeyPressed and event.KeyPressed when they return the same value?

2
Window / Re: Problem with Mouse.x stored in Event.key.code
« on: March 25, 2015, 08:38:55 pm »
Thanks for the quick answer :)

Silly of me not to check
if(event.type == event.KeyPressed)

3
Window / [SOLVED]Problem with Mouse.x stored in Event.key.code
« on: March 25, 2015, 08:29:10 pm »
So, my application has been closing all the time and driving me crazy, and I've thought that it crashed, but I later figured out that the problem lies here:

if(event.type == event.Closed || (event.key.code == sf::Keyboard::Escape)){
    m_window.close();
}
 

So what's happening is that the mouse.x position is stored in event.key.code every time the mouse is moved.
Now, sf::Keyboard::Escape == 36
So, every time my mouse is at pixel 36, the application closes, does anyone know how I can rewrite the above code, if possible, to make it work with the escape button?

Appreciate all answers! :)

Pages: [1]