Last active
April 20, 2017 20:33
-
-
Save kim366/db1a3ac03059c10c3fcb2dae72a97ea8 to your computer and use it in GitHub Desktop.
Box That snaps to Grid when moving Mouse Cursor
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
auto box_position{sf::Mouse::getPosition(window)}; | |
for (auto& component : {box_position.x, box_position.y}) | |
{ | |
while (component % tileSize) | |
--component; | |
} | |
box.setPosition(box_position); |
Author
kim366
commented
Oct 20, 2016
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment