forked from StrafesNET/strafe-client
more
This commit is contained in:
parent
0b8a433640
commit
7f68fd9b21
@ -42,7 +42,11 @@ impl MouseInterpolator{
|
|||||||
Some(ins0)=>{
|
Some(ins0)=>{
|
||||||
let physics_input=match &ins0.instruction{
|
let physics_input=match &ins0.instruction{
|
||||||
InputInstruction::MoveMouse(mouse0)=>{
|
InputInstruction::MoveMouse(mouse0)=>{
|
||||||
loop{
|
//mouse instruction found.
|
||||||
|
//enter a new loop with different behaviour
|
||||||
|
//we have to wait for the next mouse event
|
||||||
|
//so there is a before and after interpolation target
|
||||||
|
'inner:loop{
|
||||||
match iter.next(){
|
match iter.next(){
|
||||||
Some(ins1)=>match ins1.instruction{
|
Some(ins1)=>match ins1.instruction{
|
||||||
InputInstruction::MoveMouse(mouse1)=>{
|
InputInstruction::MoveMouse(mouse1)=>{
|
||||||
@ -52,8 +56,13 @@ impl MouseInterpolator{
|
|||||||
//drain and handle the elements from the front
|
//drain and handle the elements from the front
|
||||||
break 'outer;
|
break 'outer;
|
||||||
},
|
},
|
||||||
_=>{
|
_=>if Time::from_millis(10)<ins1.time-ins0.time{
|
||||||
//TODO: 10ms<ins.time-time break and do something else
|
//we have passed more than 10ms of instructions and have not seen a mouse event.
|
||||||
|
//drop the iterator so we can consume the queue up to this point
|
||||||
|
std::mem::drop(iter);
|
||||||
|
//make a new iterator starting from the new beginning and loop like nothing happened
|
||||||
|
iter=self.queue.iter();
|
||||||
|
continue 'outer;
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
None=>{
|
None=>{
|
||||||
|
Loading…
Reference in New Issue
Block a user