This commit is contained in:
CoCo_Sol 2024-03-11 06:11:48 +01:00
parent b7e3e9da9c
commit 3a9f75bcfe
3 changed files with 35 additions and 6 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 1,014 B

View file

@ -1,6 +1,7 @@
//! All programs related to the clicking on a tile.
use bevy::{input::mouse::MouseButtonInput, prelude::*};
use bevy::input::mouse::MouseButtonInput;
use bevy::prelude::*;
use super::Tile;
@ -44,7 +45,7 @@ fn mouse_handler(
ui_scale: Res<UiScale>,
) {
let Some(event) = mouse_button_event.read().next() else {
return;
return;
};
if !(event.state.is_pressed() && event.button == MouseButton::Left) {

View file

@ -65,21 +65,38 @@ fn handle_tile_click(
transform.translation.y += 10.;
}
}
}
}
fn init_text_zone(mut commands: Commands) {
fn init_text_zone(mut commands: Commands, asset_server: Res<AssetServer>) {
commands
.spawn(TextBundle {
.spawn(ImageBundle {
style: Style {
position_type: PositionType::Absolute,
height: Val::Percent(50.),
width: Val::Percent(50.),
bottom: Val::ZERO,
..Default::default()
},
image: UiImage {
texture: asset_server.load("temp.png"),
..default()
},
..default()
})
.insert(TileInfoText);
.with_children(|builder| {
builder
.spawn(TextBundle {
style: Style {
height:Val::Percent(100.),
position_type: PositionType::Absolute,
..default()
},
..default()
})
.insert(TileInfoText);
});
}
/// TODO
@ -109,3 +126,14 @@ fn update_tile_info_text(
}
}
}
// .spawn(TextBundle {
// style: Style {
// position_type: PositionType::Absolute,
//
// ..default()
// },
//
// ..default()
// })
// .insert(TileInfoText);