pub struct Screen {
pub pen: Cell,
pub autowrap: bool,
pub cursor_visible: bool,
pub ice_colors: bool,
pub look: Look,
pub base_font: u8,
pub base_ice: bool,
pub tiles: Tiles,
/* private fields */
}Fields§
§pen: CellAttributes applied to newly written glyphs (ch is unused).
autowrap: bool§cursor_visible: bool§ice_colors: bool§look: LookThe palette and fonts the BBS has chosen.
base_font: u8The font (CTerm ID) a reset returns to: the entry’s choice.
base_ice: boolWhether a reset leaves iCE colors on: the entry’s choice.
tiles: TilesThe pixel graphics cells show (see Cell::tile).
Implementations§
Source§impl Screen
impl Screen
pub fn new(cols: usize, rows: usize, scrollback_limit: usize) -> Self
pub fn cols(&self) -> usize
pub fn rows(&self) -> usize
pub fn cursor(&self) -> (usize, usize)
pub fn row(&self, y: usize) -> &[Cell]
pub fn cell_mut(&mut self, x: usize, y: usize) -> Option<&mut Cell>
pub fn scrollback_len(&self) -> usize
Sourcepub fn scrollback_line(&self, i: usize) -> &[Cell]
pub fn scrollback_line(&self, i: usize) -> &[Cell]
Line i of the scrollback, 0 being the oldest.
pub fn clear_scrollback(&mut self)
pub fn resize(&mut self, cols: usize, rows: usize)
pub fn carriage_return(&mut self)
Sourcepub fn reverse_index(&mut self)
pub fn reverse_index(&mut self)
Move up one line, scrolling the region down if at its top (ESC M).
pub fn backspace(&mut self)
pub fn tab(&mut self)
pub fn back_tab(&mut self, n: usize)
pub fn move_by(&mut self, dx: isize, dy: isize)
pub fn set_scroll_region(&mut self, top: usize, bottom: usize)
pub fn save_cursor(&mut self)
pub fn restore_cursor(&mut self)
Sourcepub fn scroll_up(&mut self, n: usize)
pub fn scroll_up(&mut self, n: usize)
Scroll the region up n lines. Lines leaving the top of a full-screen
region go to scrollback.
pub fn scroll_down(&mut self, n: usize)
Sourcepub fn erase_display(&mut self, mode: u32)
pub fn erase_display(&mut self, mode: u32)
ED: 0 = cursor to end, 1 = start to cursor, 2/3 = whole screen.
Clearing the whole screen saves its content to scrollback first, so BBS screens that are wiped between menus can still be reviewed, and, like ANSI.SYS, homes the cursor.
Sourcepub fn erase_line(&mut self, mode: u32)
pub fn erase_line(&mut self, mode: u32)
EL: 0 = cursor to end of line, 1 = start to cursor, 2 = whole line.
Sourcepub fn erase_chars(&mut self, n: usize)
pub fn erase_chars(&mut self, n: usize)
ECH: blank n cells from the cursor without moving it.
Sourcepub fn insert_chars(&mut self, n: usize)
pub fn insert_chars(&mut self, n: usize)
ICH: insert n blanks at the cursor, shifting the rest of the line right.
Sourcepub fn delete_chars(&mut self, n: usize)
pub fn delete_chars(&mut self, n: usize)
DCH: delete n cells at the cursor, shifting the rest of the line left.
Sourcepub fn insert_lines(&mut self, n: usize)
pub fn insert_lines(&mut self, n: usize)
IL: insert n lines at the cursor row (within the scroll region).
Sourcepub fn delete_lines(&mut self, n: usize)
pub fn delete_lines(&mut self, n: usize)
DL: delete n lines at the cursor row (within the scroll region).
Sourcepub fn draw_text(
&mut self,
x: usize,
y: usize,
text: &[u8],
fg: Color,
bg: Color,
)
pub fn draw_text( &mut self, x: usize, y: usize, text: &[u8], fg: Color, bg: Color, )
Write a string of CP437 glyphs directly at a position without moving the cursor; used by the built-in text-mode UI.
pub fn fill_rect(&mut self, x: usize, y: usize, w: usize, h: usize, cell: Cell)
Sourcepub fn cell_px(&self) -> (usize, usize)
pub fn cell_px(&self) -> (usize, usize)
The size of a cell in pixels, for pixel graphics: an 8x16 VGA font, or 8x8 on screens of 43 rows or more (as BadTerm draws them).
Sourcepub fn place_image(&mut self, img: &Image, scrolling: bool)
pub fn place_image(&mut self, img: &Image, scrolling: bool)
Put a picture on the screen with its top left at the cursor’s cell,
as sixel does: with scrolling, the screen scrolls to make room
and the cursor ends on the row below the picture’s last full band,
at the column it started in; without, it goes at the top left of
the screen, what doesn’t fit is cut off and the cursor stays put.
Sourcepub fn draw_pixels(
&mut self,
rect: (isize, isize, usize, usize),
pixel: impl Fn(isize, isize) -> u32,
)
pub fn draw_pixels( &mut self, rect: (isize, isize, usize, usize), pixel: impl Fn(isize, isize) -> u32, )
Draw pixels over the screen in rect (x, y, w, h, in screen pixels;
it may go off the screen, and that part is clipped): pixel(x, y)
is each one’s color, 0xFFRRGGBB, or 0 to leave it as it is.