I get that, so why is it then that the documentation code shown for events was completely different to the events tutorial and I know this is what threw me off from making the code work which is why I posted it here.
while (window.isOpen())
{
// Process events
sf::Event event;
while (window.pollEvent(event))
{
// Close window : exit
if (event.type == sf::Event::Closed)
window.close();
}
There's no mention of event.type here yet there is in the tutorial so no one unless they already knew the answer right away would have been able to realise that the tutorial was the correct piece of code to use or was that on purpose? I was working on this assuming I should follow the documentation, I know enough about events but I haven't read up on break and switch properly yet.
The reason I ask these kind of questions is because books and tutorials won't answer, a lot of times books and tutorials always make the mistake of assuming you already know bits and pieces or skip out sections no matter how well they're written which is why I use multiple sources despite anyone's objections and I made this thread.
So either this code was written wrong, or the event tutorial code is what you use when using more advanced techniques, or, Laurent did this on purpose to catch people out
.