pub struct ReplayRecorder { /* private fields */ }Expand description
Replay recorder for capturing gameplay
Implementations§
Source§impl ReplayRecorder
impl ReplayRecorder
Sourcepub fn new(game_name: &str, game_version: &str, seed: u64) -> Self
pub fn new(game_name: &str, game_version: &str, seed: u64) -> Self
Create a new replay recorder
Sourcepub const fn with_checkpoint_interval(self, interval: u64) -> Self
pub const fn with_checkpoint_interval(self, interval: u64) -> Self
Set the checkpoint interval
Sourcepub fn record_input(&mut self, event: InputEvent)
pub fn record_input(&mut self, event: InputEvent)
Record an input event
Sourcepub fn record_inputs(&mut self, events: &[InputEvent])
pub fn record_inputs(&mut self, events: &[InputEvent])
Record multiple input events
Sourcepub fn next_frame(&mut self, state_hash: Option<&str>)
pub fn next_frame(&mut self, state_hash: Option<&str>)
Advance to next frame and optionally record checkpoint
Sourcepub fn checkpoint(&mut self, state_hash: &str)
pub fn checkpoint(&mut self, state_hash: &str)
Record a checkpoint at current frame
Sourcepub fn checkpoint_with_data(
&mut self,
state_hash: &str,
data: HashMap<String, Value>,
)
pub fn checkpoint_with_data( &mut self, state_hash: &str, data: HashMap<String, Value>, )
Record a checkpoint with state data
Sourcepub const fn current_frame(&self) -> u64
pub const fn current_frame(&self) -> u64
Get current frame
Sourcepub const fn is_recording(&self) -> bool
pub const fn is_recording(&self) -> bool
Check if recording
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ReplayRecorder
impl RefUnwindSafe for ReplayRecorder
impl Send for ReplayRecorder
impl Sync for ReplayRecorder
impl Unpin for ReplayRecorder
impl UnsafeUnpin for ReplayRecorder
impl UnwindSafe for ReplayRecorder
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> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more