a
This commit is contained in:
parent
b02c1bc7b4
commit
e371f95a4b
@ -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<Instruction> for Session{
|
||||
type TimeInner=SessionTimeInner;
|
||||
fn process_instruction(&mut self,instruction:strafesnet_common::instruction::TimedInstruction<Instruction,Self::TimeInner>){
|
||||
// send it down to MouseInterpolator
|
||||
self.mouse_interpolator.process_instruction(ins);
|
||||
}
|
||||
}
|
||||
impl<'a> InstructionConsumer<DropInstruction<'a>> for Session{
|
||||
type TimeInner=SessionTimeInner;
|
||||
fn process_instruction(&mut self,instruction:strafesnet_common::instruction::TimedInstruction<DropInstruction,Self::TimeInner>){
|
||||
// send it down to MouseInterpolator
|
||||
self.mouse_interpolator.process_instruction(ins);
|
||||
}
|
||||
}
|
||||
impl<'a> InstructionEmitter<DropInstruction<'a>> for Session{
|
||||
type TimeInner=SessionTimeInner;
|
||||
fn next_instruction(&self,time_limit:strafesnet_common::integer::Time<Self::TimeInner>)->Option<strafesnet_common::instruction::TimedInstruction<DropInstruction,Self::TimeInner>>{
|
||||
self.mouse_interpolator.next_instruction(time_limit)
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user