1
General / simple mouse position getter not working
« on: December 18, 2017, 03:31:44 am »Quote
sf::Vector2i pixelPos = sf::Mouse::getPosition(window);
if ( pixelPos.x > 378
&& pixelPos.x < 611
&& pixelPos.y > 385
&& pixelPos.y < 490 )
{
window.draw(spritePlay);
}
else if (pixelPos.x > 299
&& pixelPos.x < 704
&& pixelPos.y > 505
&& pixelPos.y < 623
)
{
window.draw(spriteDontPlay);
}
else {
window.draw(sprite);
}
this section of code runs every frame on the main menu. "sprite" is displayed the whole time, and spriteDontPlay and spritePlay are never shown.