Hey I was wondering whether there is something wrong with the SFML mouse input class.
When I get input from the keyboard I use a pollEvent and a switch type structure
while(App.pollEvent(Event))
{
switch(Event.type)
{
case sf::Event::Closed:
App.close();
break;
case sf::Event::KeyPressed:
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
{
//Do stuff
}
break;
}
}
And it works fine.
However attempting to put in a
case sf::Event::MouseButtonPressed: doesn't work.
In my application I did it like this
while(App.pollEvent(Event))
{
switch(Event.type)
{
case sf::Event::Closed:
App.close();
break;
case sf::Event::KeyPressed:
if(sf::Keyboard::isKeyPressed(sf::Keyboard::Escape))
{
//Do stuff
}
break;
case sf::Event::MouseButtonPressed:
if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
//Do stuff
}
}
}
But it never triggered/worked. Instead I had to do this:
while(App.pollEvent(Event))
{
switch(Event.type)
{
//Process events
}
}
if(sf::Mouse::isButtonPressed(sf::Mouse::Left))
{
//React to the mouse button
}
Am I doing an incorrect implementation or is it something else?