TimedInstruction::set_time
This commit is contained in:
parent
fbacef83b9
commit
c2d6af8bda
@ -5,6 +5,14 @@ pub struct TimedInstruction<I,T>{
|
||||
pub time:Time<T>,
|
||||
pub instruction:I,
|
||||
}
|
||||
impl<I,T> TimedInstruction<I,T>{
|
||||
pub fn set_time<TimeInner>(self,new_time:Time<TimeInner>)->TimedInstruction<I,TimeInner>{
|
||||
TimedInstruction{
|
||||
time:new_time,
|
||||
instruction:self.instruction,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Ensure all emitted instructions are processed before consuming external instructions
|
||||
pub trait InstructionEmitter<I>{
|
||||
|
@ -181,12 +181,8 @@ impl InstructionConsumer<Instruction<'_>> for Session{
|
||||
impl InstructionConsumer<StepInstruction> for Session{
|
||||
type TimeInner=SessionTimeInner;
|
||||
fn process_instruction(&mut self,ins:TimedInstruction<StepInstruction,Self::TimeInner>){
|
||||
// ins.time ignored???
|
||||
let ins_retimed=TimedInstruction{
|
||||
time:self.simulation.timer.time(ins.time),
|
||||
instruction:ins.instruction,
|
||||
};
|
||||
if let Some(instruction)=self.mouse_interpolator.pop_buffered_instruction(ins_retimed){
|
||||
let time=self.simulation.timer.time(ins.time);
|
||||
if let Some(instruction)=self.mouse_interpolator.pop_buffered_instruction(ins.set_time(time)){
|
||||
self.simulation.physics.run_input_instruction(instruction);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user