(snapshot: &mut InputSnapshot, event: &InputEvent)
| 193 | pub fn is_empty(&self) -> bool { |
| 194 | self.events.is_empty() |
| 195 | } |
| 196 | |
| 197 | #[inline] |
| 198 | pub fn dropped_events(&self) -> u64 { |
| 199 | self.dropped_events |
| 200 | } |
| 201 | } |
| 202 | |
| 203 | fn apply_event(snapshot: &mut InputSnapshot, event: &InputEvent) { |
| 204 | match event { |
| 205 | InputEvent::Key { key, is_down } => snapshot.set_key_state(*key, *is_down), |
| 206 | InputEvent::Text(text) => snapshot.push_text_input(text.clone()), |
| 207 | InputEvent::MouseButton { button, is_down } => { |
| 208 | snapshot.set_mouse_button_state(*button, *is_down) |
| 209 | } |
| 210 | InputEvent::MouseDelta { dx, dy } => snapshot.add_mouse_delta(*dx, *dy), |
| 211 | InputEvent::MouseWheel { dx, dy } => snapshot.add_mouse_wheel(*dx, *dy), |
| 212 | InputEvent::MousePosition { x, y } => snapshot.set_mouse_position(*x, *y), |
| 213 | InputEvent::MouseMode(mode) => snapshot.set_mouse_mode_state(*mode), |
| 214 | InputEvent::ViewportSize { width, height } => snapshot.set_viewport_size(*width, *height), |
| 215 | InputEvent::GamepadConnected { index, connected } => { |
| 216 | snapshot.set_gamepad_connected(*index, *connected) |
| 217 | } |
| 218 | InputEvent::GamepadButton { |
| 219 | index, |
| 220 | button, |
| 221 | is_down, |
| 222 | } => snapshot.set_gamepad_button_state(*index, *button, *is_down), |
| 223 | InputEvent::GamepadAxis { index, axis, value } => { |
| 224 | snapshot.set_gamepad_axis(*index, *axis, *value) |
| 225 | } |
| 226 | InputEvent::GamepadGyro { index, x, y, z } => snapshot.set_gamepad_gyro(*index, *x, *y, *z), |
| 227 | InputEvent::GamepadAccel { index, x, y, z } => { |
| 228 | snapshot.set_gamepad_accel(*index, *x, *y, *z) |
| 229 | } |
| 230 | InputEvent::JoyConButton { |
| 231 | index, |
| 232 | button, |
| 233 | is_down, |
| 234 | } => snapshot.set_joycon_button_state(*index, *button, *is_down), |
| 235 | InputEvent::JoyConStick { index, stick } => snapshot.set_joycon_stick_unit(*index, *stick), |
| 236 | InputEvent::JoyConSide { index, side } => snapshot.set_joycon_side(*index, *side), |
| 237 | InputEvent::JoyConGeneration { index, generation } => { |
| 238 | snapshot.set_joycon_generation(*index, *generation) |
| 239 | } |
| 240 | InputEvent::JoyConConnected { index, connected } => { |
| 241 | snapshot.set_joycon_connected(*index, *connected) |
| 242 | } |
| 243 | InputEvent::JoyConCalibrated { index, calibrated } => { |
| 244 | snapshot.set_joycon_calibrated(*index, *calibrated) |
| 245 | } |
| 246 | InputEvent::JoyConCalibrationInProgress { index, in_progress } => { |
| 247 | snapshot.set_joycon_calibration_in_progress(*index, *in_progress) |
| 248 | } |
| 249 | InputEvent::JoyConCalibrationBias { index, x, y, z } => { |
| 250 | snapshot.set_joycon_calibration_bias(*index, *x, *y, *z) |
| 251 | } |
| 252 | InputEvent::JoyConGyro { index, x, y, z } => snapshot.set_joycon_gyro(*index, *x, *y, *z), |
no test coverage detected