change some function names

This commit is contained in:
Quaternions 2025-01-15 00:26:40 -08:00
parent ada34237c9
commit d393f9f187

View File

@ -62,7 +62,7 @@ impl MouseInterpolator{
output:std::collections::VecDeque::new(),
}
}
fn push_mouse(&mut self,ins:TimedInstruction<MouseInstruction,PhysicsTimeInner>){
fn push_mouse_and_flush_buffer(&mut self,ins:TimedInstruction<MouseInstruction,PhysicsTimeInner>){
self.buffer.push_front(TimedInstruction{
time:ins.time,
instruction:PhysicsInputInstruction::Mouse(ins.instruction),
@ -76,7 +76,7 @@ impl MouseInterpolator{
self.output.append(&mut self.buffer);
}
}
fn get_timedout_at(&self,time_limit:SessionTime)->Option<SessionTime>{
fn get_mouse_timedout_at(&self,time_limit:SessionTime)->Option<SessionTime>{
match &self.buffer_state{
BufferState::Unbuffered=>None,
BufferState::Initializing(time,_mouse_state)
@ -86,7 +86,7 @@ impl MouseInterpolator{
}
}
}
fn timeout(&mut self,time:PhysicsTime){
fn timeout_mouse(&mut self,time:PhysicsTime){
let buffer_state=core::mem::replace(&mut self.buffer_state,BufferState::Unbuffered);
match buffer_state{
BufferState::Unbuffered=>(),
@ -96,7 +96,7 @@ impl MouseInterpolator{
// use the first instruction which should be a mouse instruction
// to push a ReplaceMouse instruction
// duplicate the current mouse
self.push_mouse(TimedInstruction{
self.push_mouse_and_flush_buffer(TimedInstruction{
// This should be simulation_timer.time(timeout)
// but the timer is not accessible from this scope
// and it's just here to say that the mouse isn't moving anyways.
@ -120,8 +120,8 @@ impl MouseInterpolator{
// a mouse event is buffered, but no mouse events have transpired within 10ms
// push buffered mouse instruction and flush buffer to output
if self.get_timedout_at(ins.time).is_some(){
self.timeout(ins.instruction.time);
if self.get_mouse_timedout_at(ins.time).is_some(){
self.timeout_mouse(ins.instruction.time);
}
// replace_with allows the enum variant to safely be replaced from behind a mutable reference
let (ins_mouse,ins_other)=replace_with::replace_with_or_abort_and_return(&mut self.buffer_state,|buffer_state|{
@ -158,7 +158,7 @@ impl MouseInterpolator{
}
});
if let Some(ins)=ins_mouse{
self.push_mouse(ins);
self.push_mouse_and_flush_buffer(ins);
}
if let Some(ins)=ins_other{
let instruction=TimedInstruction{
@ -176,7 +176,7 @@ impl MouseInterpolator{
self.output.len()!=0
}
pub fn buffered_instruction_with_timeout(&self,time_limit:SessionTime)->Option<TimedInstruction<StepInstruction,SessionTimeInner>>{
match self.get_timedout_at(time_limit){
match self.get_mouse_timedout_at(time_limit){
Some(timeout)=>Some(TimedInstruction{
time:timeout,
instruction:StepInstruction::Timeout,
@ -191,7 +191,7 @@ impl MouseInterpolator{
pub fn pop_buffered_instruction(&mut self,ins:TimedInstruction<StepInstruction,PhysicsTimeInner>)->Option<TimedInstruction<PhysicsInputInstruction,PhysicsTimeInner>>{
match ins.instruction{
StepInstruction::Pop=>(),
StepInstruction::Timeout=>self.timeout(ins.time),
StepInstruction::Timeout=>self.timeout_mouse(ins.time),
}
self.output.pop_front()
}