diff --git a/src/gamepad.rs b/src/gamepad.rs deleted file mode 100644 index 623ec2e..0000000 --- a/src/gamepad.rs +++ /dev/null @@ -1,43 +0,0 @@ -/* - * Mageanoid - A computer game - * Copyright (C) 2024 Frank Mayer - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - */ - -use bevy::input::gamepad::*; -use bevy::prelude::*; - -use crate::player::PlayerPlugin; - -fn gamepad_system( - mut gamepads: ResMut, - axes: Res>, - button_inputs: Res>, - button_axes: Res>, -) { - for gamepad in gamepads.iter() { - let left_stick_x = axes.get(GamepadAxis::new(gamepad, GamepadAxisType::LeftStickX)); - let left_stick_y = axes.get(GamepadAxis::new(gamepad, GamepadAxisType::LeftStickY)); - info!("{:?} left stick: ({:?}, {:?})", gamepad, left_stick_x, left_stick_y); - } -} - -pub struct GamepadPlugin; - -impl Plugin for GamepadPlugin { - fn build(&self, app: &mut App) { - app.add_systems(Update, gamepad_system); - } -} diff --git a/src/main.rs b/src/main.rs index d8e0cde..3b9467c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -21,14 +21,12 @@ use bevy::prelude::*; mod player; mod cam; mod movement; -mod gamepad; fn main() { App::new() .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest())) .add_plugins(player::PlayerPlugin) .add_plugins(movement::MovementPlugin) - .add_plugins(gamepad::GamepadPlugin) .add_plugins(cam::CamPlugin) .run(); } diff --git a/src/player.rs b/src/player.rs index b1d274a..84a386e 100644 --- a/src/player.rs +++ b/src/player.rs @@ -111,16 +111,12 @@ fn player_input( if let Some(left_stick_x) = axes.get(GamepadAxis::new(gamepad, GamepadAxisType::LeftStickX)) { if left_stick_x.abs() > 0.1 { velocity.value.x = left_stick_x * PLAYER_MOVE_SPEED; - } else { - velocity.value.x = 0.0; } } if let Some(left_stick_y) = axes.get(GamepadAxis::new(gamepad, GamepadAxisType::LeftStickY)) { if left_stick_y.abs() > 0.1 { velocity.value.y = left_stick_y * PLAYER_MOVE_SPEED; - } else { - velocity.value.y = 0.0; } } }