forked from StrafesNET/strafe-client
wip
This commit is contained in:
parent
7f68fd9b21
commit
d898d7cf67
@ -58,8 +58,15 @@ impl MouseInterpolator{
|
||||
},
|
||||
_=>if Time::from_millis(10)<ins1.time-ins0.time{
|
||||
//we have passed more than 10ms of instructions and have not seen a mouse event.
|
||||
let consume_count=self.queue.len()-iter.len();
|
||||
//drop the iterator so we can consume the queue up to this point
|
||||
std::mem::drop(iter);
|
||||
//run an event to extrapolate no movement from
|
||||
let last_mouse=physics.get_next_mouse();
|
||||
physics.run_input_instruction(TimedInstruction{
|
||||
time:last_mouse.time,
|
||||
instruction:PhysicsInputInstruction::SetNextMouse(MouseState{time:ins1.time,pos:last_mouse.pos}),
|
||||
});
|
||||
//make a new iterator starting from the new beginning and loop like nothing happened
|
||||
iter=self.queue.iter();
|
||||
continue 'outer;
|
||||
@ -98,6 +105,10 @@ impl MouseInterpolator{
|
||||
time:ins0.time,
|
||||
instruction:physics_input,
|
||||
});
|
||||
//drop it and pop it! consume one element and continue the loop
|
||||
std::mem::drop(iter);
|
||||
self.queue.pop_front();
|
||||
iter=self.queue.iter();
|
||||
},
|
||||
None=>{
|
||||
//if mouse0 is never found and the loop ends, we can drain the entire queue
|
||||
|
Loading…
Reference in New Issue
Block a user