diff --git a/Cargo.lock b/Cargo.lock index 0c0372d6..ab0e35b1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1549,6 +1549,15 @@ dependencies = [ "nohash-hasher", ] +[[package]] +name = "egui_extras" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "877bfcce06463cdbcfd7f4efd57608b1384d6d9ae03b33e503fbba1d1a899a52" +dependencies = [ + "egui", +] + [[package]] name = "either" version = "1.7.0" @@ -2282,7 +2291,7 @@ checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" [[package]] name = "leafwing_input_manager" version = "0.5.0" -source = "git+https://github.com/Leafwing-Studios/leafwing-input-manager.git?rev=e8bd6e0#e8bd6e00886f45cd37c3289cf2a726b514058fda" +source = "git+https://github.com/zicklag/leafwing-input-manager.git?branch=backport-leafwing-dev-to-bevy-0.7#000cee2ae7bc1bf206d63c3a2dfbacbb07fa23f2" dependencies = [ "bevy_app", "bevy_core", @@ -2303,7 +2312,7 @@ dependencies = [ [[package]] name = "leafwing_input_manager_macros" version = "0.5.0" -source = "git+https://github.com/Leafwing-Studios/leafwing-input-manager.git?rev=e8bd6e0#e8bd6e00886f45cd37c3289cf2a726b514058fda" +source = "git+https://github.com/zicklag/leafwing-input-manager.git?branch=backport-leafwing-dev-to-bevy-0.7#000cee2ae7bc1bf206d63c3a2dfbacbb07fa23f2" dependencies = [ "proc-macro-crate", "proc-macro2", @@ -3156,6 +3165,7 @@ dependencies = [ "bevy_mod_debugdump", "bevy_rapier2d", "directories", + "egui_extras", "fluent", "getrandom", "iyes_loopless", diff --git a/Cargo.toml b/Cargo.toml index b013b034..e09db2e6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ anyhow = "1.0.58" bevy = "0.7.0" bevy-parallax = "0.1.2" bevy_egui = "0.14" +egui_extras = "0.18.0" bevy_kira_audio = { version = "0.10.0", features = ["mp3"] } bevy_rapier2d = { version = "0.14.1", features = ["debug-render"] } iyes_loopless = "0.6.1" @@ -22,7 +23,7 @@ getrandom = { version = "0.2", features = ["js"] } bevy_mod_debugdump = { version = "0.4", optional = true } bevy-inspector-egui = { version = "0.11", optional = true } bevy-inspector-egui-rapier = { version = "0.4", optional = true, features = ["rapier2d"] } -leafwing_input_manager = { git = "https://github.com/Leafwing-Studios/leafwing-input-manager.git", rev = "e8bd6e0" } +leafwing_input_manager = { git = "https://github.com/zicklag/leafwing-input-manager.git", branch = "backport-leafwing-dev-to-bevy-0.7" } unic-langid = "0.9.0" bevy_fluent = { git = "https://github.com/kgv/bevy_fluent", rev = "d41f514" } sys-locale = "0.2.1" diff --git a/assets/default.game.yaml b/assets/default.game.yaml index da116f8c..3b2cf816 100644 --- a/assets/default.game.yaml +++ b/assets/default.game.yaml @@ -8,7 +8,7 @@ main_menu: title_font: family: ark color: [0, 0, 0] - size: 55 + size: 40 background_image: image: ui/main-menu-background.png @@ -16,179 +16,77 @@ main_menu: music: ui/Fishycuffs [title screen].ogg -default_input_maps: - players: - # Player 1 - - Move: - - VirtualDPad: - up: - Keyboard: W - down: - Keyboard: S - left: - Keyboard: A - right: - Keyboard: D - - VirtualDPad: - up: - GamepadButton: DPadUp - down: - GamepadButton: DPadDown - left: - GamepadButton: DPadLeft - right: - GamepadButton: DPadRight - - Single: - DualGamepadAxis: - x_axis: LeftStickX - y_axis: LeftStickY - x_positive_low: 0.1 - x_negative_low: -0.1 - y_positive_low: 0.1 - y_negative_low: -0.1 - FlopAttack: - - Single: - Keyboard: Space - - Single: - GamepadButton: South - Throw: - - Single: - Keyboard: C - - Single: - GamepadButton: West - Shoot: - - Single: - Keyboard: V - - Single: - GamepadButton: East - # Player 2 - - Move: - - VirtualDPad: - up: - Keyboard: Up - down: - Keyboard: Down - left: - Keyboard: Left - right: - Keyboard: Right - - Single: - DualGamepadAxis: - x_axis: LeftStickX - y_axis: LeftStickY - x_positive_low: 0.1 - x_negative_low: -0.1 - y_positive_low: 0.1 - y_negative_low: -0.1 - - VirtualDPad: - up: - GamepadButton: DPadUp - down: - GamepadButton: DPadDown - left: - GamepadButton: DPadLeft - right: - GamepadButton: DPadRight - FlopAttack: - - Single: - Keyboard: Comma - - Single: - GamepadButton: South - Throw: - - Single: - Keyboard: Period - - Single: - GamepadButton: West - Shoot: - - Single: - Keyboard: RShift - - Single: - GamepadButton: East - - camera: - Up: - - Chord: - - Keyboard: Up - - Keyboard: LControl - Down: - - Chord: - - Keyboard: Down - - Keyboard: LControl - Left: - - Chord: - - Keyboard: Left - - Keyboard: LControl - Right: - - Chord: - - Keyboard: Right - - Keyboard: LControl - ZoomIn: - - Chord: - - Keyboard: Equals - - Keyboard: LControl - ZoomOut: - - Chord: - - Keyboard: Minus - - Keyboard: LControl - - menu: - Confirm: - - Single: - GamepadButton: South - - Single: - GamepadButton: Start - Forward: - - Single: - Keyboard: Down - - Single: - Keyboard: Right - - Single: - GamepadButton: DPadDown - - Single: - GamepadButton: DPadRight - - Single: - GamepadButton: Select - - Single: - SingleGamepadAxis: - axis: LeftStickY +default_settings: + player_controls: + # Gamepad controls + gamepad: + movement: + up: + SingleAxis: + axis_type: + Gamepad: LeftStickY + positive_low: 0.1 + negative_low: -1.0 + left: + SingleAxis: + axis_type: + Gamepad: LeftStickX positive_low: 1.0 - negative_low: -0.5 - - Single: - SingleGamepadAxis: - axis: LeftStickX + negative_low: -0.1 + down: + SingleAxis: + axis_type: + Gamepad: LeftStickY + positive_low: 1.0 + negative_low: -0.1 + right: + SingleAxis: + axis_type: + Gamepad: LeftStickX + positive_low: 0.1 negative_low: -1.0 - positive_low: 0.5 - Backward: - - Single: - Keyboard: Left - - Single: + flop_attack: + GamepadButton: South + shoot: + GamepadButton: East + throw: + GamepadButton: West + + # Controls for the first keyboard player ( left side ) + keyboard1: + movement: + up: + Keyboard: W + down: + Keyboard: S + left: + Keyboard: A + right: + Keyboard: D + flop_attack: + Keyboard: Space + shoot: + Keyboard: V + throw: + Keyboard: C + + # Controls for the second keyboard player ( right side ) + keyboard2: + movement: + up: Keyboard: Up - - Single: - GamepadButton: DPadLeft - - Single: - GamepadButton: DPadUp - - Single: - SingleGamepadAxis: - axis: LeftStickY - negative_low: -1.0 - positive_low: 0.5 - - Single: - SingleGamepadAxis: - axis: LeftStickX - negative_low: -0.5 - positive_low: 1.0 - Pause: - - Single: - Keyboard: Escape - - Single: - Keyboard: P - - Single: - GamepadButton: Start - ToggleFullscreen: - - Single: - Keyboard: F11 - - Single: - GamepadButton: Mode + down: + Keyboard: Down + left: + Keyboard: Left + right: + Keyboard: Right + flop_attack: + Keyboard: Comma + shoot: + Keyboard: RShift + throw: + Keyboard: Period ui_theme: font_families: @@ -199,6 +97,14 @@ ui_theme: family: ark size: 30 color: [0, 0, 0] + bigger: + family: ark + size: 20 + color: [0, 0, 0] + normal: + family: ark + size: 15 + color: [0, 0, 0] hud: font: @@ -247,19 +153,19 @@ ui_theme: bottom: 11 left: 11 right: 11 - scale: 4.0 + scale: 3.0 button_styles: - jumbo: + normal: font: family: ark color: [255, 255, 255] - size: 30 + size: 17 padding: - top: 12 - left: 12 - right: 12 - bottom: 16 + top: 8 + left: 8 + right: 8 + bottom: 10 borders: default: image: ui/green-button.png @@ -269,7 +175,7 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 3 + scale: 2 focused: image: ui/green-button-focused.png image_size: [14, 14] @@ -278,7 +184,7 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 3 + scale: 2 clicked: image: ui/green-button-down.png image_size: [14, 14] @@ -287,18 +193,18 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 3 + scale: 2 - normal: + small: font: family: ark color: [255, 255, 255] - size: 20 + size: 15 padding: - top: 8 - left: 8 - right: 8 - bottom: 10 + top: 4 + left: 4 + right: 4 + bottom: 6 borders: default: image: ui/green-button.png @@ -308,7 +214,7 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 2 + scale: 1 focused: image: ui/green-button-focused.png image_size: [14, 14] @@ -317,7 +223,7 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 2 + scale: 1 clicked: image: ui/green-button-down.png image_size: [14, 14] @@ -326,7 +232,7 @@ ui_theme: bottom: 5 right: 5 left: 5 - scale: 2 + scale: 1 translations: # This is the locale that we will fallback to if the selected locale doesn't have diff --git a/assets/locales/en-US/main.ftl b/assets/locales/en-US/main.ftl index c4ee956c..1f1bd834 100644 --- a/assets/locales/en-US/main.ftl +++ b/assets/locales/en-US/main.ftl @@ -3,8 +3,31 @@ title = Fish Fight Punchy start-game = Start Game +settings = Settings +quit = Quit +cancel = Cancel +save = Save # Pause Menu paused = Paused continue = Continue -main-menu = Main Menu \ No newline at end of file +main-menu = Main Menu + +# Settings Menu +controls = Controls +sound = Sound +reset = Reset + +# Controls +action = Action +keyboard-1 = Keyboard 1 +keyboard-2 = Keyboard 2 +gamepad = Gamepad +move-up = Move Up +move-down = Move Down +move-left = Move Left +move-right = Move Right +flop-attack = Flop Attack +shoot = Shoot +throw = Throw +bind-input = Press an input or press Escape to cancel. \ No newline at end of file diff --git a/src/camera.rs b/src/camera.rs index 16ebc786..931c3180 100644 --- a/src/camera.rs +++ b/src/camera.rs @@ -1,17 +1,10 @@ use bevy::{ - core::Time, math::Vec2, - prelude::{ - Camera, Component, EventWriter, OrthographicProjection, Query, Res, ResMut, Transform, - With, Without, - }, - render::camera::CameraProjection, - window::Windows, + prelude::{Camera, Component, EventWriter, Query, Res, Transform, With, Without}, }; use bevy_parallax::ParallaxMoveEvent; -use leafwing_input_manager::prelude::ActionState; -use crate::{consts, input::CameraAction, metadata::GameMeta, Player}; +use crate::{consts, metadata::GameMeta, Player}; #[cfg_attr(feature = "debug", derive(bevy_inspector_egui::Inspectable))] #[derive(Component)] @@ -19,53 +12,6 @@ pub struct Panning { pub offset: Vec2, } -pub fn helper_camera_controller( - mut query: Query<( - &mut Camera, - &mut OrthographicProjection, - &mut Panning, - &ActionState, - )>, - time: Res