(&mut self, packet: u8)
| 159 | } |
| 160 | |
| 161 | pub fn proc_packet(&mut self, packet: u8) |
| 162 | { |
| 163 | match self.currentpacket |
| 164 | { |
| 165 | 0 => |
| 166 | { |
| 167 | let flags = MouseFlags::from_bits_truncate(packet); |
| 168 | if !flags.contains(MouseFlags::ALWAYS_ONE) |
| 169 | { |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | self.currentstate.flags = flags; |
| 174 | } |
| 175 | |
| 176 | 1 => self.proc_x_movement(packet), |
| 177 | |
| 178 | 2 => |
| 179 | { |
| 180 | self.proc_y_movement(packet); |
| 181 | self.completedstate = self.currentstate; |
| 182 | if let Some(on_complete) = self.on_complete |
| 183 | { |
| 184 | on_complete(self.completedstate); |
| 185 | } |
| 186 | } |
| 187 | |
| 188 | _ => unreachable!(), |
| 189 | } |
| 190 | |
| 191 | self.currentpacket = (self.currentpacket + 1) % 3; |
| 192 | } |
| 193 | |
| 194 | pub fn set_on_complete(&mut self, handler: fn(MouseState)) |
| 195 | { |
nothing calls this directly
no test coverage detected