diff --git a/src/animals.rs b/src/animals.rs index 76f7608..6e9f04c 100644 --- a/src/animals.rs +++ b/src/animals.rs @@ -2,9 +2,7 @@ use bevy::prelude::*; pub struct Plugin; impl bevy::prelude::Plugin for Plugin { - fn build(&self, app: &mut App) { - - } + fn build(&self, app: &mut App) {} } #[derive(PartialEq, Eq, Clone, Copy)] @@ -14,5 +12,5 @@ pub enum AnimalKind { #[derive(Component)] pub struct Animal { - kind: AnimalKind + kind: AnimalKind, } diff --git a/src/camera.rs b/src/camera.rs index fae1f10..58c12ce 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,6 +1,13 @@ use std::time::Duration; -use bevy::{input::mouse::MouseWheel, math::NormedVectorSpace, picking::{focus::HoverMap, pointer::PointerId}, prelude::*, utils::HashMap, window::PrimaryWindow}; +use bevy::{ + input::mouse::MouseWheel, + math::NormedVectorSpace, + picking::{focus::HoverMap, pointer::PointerId}, + prelude::*, + utils::HashMap, + window::PrimaryWindow, +}; use crate::ui; @@ -8,17 +15,14 @@ pub struct Plugin; impl bevy::prelude::Plugin for Plugin { fn build(&self, app: &mut App) { app.add_systems(Startup, setup); - // .add_systems(Update, move_cam) - // .init_resource::(); + // .add_systems(Update, move_cam) + // .init_resource::(); } } fn setup(mut cmds: Commands, window: Query<&Window>) { - let zoom = 2./window.single().width().min(window.single().height()); - cmds.spawn(( - Camera2d, - Transform::from_scale(Vec3::new(zoom, zoom, zoom)) - )); + let zoom = 2. / window.single().width().min(window.single().height()); + cmds.spawn((Camera2d, Transform::from_scale(Vec3::new(zoom, zoom, zoom)))); } #[derive(Resource, Default)] @@ -33,50 +37,80 @@ fn move_cam( window: Query<&Window, With>, mut pointers: ResMut, hover_map: Res, - time: Res