aboutsummaryrefslogtreecommitdiff
path: root/src/grid.rs
diff options
context:
space:
mode:
authorArne Dußin2021-01-06 22:50:14 +0100
committerGitHub2021-01-06 22:50:14 +0100
commitd8123704ea4fe4f1fb677db31ecac53c9c40096e (patch)
treee0a365444784efaaeb1eea6373b34559b6d57fbc /src/grid.rs
parent30b23db9e86fdf72a4e7de72213df274ce19123e (diff)
parentfa1afb6be3ba2d521eb0791edc0bb8e631a85327 (diff)
downloadgraf_karto-d8123704ea4fe4f1fb677db31ecac53c9c40096e.tar.gz
graf_karto-d8123704ea4fe4f1fb677db31ecac53c9c40096e.zip
Merge pull request #27 from LordSentox/snapping
Add snapping module to replace the rigid grid snapping
Diffstat (limited to 'src/grid.rs')
-rw-r--r--src/grid.rs14
1 files changed, 1 insertions, 13 deletions
diff --git a/src/grid.rs b/src/grid.rs
index d1c4b15..9134a49 100644
--- a/src/grid.rs
+++ b/src/grid.rs
@@ -1,22 +1,10 @@
//! The grid used to divide the map into evenly sized chunks.
use crate::colours::DEFAULT_COLOURS;
-use crate::math::{self, Vec2};
+use crate::math;
use crate::transform::Transform;
use raylib::drawing::RaylibDraw;
-/// The internal grid length which will be used to snap things to it.
-pub const SNAP_SIZE: f64 = 0.5;
-
-/// Snap a vector to the grid with the factor being the sub-grid accuracy. For instance, 0.5 will
-/// snap to half a grid cell, while 2.0 would snap to every second grid cell
-pub fn snap_to_grid(mut vec: Vec2<f64>, snap_fraction: f64) -> Vec2<f64> {
- vec.x = math::round(vec.x, snap_fraction);
- vec.y = math::round(vec.y, snap_fraction);
-
- vec
-}
-
/// Draw an infinite grid that can be moved around on the screen and zoomed in and out of.
pub fn draw_grid<D>(rld: &mut D, screen_width: i32, screen_height: i32, transform: &Transform)
where