Skip to content

Commit

Permalink
wip: hexagon_generation
Browse files Browse the repository at this point in the history
  • Loading branch information
rparrett committed Nov 21, 2024
1 parent 9e0e5a7 commit ed898e6
Showing 1 changed file with 9 additions and 13 deletions.
22 changes: 9 additions & 13 deletions examples/hexagon_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,6 @@ fn spawn_map_type_label(
windows: Query<&Window>,
map_type_q: Query<&TilemapType>,
) {
let text_style = TextStyle {
font: font_handle.clone(),
font_size: 20.0,
color: Color::BLACK,
};
let text_justify = JustifyText::Center;

for window in windows.iter() {
for map_type in map_type_q.iter() {
// Place the map type label somewhere in the top left side of the screen
Expand All @@ -114,12 +107,15 @@ fn spawn_map_type_label(
..Default::default()
};
commands.spawn((
Text2dBundle {
text: Text::from_section(format!("{map_type:?}"), text_style.clone())
.with_justify(text_justify),
transform,
Text2d::new(format!("{map_type:?}")),
TextFont {
font: font_handle.clone(),
font_size: 20.0,
..default()
},
TextColor(Color::BLACK),
TextLayout::new_with_justify(JustifyText::Center),
transform,
MapTypeLabel,
));
}
Expand All @@ -141,7 +137,7 @@ fn swap_map_type(
&mut TileStorage,
)>,
keyboard_input: Res<ButtonInput<KeyCode>>,
mut map_type_label_q: Query<&mut Text, With<MapTypeLabel>>,
mut map_type_label_q: Query<&mut Text2d, With<MapTypeLabel>>,
tile_handle_hex_row: Res<TileHandleHexRow>,
tile_handle_hex_col: Res<TileHandleHexCol>,
) {
Expand Down Expand Up @@ -201,7 +197,7 @@ fn swap_map_type(
);

for mut label_text in map_type_label_q.iter_mut() {
label_text.sections[0].value = format!("{:?}", map_type.as_ref());
label_text.0 = format!("{:?}", map_type.as_ref());
}
}
}
Expand Down

0 comments on commit ed898e6

Please sign in to comment.