And now clicking with a mouse jumps the square to that spot.

This commit is contained in:
Zed A. Shaw 2024-04-26 21:50:37 -04:00
parent 37199bdd19
commit 285cd4971f

View file

@ -94,6 +94,12 @@ int main() {
shape.move(0, 20);
}
break;
case sf::Event::MouseButtonPressed:
if(sf::Mouse::isButtonPressed(sf::Mouse::Left)) {
sf::Vector2i clickAt = sf::Mouse::getPosition(window);
shape.setPosition(clickAt.x, clickAt.y);
}
break;
}
}