From 992d3868458a61126e0f63edd058dfbb16f540c9 Mon Sep 17 00:00:00 2001 From: Muhammad Nauman Raza Date: Mon, 4 Dec 2023 21:17:34 +0000 Subject: [PATCH] refactor: move player code to separate file Former-commit-id: cbb76f5546b8f782f0d86ed219f27b4cf2367f7a --- src/main.rs | 70 +++------------------------------------------------ src/player.rs | 68 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 67 deletions(-) create mode 100644 src/player.rs diff --git a/src/main.rs b/src/main.rs index 306402e..9073573 100644 --- a/src/main.rs +++ b/src/main.rs @@ -8,6 +8,9 @@ use std::collections::HashMap; mod helpers; use crate::helpers::*; +mod player; +use crate::player::*; + const VERSION: &str = env!("CARGO_PKG_VERSION"); const PKGNAME: &str = env!("CARGO_PKG_NAME"); @@ -67,13 +70,6 @@ struct OpenWindows { login_open: bool, } -// Define the player component -#[derive(Component)] -struct Player { - movement_speed: f32, - rotation_speed: f32, -} - // Bevy engine setup fn setup(mut commands: Commands, asset_server: Res) { commands.spawn(Camera2dBundle { @@ -112,66 +108,6 @@ fn setup_ui(mut contexts: EguiContexts) { contexts.ctx_mut().set_fonts(fonts); } -// Define the player movement system -fn movement( - time: Res