pub struct InputRecorder {
pub recording: bool,
pub metadata: ReplayMetadata,
/* private fields */
}Expand description
Records inputs during gameplay.
Fields§
§recording: bool§metadata: ReplayMetadataImplementations§
Source§impl InputRecorder
impl InputRecorder
pub fn new(seed: u64) -> Self
pub fn start(&mut self)
pub fn stop(&mut self) -> ReplayFile
Sourcepub fn tick_frame(&mut self)
pub fn tick_frame(&mut self)
Call once per frame to advance the frame counter.
Sourcepub fn record(&mut self, event: InputEvent)
pub fn record(&mut self, event: InputEvent)
Record an input event on the current frame.
pub fn record_key_down(&mut self, keycode: u32)
pub fn record_key_up(&mut self, keycode: u32)
pub fn record_mouse_move(&mut self, x: f32, y: f32)
Sourcepub fn push_snapshot(&mut self, state_bytes: Vec<u8>)
pub fn push_snapshot(&mut self, state_bytes: Vec<u8>)
Push a state snapshot (call when frame % snapshot_interval == 0).
pub fn current_frame(&self) -> u32
pub fn event_count(&self) -> usize
Auto Trait Implementations§
impl Freeze for InputRecorder
impl RefUnwindSafe for InputRecorder
impl Send for InputRecorder
impl Sync for InputRecorder
impl Unpin for InputRecorder
impl UnsafeUnpin for InputRecorder
impl UnwindSafe for InputRecorder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.