~starkingdoms/starkingdoms

ref: fc59c04a44c40d563b40289bc6a2761ba2089ffd starkingdoms/crates/unified/src/client/ui.rs -rw-r--r-- 1.1 KiB
fc59c04a — core Merge remote-tracking branch 'origin/core/rewrite-it-all-again-lmao' into core/rewrite-it-all-again-lmao 5 months ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
use bevy::prelude::*;

use crate::client::colors;

pub fn ui_plugin(app: &mut App) {
    app
        .add_systems(Startup, setup_ui);
}

fn setup_ui(
    mut commands: Commands,
) {
    commands.spawn((
        Node {
            width: Val::Percent(100.0),
            height: Val::Percent(100.0),
            ..Default::default()
        },
        children![(
            Node {
                display: Display::Flex,
                position_type: PositionType::Absolute,
                width: Val::Px(200.0),
                height: Val::Px(150.0),
                top: Val::Px(5.0),
                right: Val::Px(5.0),
                ..Default::default()
            },
            BorderRadius::all(Val::Px(5.0)),
            BackgroundColor(colors::MANTLE),
            children![(
                Node {
                    width: Val::Percent(100.0),
                    height: Val::Px(20.0),
                    margin: UiRect::all(Val::Px(5.0)),
                    ..Default::default()
                },
                BorderRadius::all(Val::Px(5.0)),
                BackgroundColor(colors::CRUST),
            )],
        )],
    ));
}