Thanks eXpl0it3r. Your reply is much appreciated. I have dug in to this some more and perhaps come across a better method. Continuously checking the events to get a status is a really bad idea but found that the switch command enables me to discretely handle each event in turn. Code is:
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type)
{
case sf::Event::Closed:
window.close();
break;
case sf::Event::MouseWheelScrolled:
if (event.mouseWheelScroll.delta > 0)
{
\\ Mouse Scroll Up
}
else
{
\\ Mouse Scroll Down
}
break;
case sf::Event::MouseButtonPressed:
if (event.mouseButton.button == sf::Mouse::Left)
{
\\ Left mouse button pressed.
}
else
{
\\ Right mouse button pressed.
}
break;
case sf::Event::MouseButtonReleased:
\\ Either Mouse Button Released
break;
case sf::Event::Resized:
\\ Resize Event
windowWidth = event.size.width;
windowHeight = event.size.height;
visibleArea = sf::FloatRect(0, 0, windowWidth, windowHeight);
break;
default:
break;
}
}
I think switch is a much better way to do this and don't know why SFML don't suggest this in their tutorials. Also probably worth noting that I am a terrible coder and not great with instructions. Having to learn patience and get the ability to read and understand the docs.
Thanks once again.