1
0
Fork 0
mirror of https://github.com/doukutsu-rs/doukutsu-rs synced 2024-11-21 21:22:44 +00:00

Fix button mapping icons for Nintendo controllers

This commit is contained in:
Dr. Glaucous 2024-06-23 13:18:17 -04:00 committed by alula
parent c19d0738fa
commit 44d5893a7a

View file

@ -1575,7 +1575,8 @@ impl EngineConstants {
string_table: HashMap::new(), string_table: HashMap::new(),
missile_flags: vec![200, 201, 202, 218, 550, 766, 880, 920, 1551], missile_flags: vec![200, 201, 202, 218, 550, 766, 880, 920, 1551],
locales: Vec::new(), locales: Vec::new(),
gamepad: GamepadConsts { gamepad: {
let mut holder = GamepadConsts {
button_rects: HashMap::from([ button_rects: HashMap::from([
(Button::North, GamepadConsts::rects(Rect::new(0, 0, 32, 16))), (Button::North, GamepadConsts::rects(Rect::new(0, 0, 32, 16))),
(Button::South, GamepadConsts::rects(Rect::new(0, 16, 32, 32))), (Button::South, GamepadConsts::rects(Rect::new(0, 16, 32, 32))),
@ -1600,6 +1601,16 @@ impl EngineConstants {
(Axis::TriggerLeft, GamepadConsts::rects(Rect::new(32, 64, 64, 80))), (Axis::TriggerLeft, GamepadConsts::rects(Rect::new(32, 64, 64, 80))),
(Axis::TriggerRight, GamepadConsts::rects(Rect::new(32, 80, 64, 96))), (Axis::TriggerRight, GamepadConsts::rects(Rect::new(32, 80, 64, 96))),
]), ]),
};
// Swap x-y and a-b buttons on nintendo map (must be done here to comply with the nicalis button table)
let button = holder.button_rects.get(&Button::North).unwrap()[3].clone();
holder.button_rects.get_mut(&Button::North).unwrap()[3] = holder.button_rects.get(&Button::West).unwrap()[3];
holder.button_rects.get_mut(&Button::West).unwrap()[3] = button;
let button = holder.button_rects.get(&Button::South).unwrap()[3].clone();
holder.button_rects.get_mut(&Button::South).unwrap()[3] = holder.button_rects.get(&Button::East).unwrap()[3];
holder.button_rects.get_mut(&Button::East).unwrap()[3] = button;
holder
}, },
stage_encoding: None, stage_encoding: None,
} }