initial commit

This commit is contained in:
2025-01-05 07:28:06 +00:00
commit 52c9050d54
18 changed files with 5801 additions and 0 deletions

48
src/ui/crosshair.rs Normal file
View File

@@ -0,0 +1,48 @@
use bevy::prelude::*;
pub struct CrosshairPlugin;
impl Plugin for CrosshairPlugin
{
fn build(&self, app: &mut App)
{
app.add_systems(Startup, setup_crosshair);
}
}
fn setup_crosshair(
mut commands: Commands,
) {
const CROSSHAIR_THICKNESS: f32 = 2.0;
const CROSSHAIR_LENGTH: f32 = 10.0;
commands
.spawn(Node {
width: Val::Percent(100.0),
height: Val::Percent(100.0),
position_type: PositionType::Absolute,
justify_content: JustifyContent::Center,
align_items: AlignItems::Center,
..default()
})
.with_child((
Node {
width: Val::Px(CROSSHAIR_THICKNESS),
height: Val::Px(CROSSHAIR_LENGTH),
position_type: PositionType::Absolute,
..default()
},
BackgroundColor(Color::WHITE),
))
.with_child((
Node {
width: Val::Px(CROSSHAIR_LENGTH),
height: Val::Px(CROSSHAIR_THICKNESS),
position_type: PositionType::Absolute,
..default()
},
BackgroundColor(Color::WHITE),
))
;
}

14
src/ui/mod.rs Normal file
View File

@@ -0,0 +1,14 @@
use bevy::prelude::*;
mod crosshair;
pub struct UiPlugin;
impl Plugin for UiPlugin
{
fn build(&self, app: &mut App)
{
app.add_plugins(crosshair::CrosshairPlugin);
}
}