- fn set_mapping(&mut self, map: &Mapping) {
- self.mov.idx = map.axis.left_x;
- self.mov.idy = map.axis.left_y;
- self.aim.idx = map.axis.right_x;
- self.aim.idy = map.axis.right_y;
- self.jump.id = map.btn.left_shoulder;
- self.shoot.id = map.btn.right_shoulder;
- self.start.id = map.btn.start;
+ fn set_mapping(&mut self, action: &HashMap<ActionControls, DeviceControls>, device: &HashMap<DeviceControls, u8>) {
+ self.mov.idx = *action.get(&MovementX).map(|i| device.get(i)).flatten().unwrap();
+ self.mov.idy = *action.get(&MovementY).map(|i| device.get(i)).flatten().unwrap();
+ self.aim.idx = *action.get(&AimX).map(|i| device.get(i)).flatten().unwrap();
+ self.aim.idy = *action.get(&AimY).map(|i| device.get(i)).flatten().unwrap();
+ self.jump.id = *action.get(&Jump).map(|i| device.get(i)).flatten().unwrap();
+ self.shoot.id = *action.get(&Shoot).map(|i| device.get(i)).flatten().unwrap();
+ self.start.id = *action.get(&Start).map(|i| device.get(i)).flatten().unwrap();