Skip to content

Commit

Permalink
Remove Unneeded Input Toggle Resource
Browse files Browse the repository at this point in the history
  • Loading branch information
zicklag committed Jul 18, 2022
1 parent 47ba38a commit 21fb9a8
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
1 change: 0 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,6 @@ fn main() {
.add_plugin(RapierPhysicsPlugin::<NoUserData>::pixels_per_meter(100.0))
.add_plugin(InputManagerPlugin::<PlayerAction>::default())
.add_plugin(InputManagerPlugin::<MenuAction>::default())
.insert_resource(ToggleActions::<MenuAction>::default())
.add_plugin(AttackPlugin)
.add_plugin(AnimationPlugin)
.add_plugin(AudioPlugin)
Expand Down
7 changes: 1 addition & 6 deletions src/ui.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use bevy::{prelude::*, utils::HashMap, window::WindowId};
use bevy_egui::{egui, EguiContext, EguiInput, EguiPlugin, EguiSettings};
use iyes_loopless::prelude::*;
use leafwing_input_manager::{plugin::ToggleActions, prelude::ActionState};
use leafwing_input_manager::prelude::ActionState;

use crate::{assets::EguiFont, audio::*, input::MenuAction, metadata::GameMeta, GameState};

Expand Down Expand Up @@ -118,18 +118,13 @@ impl<'a> WidgetAdjacencyEntry<'a> {
fn handle_menu_input(
mut windows: ResMut<Windows>,
input: Query<&ActionState<MenuAction>>,
input_toggle: Res<ToggleActions<MenuAction>>,
mut egui_inputs: ResMut<HashMap<WindowId, EguiInput>>,
adjacencies: Res<WidgetAdjacencies>,
mut egui_ctx: ResMut<EguiContext>,
) {
use bevy::window::WindowMode;
let input = input.single();

if !input_toggle.enabled {
return;
}

// Handle fullscreen toggling
if input.just_pressed(MenuAction::ToggleFullscreen) {
if let Some(window) = windows.get_primary_mut() {
Expand Down

0 comments on commit 21fb9a8

Please sign in to comment.