pub struct System<T: Deref<Target = [u8]>, S: Screen, SO: SerialOutput, AS: AudioSpeaker> { /* private fields */ }
Implementations§
Source§impl<T: Deref<Target = [u8]>, S: Screen, SO: SerialOutput, AS: AudioSpeaker> System<T, S, SO, AS>
impl<T: Deref<Target = [u8]>, S: Screen, SO: SerialOutput, AS: AudioSpeaker> System<T, S, SO, AS>
pub fn new(rom: Rom<T>, screen: S, serial_output: SO, speaker: AS) -> Self
pub fn reset(&mut self)
Forward a button press to the joypad controller
let mut emu = System::new(rom, NoScreen, NoSerial, NoSpeaker);
emu.set_button(Button::A, true);
emu.set_button(Button::Up, true);
Sourcepub fn set_frame_rate(&mut self, fps: u32)
pub fn set_frame_rate(&mut self, fps: u32)
Sets the FPS (default = 60)
Sourcepub fn update_frame(&mut self) -> u32
pub fn update_frame(&mut self) -> u32
Execute enough steps to retrieve 1 frame
let mut emu = System::new(rom, NoScreen, NoSerial, NoSpeaker);
// loop {
let t0 = Instant::now();
emu.update_frame();
let frame_time = t0.elapsed();
let min_frame_time = emu.min_frame_time();
if frame_time < min_frame_time {
sleep(min_frame_time - frame_time);
}
// }
Sourcepub fn min_frame_time(&self) -> Duration
pub fn min_frame_time(&self) -> Duration
Returns the minimum amount of time to wait between each frame Mostly depend on the FPS
Auto Trait Implementations§
impl<T, S, SO, AS> Freeze for System<T, S, SO, AS>
impl<T, S, SO, AS> RefUnwindSafe for System<T, S, SO, AS>
impl<T, S, SO, AS> Send for System<T, S, SO, AS>
impl<T, S, SO, AS> Sync for System<T, S, SO, AS>
impl<T, S, SO, AS> Unpin for System<T, S, SO, AS>
impl<T, S, SO, AS> UnwindSafe for System<T, S, SO, AS>
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