From e371f95a4b3cfa078e6a6d2f9281a5d809dd63b2 Mon Sep 17 00:00:00 2001 From: Quaternions Date: Thu, 9 Jan 2025 21:14:17 -0800 Subject: [PATCH] a --- strafe-client/src/session.rs | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/strafe-client/src/session.rs b/strafe-client/src/session.rs index cedc503..8e70397 100644 --- a/strafe-client/src/session.rs +++ b/strafe-client/src/session.rs @@ -1,3 +1,4 @@ +use strafesnet_common::instruction::{InstructionConsumer, InstructionEmitter}; // session represents the non-hardware state of the client. // Ideally it is a deterministic state which is atomically updated by instructions, same as the simulation state. use strafesnet_common::physics::{Instruction as PhysicsInputInstruction,Time as PhysicsTime}; @@ -77,3 +78,31 @@ impl Session{ } } } + +// mouseinterpolator consumes RawInputInstruction +// mouseinterpolator emits PhysicsInputInstruction +// mouseinterpolator consumes DropInstruction to move on to the next emitted instruction +// Session comsumes SessionInstruction -> forwards RawInputInstruction to mouseinterpolator +// Session consumes DropInstruction -> forwards DropInstruction to mouseinterpolator +// Session emits DropInstruction + +impl InstructionConsumer for Session{ + type TimeInner=SessionTimeInner; + fn process_instruction(&mut self,instruction:strafesnet_common::instruction::TimedInstruction){ + // send it down to MouseInterpolator + self.mouse_interpolator.process_instruction(ins); + } +} +impl<'a> InstructionConsumer> for Session{ + type TimeInner=SessionTimeInner; + fn process_instruction(&mut self,instruction:strafesnet_common::instruction::TimedInstruction){ + // send it down to MouseInterpolator + self.mouse_interpolator.process_instruction(ins); + } +} +impl<'a> InstructionEmitter> for Session{ + type TimeInner=SessionTimeInner; + fn next_instruction(&self,time_limit:strafesnet_common::integer::Time)->Option>{ + self.mouse_interpolator.next_instruction(time_limit) + } +}