mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
addressed code quality issues noted by pipeline
This commit is contained in:
parent
8fd30ea55b
commit
77fb2150d9
@ -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};
|
||||
|
@ -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,
|
||||
|
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user