~starkingdoms/starkingdoms

ref: 6aca948465e18411e666e465693deb03c97f6fd6 starkingdoms/crates/ship_editor/src/main.rs -rw-r--r-- 760 bytes
6aca9484ghostly_zsh start ship editor, added mouse navigation 6 days 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
use bevy::{prelude::*};
use crate::input::input_plugin;
use crate::ui::ui_plugin;

pub mod ui;
mod input;

fn main() {
    App::new()
        .add_plugins(DefaultPlugins)
        .add_systems(Startup, setup)
        .add_plugins(ui_plugin)
        .add_plugins(input_plugin)
        .run();
}

fn setup(
    mut commands: Commands,
    mut meshes: ResMut<Assets<Mesh>>,
    mut materials: ResMut<Assets<ColorMaterial>>,
) {
    commands.spawn((
        Camera2d::default(),
        Transform::from_xyz(0.0, 0.0, 0.0),
    ));
    let rectangle = meshes.add(Rectangle::new(50.0, 50.0));
    commands.spawn((
        Mesh2d(rectangle),
        MeshMaterial2d(materials.add(Color::linear_rgb(0.0, 0.0, 0.0))),
        Transform::from_xyz(0.0, 0.0, 0.0)
    ));
}