pub struct MovieRecorder { /* private fields */ }Expand description
Records the per-frame input stream applied to an emulator.
Usage (caller-driven, mirrors the frontend’s per-frame loop):
let mut rec = MovieRecorder::power_on(&nes);
loop {
nes.set_buttons(0, p1);
nes.set_buttons(1, p2);
rec.capture(&nes); // BEFORE run_frame — captures the inputs it consumes
nes.run_frame();
}
let movie = rec.finish();Implementations§
Source§impl MovieRecorder
impl MovieRecorder
Sourcepub const fn power_on(nes: &Nes) -> Self
pub const fn power_on(nes: &Nes) -> Self
Begin recording a movie that starts from a fresh power-on of the ROM
nes is running. The caller is responsible for power-cycling nes
before the first captured frame so the recording starts from the same
state a replay will reconstruct.
Sourcepub fn from_current_state(nes: &Nes) -> Self
pub fn from_current_state(nes: &Nes) -> Self
Begin recording a movie that starts from nes’s current state (a
branch point). Captures a snapshot now and embeds it as the start
point; the input stream is recorded from here forward.
Sourcepub fn capture(&mut self, nes: &Nes)
pub fn capture(&mut self, nes: &Nes)
Record the controller inputs currently held on nes. Call this each
frame before Nes::run_frame, after the frontend has applied its
set_buttons calls — this captures exactly the inputs the upcoming
frame consumes.
Sourcepub fn capture_input(&mut self, input: FrameInput)
pub fn capture_input(&mut self, input: FrameInput)
Record an explicit frame of input (for callers that drive input
programmatically rather than through set_buttons).
Trait Implementations§
Source§impl Clone for MovieRecorder
impl Clone for MovieRecorder
Source§fn clone(&self) -> MovieRecorder
fn clone(&self) -> MovieRecorder
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more