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!