generated from tipragot/rust
save
This commit is contained in:
parent
b7e3e9da9c
commit
3a9f75bcfe
BIN
crates/border-wars/assets/temp.png
Normal file
BIN
crates/border-wars/assets/temp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1,014 B |
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue