From b7eeb9ec9dd4e3321244b53a92f4f8cd9de02484 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Tue, 29 Dec 2020 17:01:28 +0100 Subject: [PATCH] rename camera to player --- src/lib.rs | 2 +- src/main.rs | 8 ++++---- src/{camera.rs => player.rs} | 12 ++++++------ 3 files changed, 11 insertions(+), 11 deletions(-) rename src/{camera.rs => player.rs} (94%) diff --git a/src/lib.rs b/src/lib.rs index 2cee3eb..d44230b 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1 +1 @@ -pub mod camera; \ No newline at end of file +pub mod player; \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 0f6cc76..115a1af 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,6 +1,6 @@ use bevy::prelude::*; -use rake::camera::FlyCamera; -use rake::camera::FlyCameraPlugin; +use rake::player::Player; +use rake::player::PlayerPlugin; use std::process::exit; fn main() { @@ -8,7 +8,7 @@ fn main() { .add_resource(Msaa { samples: 4 }) .add_plugins(DefaultPlugins) .add_startup_system(init.system()) - .add_plugin(FlyCameraPlugin) + .add_plugin(PlayerPlugin) .add_system(exit_game_system.system()) .run(); } @@ -24,7 +24,7 @@ fn init( ..Default::default() }) .spawn(Camera3dBundle::default()) - .with(FlyCamera::default()); + .with(Player::default()); let box_mesh = meshes.add(Mesh::from(shape::Cube { size: 0.25 })); let box_material = materials.add(Color::rgb(1.0, 0.2, 0.3).into()); diff --git a/src/camera.rs b/src/player.rs similarity index 94% rename from src/camera.rs rename to src/player.rs index ce23e2c..042e0f7 100644 --- a/src/camera.rs +++ b/src/player.rs @@ -1,6 +1,6 @@ use bevy::{input::mouse::MouseMotion, math::clamp, prelude::*}; -pub struct FlyCamera { +pub struct Player { /// The speed the FlyCamera moves at. Defaults to `1.0` pub speed: f32, /// The sensitivity of the FlyCamera's motion based on mouse movement. Defaults to `3.0` @@ -14,7 +14,7 @@ pub struct FlyCamera { /// The current velocity of the FlyCamera. This value is always up-to-date, enforced by [FlyCameraPlugin](struct.FlyCameraPlugin.html) pub velocity: Vec3, } -impl Default for FlyCamera { +impl Default for Player { fn default() -> Self { Self { speed: 1.5, @@ -62,7 +62,7 @@ fn movement_axis( fn camera_movement_system( time: Res