[−][src]Struct chipo::Chip8
A chip-8 emulator.
Methods
impl Chip8
[src]
impl Chip8
pub fn new() -> Self
[src]
pub fn new() -> Self
Constructs a new Chip8
.
pub fn load_rom(&mut self, rom: &[u8], should_wrap: bool)
[src]
pub fn load_rom(&mut self, rom: &[u8], should_wrap: bool)
Loads a rom and sets the drawing mode of the emulator. If should_wrap
is true, then all
pixels drawn outside of the drawable area will wrap to the other side, else they will be
ignored.
pub fn execute_cycle(&mut self)
[src]
pub fn execute_cycle(&mut self)
Runs one fetch-decode-execute cycle.
pub fn decrement_timers(&mut self)
[src]
pub fn decrement_timers(&mut self)
Decrement the delay and sound timer by one tick.
pub fn screen(&self) -> *const u8
[src]
pub fn screen(&self) -> *const u8
Returns a pointer to a byte array that represents the screen. The screen will have
screen_width * screen_height / 8
bytes in row-major order. Each byte represents 8 bits in
little-endian. 1
represents that the pixel is black, while 0
represents that the pixel
is white.
pub fn screen_width(&self) -> usize
[src]
pub fn screen_width(&self) -> usize
Returns the width of the screen in pixels.
pub fn screen_height(&self) -> usize
[src]
pub fn screen_height(&self) -> usize
Returns the height of the screen in pixels.
pub fn press_key(&mut self, index: usize)
[src]
pub fn press_key(&mut self, index: usize)
Sets the state of a key to be pressed. index
is the index of the key in row-major order.
pub fn release_key(&mut self, index: usize)
[src]
pub fn release_key(&mut self, index: usize)
Sets the state of a key to be released. index
is the index of the key in row-major order.
pub fn should_draw(&self) -> bool
[src]
pub fn should_draw(&self) -> bool
Returns true
if the screen has been updated and should be redrawn.
pub fn should_beep(&self) -> bool
[src]
pub fn should_beep(&self) -> bool
Returns true
if the a beep should be made.
pub fn program_counter(&self) -> u16
[src]
pub fn program_counter(&self) -> u16
Returns the value of the program counter register.
pub fn index(&self) -> u16
[src]
pub fn index(&self) -> u16
Returns the value of the index register.
pub fn registers(&self) -> *const u8
[src]
pub fn registers(&self) -> *const u8
Returns a pointer to a byte array that represents the 16 data registers.
Trait Implementations
Auto Trait Implementations
Blanket Implementations
impl<T, U> Into for T where
U: From<T>,
[src]
impl<T, U> Into for T where
U: From<T>,
impl<T> From for T
[src]
impl<T> From for T
impl<T, U> TryFrom for T where
T: From<U>,
[src]
impl<T, U> TryFrom for T where
T: From<U>,
type Error = !
try_from
)The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
try_from
)Performs the conversion.
impl<T> Borrow for T where
T: ?Sized,
[src]
impl<T> Borrow for T where
T: ?Sized,
impl<T> BorrowMut for T where
T: ?Sized,
[src]
impl<T> BorrowMut for T where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
impl<T, U> TryInto for T where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
try_from
)The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
try_from
)Performs the conversion.
impl<T> Any for T where
T: 'static + ?Sized,
[src]
impl<T> Any for T where
T: 'static + ?Sized,
fn get_type_id(&self) -> TypeId
[src]
fn get_type_id(&self) -> TypeId
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Gets the TypeId
of self
. Read more