And now clicking with a mouse jumps the square to that spot.
This commit is contained in:
parent
37199bdd19
commit
285cd4971f
1 changed files with 6 additions and 0 deletions
|
@ -94,6 +94,12 @@ int main() {
|
||||||
shape.move(0, 20);
|
shape.move(0, 20);
|
||||||
}
|
}
|
||||||
break;
|
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…
Add table
Add a link
Reference in a new issue