hey,
i want use muose click and get some positions in window, and set positions for draw some rectangles, but i have two problem,
1- i dont know where set number of point should press by user;(for example just 10 positions)
2- my rectangle not saved on screen, when user click on new position The previous rectangle Removed،
while (window.isOpen())
{
sf::Event event;
while (window.pollEvent(event))
{
switch (event.type) {
case sf::Event::Closed:
window.close();
break;
case sf::Event::MouseButtonPressed: ;
cout << "Mouse button has been pressed " << endl;
cout << event.mouseButton.x << " " << event.mouseButton.y << endl;
posx=event.mouseButton.x;
posy=event.mouseButton.y;
break;
}
sf::RectangleShape Rectangle;
Rectangle.setSize(sf::Vector2f(3, 3));
Rectangle.setOutlineColor(sf::Color::Green);
Rectangle.setFillColor(sf::Color::Green);
Rectangle.setPosition(posx,posy);
window.clear();
window.draw( Rectangle);
window.display();
}