Skip to content

Instantly share code, notes, and snippets.

@kim366
Last active April 20, 2017 20:33
Show Gist options
  • Select an option

  • Save kim366/db1a3ac03059c10c3fcb2dae72a97ea8 to your computer and use it in GitHub Desktop.

Select an option

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

kim366 commented Oct 20, 2016

Copy link
Copy Markdown
Author

box1
box2

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