diff --git a/strafe-client/src/mouse_interpolator.rs b/strafe-client/src/mouse_interpolator.rs index 1f226ff..c05c599 100644 --- a/strafe-client/src/mouse_interpolator.rs +++ b/strafe-client/src/mouse_interpolator.rs @@ -1,8 +1,7 @@ use strafesnet_common::mouse::MouseState; use strafesnet_common::physics::{Instruction as PhysicsInputInstruction,Time as PhysicsTime,TimeInner as PhysicsTimeInner}; use strafesnet_common::session::{Time as SessionTime,TimeInner as SessionTimeInner}; -use strafesnet_common::instruction::TimedInstruction; -use strafesnet_common::timer::{Scaled,Timer,TimerState}; +use strafesnet_common::instruction::{self,TimedInstruction}; #[derive(Debug)] pub enum InputInstruction{ @@ -34,11 +33,23 @@ pub struct MouseInterpolator{ last_mouse_time:PhysicsTime, mouse_blocking:bool, } +impl instruction::InstructionConsumer for MouseInterpolator{ + type Instruction=Instruction; + type TimeInner=SessionTimeInner; + fn process_instruction(&mut self,ins:TimedInstruction){ + self.atomic_state_update(ins) + } +} +// InstructionEmitter does not make sense for MouseInterpolator, because it can emit multiple instructions. +impl instruction::InstructionEmitter for MouseInterpolator{ + type Instruction=PhysicsInputInstruction; + type TimeInner=PhysicsTimeInner; + fn next_instruction(&self,time_limit:PhysicsTime)->Option>{ + self.next_instruction_internal(time_limit) + } +} impl MouseInterpolator{ - pub fn new( - physics:crate::physics::PhysicsContext, - user_settings:crate::settings::UserSettings, - )->MouseInterpolator{ + pub fn new()->MouseInterpolator{ MouseInterpolator{ mouse_blocking:true, last_mouse_time:physics.get_next_mouse().time,