mirror of
https://github.com/4yn/slidershim.git
synced 2024-11-12 00:40:49 +01:00
add start/options to fn buttons
This commit is contained in:
parent
1d9e52b92f
commit
32045ffa61
@ -59,7 +59,7 @@ impl OutputHandler for HoriOutput {
|
||||
fn tick(&mut self, flat_input: &Vec<bool>) -> bool {
|
||||
let hori_state = match self.slider_only {
|
||||
false => HoriState::from_flat(flat_input),
|
||||
true => HoriState::from_flat_to_wide(flat_input)
|
||||
true => HoriState::from_flat_to_wide(flat_input),
|
||||
};
|
||||
|
||||
let buttons: u16 = hori_state
|
||||
@ -78,7 +78,11 @@ impl OutputHandler for HoriOutput {
|
||||
true => code,
|
||||
false => 0,
|
||||
}
|
||||
});
|
||||
})
|
||||
| match hori_state.extra[0] {
|
||||
true => 1 << 13, // options
|
||||
false => 0,
|
||||
};
|
||||
|
||||
let axis: u32 = hori_state
|
||||
.slider
|
||||
|
@ -1,6 +1,7 @@
|
||||
pub struct HoriState {
|
||||
pub slider: [bool; 16],
|
||||
pub bt: [bool; 4],
|
||||
pub extra: [bool; 1],
|
||||
}
|
||||
|
||||
impl HoriState {
|
||||
@ -8,6 +9,7 @@ impl HoriState {
|
||||
let mut hori_state = Self {
|
||||
slider: [false; 16],
|
||||
bt: [false; 4],
|
||||
extra: [false; 1],
|
||||
};
|
||||
|
||||
for (idx, i) in flat_input[0..32].iter().enumerate() {
|
||||
@ -22,6 +24,8 @@ impl HoriState {
|
||||
}
|
||||
}
|
||||
|
||||
hori_state.extra[0] = flat_input[38];
|
||||
|
||||
hori_state
|
||||
}
|
||||
|
||||
@ -29,12 +33,15 @@ impl HoriState {
|
||||
let mut hori_state = Self {
|
||||
slider: [false; 16],
|
||||
bt: [false; 4],
|
||||
extra: [false; 1],
|
||||
};
|
||||
|
||||
for (idx, i) in flat_input[0..32].iter().enumerate() {
|
||||
hori_state.slider[idx / 2] |= *i;
|
||||
}
|
||||
|
||||
hori_state.extra[0] = flat_input[38];
|
||||
|
||||
hori_state
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user