addressed code quality issues noted by pipeline

This commit is contained in:
JimmyDdotEXE 2023-06-15 23:24:30 -04:00
parent 8fd30ea55b
commit 77fb2150d9
3 changed files with 22 additions and 7 deletions

View File

@ -1,7 +1,9 @@
//! Module containing controller-specific abstractions allowing complex
//! keybindings
use crate::{game_input::GameInput, window::MenuInput, settings::gamepad::con_settings::LayerEntry};
use crate::{
game_input::GameInput, settings::gamepad::con_settings::LayerEntry, window::MenuInput,
};
use gilrs::{ev::Code as GilCode, Axis as GilAxis, Button as GilButton};
use hashbrown::HashMap;
use serde::{Deserialize, Serialize};

View File

@ -66,7 +66,7 @@ pub mod con_settings {
#[derive(Clone, Debug, Serialize, Deserialize)]
#[serde(default)]
pub struct GameLayerEntries {
pub primary: LayerEntry,
pub primary: LayerEntry,
pub secondary: LayerEntry,
pub block: LayerEntry,
pub slot1: LayerEntry,

View File

@ -3,7 +3,7 @@ use crate::{
error::Error,
game_input::GameInput,
render::Renderer,
settings::{ControlSettings, Settings, gamepad::con_settings::LayerEntry},
settings::{gamepad::con_settings::LayerEntry, ControlSettings, Settings},
ui,
};
use common_base::span;
@ -610,12 +610,25 @@ impl Window {
let l_entry: LayerEntry;
if modifiers.len() == 2 {
//this line uses the known modifiers from ControllerSettings so RB+LB represents the same layer as LB+RB
l_entry = LayerEntry { button: *button, mod1: settings.modifier_buttons[0], mod2: settings.modifier_buttons[1] };
// this uses the known modifiers from ControllerSettings so RB+LB
// represents the same layer as LB+RB
l_entry = LayerEntry {
button: *button,
mod1: settings.modifier_buttons[0],
mod2: settings.modifier_buttons[1],
};
} else if modifiers.len() == 1 {
l_entry = LayerEntry { button: *button, mod1: modifiers[0], mod2: Button::default() };
l_entry = LayerEntry {
button: *button,
mod1: modifiers[0],
mod2: Button::default(),
};
} else {
l_entry = LayerEntry { button: *button, mod1: Button::default(), mod2: Button::default() };
l_entry = LayerEntry {
button: *button,
mod1: Button::default(),
mod2: Button::default(),
};
}
if let Some(evs) = settings.layer_button_map.get(&l_entry) {