diff --git a/src/main.rs b/src/main.rs index 0396710..ebf503f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,7 +1,10 @@ -use bevy::{prelude::*, window::WindowResolution}; +use bevy::{color::palettes::css::GREEN, prelude::*, window::WindowResolution}; use bevy_inspector_egui::{bevy_egui::EguiPlugin, quick::WorldInspectorPlugin}; -use crate::game::machines::{CuttingMachine, RotatingMachine}; +use crate::{ + game::machines::{CuttingMachine, RotatingMachine}, + resources::UiTheme, +}; mod assets; mod card; @@ -21,15 +24,7 @@ fn main() { .add_plugins(EguiPlugin::default()) .add_plugins(WorldInspectorPlugin::new()) .add_plugins(widgets::GameUiPlugin) - .add_systems( - Startup, - ( - setup, - assets::load_assets, - RotatingMachine::spawn_ui, - CuttingMachine::spawn_ui, - ), - ) + .add_systems(Startup, (setup, assets::load_assets, dummy_machine)) .run(); } @@ -43,3 +38,27 @@ fn despawn(mut commands: Commands, to_despawn: Query>, + // mut materials: ResMut>, +) { + commands + .spawn(( + Sprite::from_color(GREEN, Vec2::splat(40.0)), + // WARN: Mesh picking is not part of the `DefaultPlugins` plugin collection! + // (but sprite picking is!) + + // Mesh2d(meshes.add(Rectangle::new(25., 25.))), + // MeshMaterial2d(materials.add(ColorMaterial::from_color(GREEN))), + Transform::default(), + Pickable::default(), + )) + .observe( + |event: Trigger>, commands: Commands, theme: Res| { + let entity = event.target; + CuttingMachine::spawn_ui(commands, theme); + }, + ); +}