[−][src]Struct monotron_api::Api
This structure contains all the function pointers the application can use to access OS functions.
Fields
putchar: extern "C" fn(ch: u8) -> i32
Old function for writing a single 8-bit character to the screen.
puts: extern "C" fn(string: *const u8) -> i32
Old function for writing a null-terminated 8-bit string to the screen.
readc: extern "C" fn() -> i32
Old function for reading one byte from stdin, blocking.
kbhit: extern "C" fn() -> i32
Old function for checking if readc() would block.
move_cursor: extern "C" fn(row: u8, col: u8)
Old function for moving the cursor on screen. To be replaced with ANSI escape codes.
play: extern "C" fn(frequency: u32, channel: u8, volume: u8, waveform: u8) -> i32
Old function for playing a note.
change_font: extern "C" fn(font_id: u32, font_data: *const u8)
Old function for changing the on-screen font.
get_joystick: extern "C" fn() -> u8
Old function for reading the Joystick status.
set_cursor_visible: extern "C" fn(enabled: u8)
Old function for turning the cursor on/off.
read_char_at: extern "C" fn(row: u8, col: u8) -> u16
Old function for reading the contents of the screen.
wfvbi: extern "C" fn()
Wait for next vertical blanking interval.
open: extern "C" fn(filename: BorrowedString, mode: OpenMode) -> HandleResult
Open/create a device/file. Returns a file handle, or an error.
close: extern "C" fn(handle: Handle) -> EmptyResult
Close a previously opened handle.
read: extern "C" fn(handle: Handle, buffer: *mut u8, buffer_len: usize) -> SizeResult
Read from a file handle into the given buffer. Returns an error, or
the number of bytes read (which may be less than buffer_len
).
write: extern "C" fn(handle: Handle, buffer: *const u8, buffer_len: usize) -> SizeResult
Write the contents of the given buffer to a file handle. Returns an
error, or the number of bytes written (which may be less than
buffer_len
).
write_then_read: extern "C" fn(handle: Handle, out_buffer: *const u8, out_buffer_len: usize, in_buffer: *mut u8, in_buffer_len: usize) -> SizeResult
Write to the handle and the read from the handle. Useful when doing an
I2C read of a specific address. It is an error if the complete
out_buffer
could not be written.
seek: extern "C" fn(handle: Handle, offset: Offset) -> EmptyResult
Move the read/write pointer in a file.
opendir: extern "C" fn(filename: BorrowedString) -> HandleResult
Open a directory. Returns a file handle, or an error.
readdir: extern "C" fn(handle: Handle, dir_entry: &mut DirEntry) -> EmptyResult
Read directory entry into given buffer.
stat: extern "C" fn(filename: BorrowedString, stat_entry: &mut DirEntry) -> EmptyResult
Get information about a file by path
gettime: extern "C" fn() -> Timestamp
Get the current time
puts_utf8: extern "C" fn(string: *const u8, length: usize)
Old function for writing a UTF-8 string to the screen.
map_line: extern "C" fn(actual_scanline: u16, drawn_scanline: u16)
Maps an actual line on the screen to be drawn as if it was somewhere else on the screen.
So if you ran this, the image would look completely normal:
for x in 0..576 { map_line(x, x); }
But if you did this, the screen would be upside down.
for x in 0..576 { map_line(x, 576 - x); }
And if you did this, the top 32 scanlines on the screen would repeat all the way down.
for x in 0..576 { map_line(x, x % 32); }
get_cursor: extern "C" fn(row: *mut u8, col: *mut u8)
Get the current cursor position
Auto Trait Implementations
Blanket Implementations
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,