diff options
author | tom barrett <spalf0@gmail.com> | 2019-07-08 04:53:04 -0500 |
---|---|---|
committer | tom barrett <spalf0@gmail.com> | 2019-07-08 04:53:04 -0500 |
commit | 503361ce70615d7c4b66bd7e49d56c61259dab32 (patch) | |
tree | a252975aaa2b34f4fcac81d8fdb5b11f8d36cf0e /src/cell.rs | |
parent | de4e8c1f0b82627fd1980401ae63472f49c9d89c (diff) |
rotation now works
Diffstat (limited to 'src/cell.rs')
-rw-r--r-- | src/cell.rs | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/src/cell.rs b/src/cell.rs index 13d095f..9d257ff 100644 --- a/src/cell.rs +++ b/src/cell.rs @@ -27,27 +27,13 @@ impl Cell { pub fn new(text: &str, i: usize, tileset: &Tileset, dimensions: (usize, usize)) -> Cell { let id = text.parse::<usize>().unwrap(); - /* - let (source, rotation) = match (flip_d, flip_h, flip_v) { - (true, true, true) => (flip(tileset.get(id)), convert_angle_to_rad(90.0)), - (true, true, false) => (tileset.get(id), convert_angle_to_rad(90.0)), - (true, false, true) => (tileset.get(id), convert_angle_to_rad(270.0)), - //(true, false, false) => (), - (false, true, true) => (tileset.get(id), convert_angle_to_rad(180.0)), - (false, true, false) => (flip(tileset.get(id)), 0.0), - //(false, false, true) => (), - //(false, false, false) => (), - _ => (tileset.get(id), 0.0), - }; - */ - let x = i as f32 % dimensions.0 as f32; let y = (i as f32 / dimensions.1 as f32).floor(); - //let offset = (constants::TILE_WIDTH / 2.0) * constants::TILE_SCALE; + let offset = (constants::TILE_WIDTH / 2.0) * constants::TILE_SCALE; let destination = Point2::new( - constants::TILE_WIDTH * constants::TILE_SCALE * x, //+ offset, - constants::TILE_HEIGHT * constants::TILE_SCALE * y, //+ offset, + (constants::TILE_WIDTH * constants::TILE_SCALE * x) + offset, + (constants::TILE_HEIGHT * constants::TILE_SCALE * y) + offset, ); Cell { |