Skip to content

Commit

Permalink
chore: cargo fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
adrien-bon committed Aug 20, 2024
1 parent b197803 commit af6b35f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 13 deletions.
1 change: 0 additions & 1 deletion examples/hex_map.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ impl AssetsManager {
}

fn cycle_map(&mut self, commands: &mut Commands) {

info!(
" => Switching to map '{}'",
self.map_assets[self.map_index].path
Expand Down
20 changes: 8 additions & 12 deletions src/loader.rs
Original file line number Diff line number Diff line change
Expand Up @@ -416,12 +416,8 @@ fn load_map(
transform: match &tiled_settings.map_positioning {
MapPositioning::LayerOffset => offset_transform,
MapPositioning::Centered => {
get_tilemap_center_transform(
&map_size,
&grid_size,
&map_type,
0.,
) * offset_transform
get_tilemap_center_transform(&map_size, &grid_size, &map_type, 0.)
* offset_transform
}
},
..default()
Expand Down Expand Up @@ -839,24 +835,24 @@ fn load_objects_layer(
let object_position = match map_type {
TilemapType::Hexagon(HexCoordSystem::ColumnOdd) => Vec2::new(
object_data.x + grid_size.x / 4.,
(map_size.y as f32 + 0.5) * grid_size.y - object_data.y
(map_size.y as f32 + 0.5) * grid_size.y - object_data.y,
),
TilemapType::Hexagon(HexCoordSystem::ColumnEven) => Vec2::new(
object_data.x + grid_size.x / 4.,
(map_size.y as f32 + 0.) * grid_size.y - object_data.y
(map_size.y as f32 + 0.) * grid_size.y - object_data.y,
),
TilemapType::Hexagon(HexCoordSystem::RowOdd) => Vec2::new(
object_data.x,
map_size.y as f32 * grid_size.y * 0.75 + grid_size.y / 4. - object_data.y,
map_size.y as f32 * grid_size.y * 0.75 + grid_size.y / 4. - object_data.y,
),
TilemapType::Hexagon(HexCoordSystem::RowEven) => Vec2::new(
object_data.x - grid_size.x / 2.,
map_size.y as f32 * grid_size.y * 0.75 + grid_size.y / 4. - object_data.y,
map_size.y as f32 * grid_size.y * 0.75 + grid_size.y / 4. - object_data.y,
),
_ => Vec2::new(
object_data.x,
map_size.y as f32 * grid_size.y - object_data.y
)
map_size.y as f32 * grid_size.y - object_data.y,
),
};

let _object_entity = commands
Expand Down

0 comments on commit af6b35f

Please sign in to comment.