use bevy::{ diagnostic::{Diagnostics, FrameTimeDiagnosticsPlugin}, prelude::*, }; const BIRDS_PER_SECOND: u32 = 1000; const GRAVITY: f32 = -9.8 * 100.0; const MAX_VELOCITY: f32 = 750.; const BIRD_SCALE: f32 = 0.15; const HALF_BIRD_SIZE: f32 = 256. * BIRD_SCALE * 0.5; struct BevyCounter { pub count: u128, } struct Bird { velocity: Vec3, } struct BirdMaterial(Handle); impl FromResources for BirdMaterial { fn from_resources(resources: &Resources) -> Self { let mut color_materials = resources.get_mut::>().unwrap(); let asset_server = resources.get_mut::().unwrap(); BirdMaterial(color_materials.add(asset_server.load("branding/icon.png").into())) } } fn main() { App::build() .add_resource(WindowDescriptor { title: "BevyMark".to_string(), width: 800, height: 600, vsync: true, resizable: false, ..Default::default() }) .add_plugins(DefaultPlugins) .add_plugin(FrameTimeDiagnosticsPlugin::default()) .add_resource(BevyCounter { count: 0 }) .init_resource::() .add_startup_system(setup) .add_system(mouse_handler) .add_system(movement_system) .add_system(collision_system) .add_system(counter_system) .run(); } fn setup(commands: &mut Commands, asset_server: Res) { commands .spawn(Camera2dBundle::default()) .spawn(CameraUiBundle::default()) .spawn(TextBundle { text: Text { font: asset_server.load("fonts/FiraSans-Bold.ttf"), value: "Bird Count:".to_string(), style: TextStyle { color: Color::rgb(0.0, 1.0, 0.0), font_size: 40.0, ..Default::default() }, }, style: Style { position_type: PositionType::Absolute, position: Rect { top: Val::Px(5.0), left: Val::Px(5.0), ..Default::default() }, ..Default::default() }, ..Default::default() }); } fn mouse_handler( commands: &mut Commands, time: Res