Skip to content

Instantly share code, notes, and snippets.

@kim366
Last active April 20, 2017 20:33
Show Gist options
  • Save kim366/db1a3ac03059c10c3fcb2dae72a97ea8 to your computer and use it in GitHub Desktop.
Save kim366/db1a3ac03059c10c3fcb2dae72a97ea8 to your computer and use it in GitHub Desktop.
Box That snaps to Grid when moving Mouse Cursor
auto box_position{sf::Mouse::getPosition(window)};
for (auto& component : {box_position.x, box_position.y})
{
while (component % tileSize)
--component;
}
box.setPosition(box_position);
@kim366
Copy link
Author

kim366 commented Oct 20, 2016

box1
box2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment