diff options
Diffstat (limited to 'src/grid.rs')
| -rw-r--r-- | src/grid.rs | 14 |
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 |
