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

master
Zed A. Shaw 8 months ago
parent 37199bdd19
commit 285cd4971f
  1. 6
      sfmldemo/main.cpp

@ -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;
}
}

Loading…
Cancel
Save